Howto: Control firewall from command line

Hi
How do I allow an application to access the Internet from the command line, when the firewall is enabled ?

Using these command have not worked for me
sudo /usr/libexec/ApplicationFirewall/socketfilterfw -t <Application>
This just hang..

sudo /usr/libexec/ApplicationFirewall/socketfilterfw -t <FULL PATH><Application>
This just hang..
then i did this instead:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw -kt <FULL PATH><Application>
This time it did not hang, but it did not add the application to the firewall rules either ?

Anyone knows if it is possible to control the Built-in firewall from the command line ??

Mac OS X (10.5.8)

Posted on Jun 17, 2010 4:38 PM

Reply
5 replies

Jun 21, 2010 11:08 AM in response to CountZ

CountZ wrote:
Well ipfw built its rules based on port numbers. I was hoping for a solution based on application names, just like you can do from the GUI ?


I did what I suggested you do ("man ipfw") and have to agree that ipfw provides no support for applications by name. Using "man" and a Web search I also couldn't find anything that explains how OS X implements that.

Jun 25, 2010 12:32 PM in response to CountZ

ipfw doesn't know anything about applications. It can't, being a layer 3 packet filtering firewall.

The GUI controls a layer 7 firewall.

Apparently you can control it from the command line, as per this article:

http://krypted.com/mac-os-x/command-line-alf-on-mac-os-x/

I'm sure google would turn up more. However, since socketfilterfw has no man page (nor does anything else in /usr/libexec/ApplicationFirewall) you're basically on your own. Also, I'm pretty sure that nothing in libexec is meant to be used directly...they are implementation helper programs, and subject to unannounced change.

But good luck.

Message was edited by: g_wolfman

Message was edited by: g_wolfman

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Howto: Control firewall from command line

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.