118 points

Happened to me in work once… I was connected via SSH to one of our test machines, so I could test connection disruption handling on a product we had installed.

I had a script that added iptables rules to block all ports for 30 seconds then unblock them. Of course I didn’t add an exception for port 22, and I didn’t run it with nohup, so when I ran the script it blocked the ports, which locked me out of SSH access, and the script stopped running when the SSH session ended so never unblocked the ports. I just sat there in awe of my stupidity.

permalink
report
reply
63 points

We’ve all experienced the walk of shame to the server room to hook up a monitor keyboard.

permalink
report
parent
reply
39 points

Ah, if only it was a server room and not a customer 3 hours drive away. And he’d closed and gone home for the night.

Fortunately it just needed a reboot, and I was able to talk him through that in the morning.

permalink
report
parent
reply
13 points

Oof… well you can just say “it must be some hardware problem or something… maybe a reboot will fix it.”

permalink
report
parent
reply
5 points
*

Oof I did a firmware upgrade on my main external firewall.

The upgrade went fine but when we added an ISP a month or so prior, I forgot to redistribute the ISPs routes. While all my ISPs were technically working, and the firewall came back up, nothing below it could get to the internet, so it was good as down.

Cue the 1.5 hour drive into the office…

Had that drive to think about what went wrong. Got into the main lobby, sat down, joined the wifi, and fixed it in 3 minutes.

Didn’t even get to my desk or the datacenter.

permalink
report
parent
reply

the script stopped running when the SSH session ended

tmux
Always use tmux when possible for remote connections.

permalink
report
parent
reply
2 points

What does it do in this case?

permalink
report
parent
reply

Well, the script could keep running even after he would have detached from that tmux session due to losing ssh connection. And since that script would unblock all ports after 30 seconds…

(Same use case as nohup that they mentioned)

permalink
report
parent
reply
3 points

Tmux essentially creates a pseudo-shell that persists between sessions.

So you can start a process, detach the session, start something else, disconnect, come back next week, and check on it.

It does other things too. Like console tiling.

permalink
report
parent
reply
3 points

Out of curiousity, how would nohup make your situation different? As I understand, nohup makes it possible to keep terminal applications running even when the terminal session has ended.

permalink
report
parent
reply
7 points

If the script was supposed to wait 30 secs and then unblock the ports, running with nohup would have allowed the ports to be unblocked 30 secs later. Instead, the script terminated when the SSH session died, and never executed the countdown nor unblock.

permalink
report
parent
reply
4 points

Thanks for the elaborate answer!

permalink
report
parent
reply
5 points

the script stopped running when the SSH session ended so never unblocked the ports

permalink
report
parent
reply
77 points

I accidentally put all the interfaces on my router running openwrt into the wrong firewall zone so now I can’t access it via ssh or the web interface. I already had it configured though and it still works so I’m just ignoring the problem until something breaks

permalink
report
reply
52 points

There is nothing more perminant than a temporary solution.

permalink
report
parent
reply
24 points
*

“i’ll fix that later”
Narrator: “they never did”

permalink
report
parent
reply
30 points

It’s super secure though, not even you have access!

permalink
report
parent
reply
12 points

I did the same thing, set up OpenWRT perfectly, then changed the local range from 192.168.1.0 to 192.168.0.0 to suit some legacy connections. Everything works, except I can’t change settings on the router, so for now I leave it alone

permalink
report
parent
reply
5 points

Maybe you can put aside a day which has nothing else going on so you can sit down and fix it before it breaks.

permalink
report
parent
reply
2 points

Sounds like my Unifi experience with the old CloudKeys that liked to brick themselves if the wind blew in a way they disliked. Everything still ran fine, but I couldn’t manage any of it till I factory reset it all. I think it ran like that for 3mo before I could be bothered 😅

permalink
report
parent
reply
35 points
*

Whistles and looks away

I have absolutely no idea what you’re talking about

😜

permalink
report
reply
28 points

UFW is a software firewall. SSH is a way to remote into computers. The joke is they turned on UFW and got locked out of the machine.

permalink
report
parent
reply
39 points

I’m pretty sure it was a joke.

Everyone did this at some point, but nobody would admit such a silly thing happened to them.

permalink
report
parent
reply
12 points

Never done this to a single server.

Managed to write the “ufw enable, deny all” part of ansislbe script without the “allow 22” part and run it against all my homelab once.

permalink
report
parent
reply
6 points
*

Hehe. I was joking there.

Have done it randomly on my backup raspi 3 so many times 🤣

permalink
report
parent
reply
6 points

I’ve been bamboozled

permalink
report
parent
reply
17 points

Firewallcmd’s runtime-to-permanent is one of my favorite features of any software. Set everything up, make sure everything works before making the changes permanent. If not, just reboot!

permalink
report
reply
1 point

Isn’t that just like it is on Cisco systems?

permalink
report
parent
reply
2 points

Yep, exactly the same. Has saved my ass on an occasion or two when changing the uplink config.

permalink
report
parent
reply
9 points
*

Happened to me, luckilly I kept an ssh connection up.

Now I make sure to enable the firewall rules before I enable ufw ( still happened to me 3 more times ).

permalink
report
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 3.7K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments