Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Lion solution' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Lion solution
Authored by: lhagan on Apr 16, '12 10:30:26PM
If you're looking for a way to control Lion's firewall using AppleScript, I put together a script that does exactly that. It's up on GitHub (https://github.com/lhagan/Firewall-Switch) and here's the (MIT Licensed) code:

set getValue to do shell script "defaults read /Library/Preferences/com.apple.alf globalstate"
if getValue is less than "2" then
	display dialog "Switch firewall ON?" with icon caution
	do shell script "/usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on --setblockall on" with administrator privileges
else
	display dialog "Switch firewall OFF?" with icon caution
	do shell script "/usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off" with administrator privileges
end if
Based on an article by Charles Edge (http://krypted.com/mac-os-x/the-os-x-application-layer-firewall-part-3-lion/) and a comment by 'dsanfili' (http://hints.macworld.com/article.php?story=20090217124731597).

[ Reply to This | # ]