Skip to content

Instantly share code, notes, and snippets.

@tom--
Last active October 12, 2015 14:28
Show Gist options
  • Select an option

  • Save tom--/4040780 to your computer and use it in GitHub Desktop.

Select an option

Save tom--/4040780 to your computer and use it in GitHub Desktop.
Script for safe editing of ipfw rules on FreeBSD using tmux
#!/bin/sh
# What it does:
# - Start tmux
# - Divide the term window into two panes:
# * small lower pane that runs "sleep 60; sudo ipfw disable firewall",
# * large upper pane with a shell in it.
#
# Do your dangerous IPFW work in the upper pane.
# When done, switch to lower pane (Crtl-B, down arrow) and kill it with Ctrl-C
if [ x$1 = 'xsafety' ]; then
echo "in 60 sec the fw will be disabled"
echo "ctrl-B, up/down arrow to use other pane"
echo "sleep 60..."
sleep 60
sudo ipfw disable firewall
exit
fi
tmux new-session -s ipfw -d
tmux split-window -t ipfw -v -l 6 "sh scratch.sh safety; read"
tmux select-pane -t ipfw -U
tmux att -t ipfw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment