Benches macOS

6

Change Application-Based firewall via com…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I'm looking for the command line method of changing the application-based firewall. I am not referring to ipfw, which I already have configured. Basically, all I want to do is change "Set access for specific services and applications" to "Allow all incoming connections" under Security > Firewall. However, I need to do this via ssh, so I need the command line method.

6 replies

Sign in or join Beachball Help to reply.

  1. 0

    sysadmin

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It appears I need to use the 'defaults' command to modify /Library/Preferences/com.apple.alf.plist... Is there any other way?

  2. 0

    sysadmin

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Well it turns out PlistBuddy will work...

    /usr/libexec/PlistBuddy -c "Delete :globalstate integer 0" /Library/Preferences/com.apple.alf.plist

    /usr/libexec/PlistBuddy -c "Add :globalstate integer 0" /Library/Preferences/com.apple.alf.plist

    If the item already exists, it appears you need to 'delete' before you can 'add'. Also, the value (0,1,2) determines the state of the firewall. '0' will "allow all incoming connections".

    Anyway, I thought I'd include this just in case anyone else may be attempting the same thing.

    Message was edited by: sysadmin

  3. 0

    Michael Conniff

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks for that. I didn't know about PlistBuddy. The man page is dated Feb 2007, so I wonder which Leopard release that first appeared in? It is not present in my 10.4.11 machine 😉

  4. 0

    sysadmin

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It has been included in several Apple packages dating back to Tiger. However, you have to dig it out of one of the packages in /Library/Receipts. Use the "locate" command and you'll find it in a few packages. Apparently they were using it internally long before they included it in the OS. Using 'defaults' for nested values can be downright painful, so this has come in quite handy.

    I'm glad this helped. 🙂

  5. 0

    Michael Conniff

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    sysadmin wrote:

    It has been included in several Apple packages dating back to Tiger. However, you have to dig it out of one of the packages in /Library/Receipts. Use the "locate" command and you'll find it in a few packages. Apparently they were using it internally long before they included it in the OS.

    Interesting. The same thing was true for
    SetFile, which was/is present in Developer Tools. If you hadn't installed the latter, you could still find it in some of the system update for Tiger.

    Using 'defaults' for nested values can be downright painful,

    Yes 😟

  6. 0

    nerowolfe

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I wonder if the GUI plist editor is simple a frontend to this command?