Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Control OS X Lion's firewall without opening Preferences.
branch: master

This branch is even with lhagan:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Firewall Switch.app/Contents
.gitignore
LICENSE.md
README.md

README.md

Firewall Switch

Firewall Switch is a simple utility that allows you to turn OS X Lion's built-in firewall on or off without opening Preferences.

Just run the app and it'll detect whether or not the Firewall is turned on. If so, it'll ask you to confirm that you want to turn the firewall off, otherwise it'll ask for confirmation to switch the firewall back on (in "Block all incoming connections" mode).

That's it! Download Firewall Switch to try it out.

Acknowledgements

Thanks to Charles Edge for a very detailed article on scripting the Lion firewall and to Mac OS X Hints commenter dsanfili for the script on which this one is based.

How

Firewall Switch is an AppleScript application that runs shell commands to control the firewall:

# check firewall status
defaults read /Library/Preferences/com.apple.alf globalstate

# turn firewall on (Block all incoming connections)
/usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on --setblockall on

# turn firewall off (Allow all incoming connections)
/usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

By default, Firewall Switch sets the firewall to block everything ('System Preferences > Security > Firewall > Advanced > Block all incoming connections') when switched on. It's really a good idea to use this mode any time you're on a public network.

If you do need to allow access through the firewall to specific applications, you can edit the script to do so. Open 'Applications > Utilities > AppleScript Editor', then go to 'File > Open' and select the Firewall Switch application. Find --setblockall on in the script, delete it, and save the file.

Something went wrong with that request. Please try again.