this post was submitted on 16 Feb 2024
716 points (97.6% liked)

Programmer Humor

32371 readers
562 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 118 points 8 months ago (3 children)

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.

[–] [email protected] 63 points 8 months ago (1 children)

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

[–] [email protected] 39 points 8 months ago (2 children)

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.

[–] [email protected] 13 points 8 months ago (1 children)

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

[–] [email protected] 4 points 8 months ago

lol. When I get asked what went wrong at work. So. A solar flare can swap the bits…

[–] [email protected] 5 points 8 months ago* (last edited 8 months ago)

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.

[–] [email protected] 11 points 8 months ago (3 children)

the script stopped running when the SSH session ended

tmux
Always use tmux when possible for remote connections.

load more comments (3 replies)
[–] [email protected] 3 points 8 months ago (2 children)

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.

[–] [email protected] 7 points 8 months ago (1 children)

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.

[–] [email protected] 4 points 8 months ago (1 children)

Thanks for the elaborate answer!

[–] [email protected] 3 points 8 months ago

Any time! :)

[–] [email protected] 5 points 8 months ago

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

[–] [email protected] 77 points 8 months ago (5 children)

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

[–] [email protected] 52 points 8 months ago (1 children)

There is nothing more perminant than a temporary solution.

[–] [email protected] 24 points 8 months ago* (last edited 8 months ago)

"i'll fix that later"
Narrator: "they never did"

[–] [email protected] 30 points 8 months ago

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

[–] [email protected] 12 points 8 months ago

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

[–] [email protected] 5 points 8 months ago

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

load more comments (1 replies)
[–] [email protected] 35 points 8 months ago* (last edited 8 months ago) (1 children)

Whistles and looks away

I have absolutely no idea what you're talking about

😜

[–] [email protected] 28 points 8 months ago (2 children)

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.

[–] [email protected] 39 points 8 months ago (1 children)

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.

[–] [email protected] 12 points 8 months ago

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.

[–] [email protected] 6 points 8 months ago* (last edited 8 months ago) (1 children)

Hehe. I was joking there.

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

[–] [email protected] 6 points 8 months ago

I've been bamboozled

[–] [email protected] 17 points 8 months ago (2 children)

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!

load more comments (2 replies)
[–] [email protected] 9 points 8 months ago* (last edited 8 months ago)

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 ).

[–] [email protected] 8 points 8 months ago (2 children)

I know this is posted in funny, but whatever. You could still login locally using keyboard and monitor. Uncool, but it works

[–] [email protected] 17 points 8 months ago

You are assuming there is a keyboard and monitor plugged to it, and that the computer is somewhere nearby.

None of those are automatically true. And when it's nearby, it's usually easier to just get the SD card into another computer and edit the configuration.

[–] [email protected] 5 points 8 months ago

That's exactly what I did lol. Thankfully my Pi's just in a drawer. If this was a remote host at work I would've already shat myself :P

[–] [email protected] 6 points 8 months ago (2 children)

Connects a monitor and a keyboard to the Raspberry Pi

[–] [email protected] 9 points 8 months ago

Defeatedly Connects a monitor and a keyboard to the Raspberry Pi

[–] [email protected] 2 points 8 months ago (4 children)
load more comments (4 replies)
[–] [email protected] 6 points 8 months ago

this is me dealing with ZScaler at work

[–] [email protected] 6 points 8 months ago

I've had to boot a remote server into rescue after locking myself out.

I think most people have done this at least once.

[–] [email protected] 5 points 8 months ago (1 children)

ufw is not a good software. I really tried to work with it. My solution was to disable it.

[–] [email protected] 8 points 8 months ago (2 children)

It's better than raw iptables / nftables though.

[–] [email protected] 6 points 8 months ago* (last edited 8 months ago)

Just like stabbing yourself if the eye is better with a fork than with a rusty fork.

pf gang rise up !

[–] [email protected] 4 points 8 months ago* (last edited 8 months ago)

Not IMHO no. By far.

[–] [email protected] 4 points 8 months ago

This literally happened to me yesterday. Fortunately ufw enable did not configure it as persistent across reboots 🤠

[–] [email protected] 3 points 8 months ago

i have ssh configured on a different port,

more than one time i enabled ssh in ufw, restarted the service... and the connection dropped

[–] [email protected] 3 points 8 months ago
[–] [email protected] 3 points 8 months ago (12 children)

What is a good firewall that can also block ports published with docker? I'd need it to run on the same host.

[–] [email protected] 3 points 8 months ago (3 children)

Ufw should work, jus ufw block/limit/allow port number

load more comments (3 replies)
load more comments (11 replies)
[–] [email protected] 3 points 8 months ago

it's become self aware and is always blocking ports 22 & 23.

[–] [email protected] 3 points 8 months ago (1 children)

It happened to me when I was configuring IP geoblocking: Only whitelist IP ranges are allowed. That was fetched from a trusted URL. If the DNS provider just happened to not be on that list, the whitelist would become empty, blocking all IPs. Literally 100% proof firewall; not even a ping gets a pass.

load more comments (1 replies)
[–] [email protected] 2 points 8 months ago

Not exactly the same thing, but on one of my systems, eth0 and eth1 swapped position after a kernel update, so the IP was on the wrong interface. I had IPMI/BMC on the system so didn't have to physically go to it and plug in a keyboard and monitor, but I still had to deal with manually typing a long randomly-generated password, twice (one to log in and once again for sudo).

I'm glad "predictable" interface names are supported now. Those eth0/eth1/etc names were dangerous since the numbers were just based on the order the kernel loaded the drivers and initialized them in, which can change across reboots. The predictable names are based on physical position in the system, so they're consistent across reboots.

load more comments
view more: next ›