Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Switching firewall settings from the command line (See related posts)

Provided that you have specified different firewalls in /usr/local/sbin/ (based on customized versions of a basic IPFW ruleset) you can easily switch between different firewall settings from the command line.

First create the different firewall settings & files:
# find /usr/local/sbin -name "*firewall"

/usr/local/sbin/rc.firewall         # default firewall setting
/usr/local/sbin/rc-ftp.firewall     # FTP firewall setting (enable FTP rules)
/usr/local/sbin/rc-ssh.firewall     # SSH firewall setting (enable SSH rules)
/usr/local/sbin/rc-SL.firewall      # Second Life firewall setting (enable Second Life rules)
/usr/local/sbin/rc-r.firewall       # restrictive firewall setting, cf. http://prefetch.net/blog/index.php/2006/08/13/locking-down-the-os-x-firewall/


Then:
# $ cat $HOME/.bash_login

function fwdef() { /usr/bin/sudo  /usr/local/sbin/rc.firewall; }     
function fwftp() { /usr/bin/sudo  /usr/local/sbin/rc-ftp.firewall; } 
function fwssh() { /usr/bin/sudo  /usr/local/sbin/rc-ssh.firewall; } 
function fwsl() { /usr/bin/sudo  /usr/local/sbin/rc-SL.firewall; }   
function fwr() { /usr/bin/sudo  /usr/local/sbin/rc-r.firewall; }     

#----------------

# in Terminal.app

source $HOME/.bash_login 
fwdef
fwftp
fwssh
fwsl
fwr


You need to create an account or log in to post comments to this site.


Related Posts