Last active
October 12, 2015 14:28
-
-
Save tom--/4040780 to your computer and use it in GitHub Desktop.
Script for safe editing of ipfw rules on FreeBSD using tmux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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