726
Firewall (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] TimTamJimJam@lemmy.world 115 points 8 months ago

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.

[-] SpaceCowboy@lemmy.ca 62 points 8 months ago

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

[-] Blackmist@feddit.uk 39 points 8 months ago

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.

[-] SpaceCowboy@lemmy.ca 13 points 8 months ago

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

[-] aStonedSanta@lemm.ee 4 points 8 months ago

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

[-] JasonDJ@lemmy.zip 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.

[-] user224@lemmy.sdf.org 11 points 8 months ago

the script stopped running when the SSH session ended

tmux
Always use tmux when possible for remote connections.

[-] QuazarOmega@lemy.lol 2 points 8 months ago

What does it do in this case?

[-] user224@lemmy.sdf.org 10 points 8 months ago* (last edited 8 months ago)

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)

[-] JasonDJ@lemmy.zip 3 points 8 months ago

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.

[-] krash@lemmy.ml 3 points 8 months ago

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.

[-] octopus_ink@lemmy.ml 7 points 8 months ago

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.

[-] krash@lemmy.ml 4 points 8 months ago

Thanks for the elaborate answer!

[-] octopus_ink@lemmy.ml 3 points 8 months ago
[-] aidan@lemmy.world 5 points 8 months ago

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

this post was submitted on 16 Feb 2024
726 points (100.0% liked)

Programmer Humor

32429 readers
909 users here now

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

Rules:

founded 5 years ago
MODERATORS