Find Firewall Status

TomDay
Release Candidate Programs Tester

I have a few computers that check in to Jamf fine, execute policy no problems etc, but we can't Screen Share into them with Casper Remote or SSH in to them. Wondering if the firewall is turned on so I'm looking for a script that might check the firewall status if Anyone has one? I found a Firewall EA on jamf nation, but it's not pulling any data for me, perhaps its dated (2011).

2 ACCEPTED SOLUTIONS

DBrowning
Valued Contributor
#!/bin/sh

fw=$(defaults read /Library/Preferences/com.apple.alf globalstate)

if [ "$fw" == 0 ]; then
echo "<result>No</result>"
else
    echo "<result>Yes</result>"
fi

View solution in original post

franton
Valued Contributor II

Hi @TomDay .. I wrote this as part of my suite of scripts/EA's for the CIS Security Benchmarks for 10.11. Hope it helps.

https://github.com/franton/CIS-Apple-Security-Casper/tree/master/2.6.3%20Enable%20Firewall

View solution in original post

4 REPLIES 4

DBrowning
Valued Contributor
#!/bin/sh

fw=$(defaults read /Library/Preferences/com.apple.alf globalstate)

if [ "$fw" == 0 ]; then
echo "<result>No</result>"
else
    echo "<result>Yes</result>"
fi

View solution in original post

franton
Valued Contributor II

Hi @TomDay .. I wrote this as part of my suite of scripts/EA's for the CIS Security Benchmarks for 10.11. Hope it helps.

https://github.com/franton/CIS-Apple-Security-Casper/tree/master/2.6.3%20Enable%20Firewall

View solution in original post

TomDay
Release Candidate Programs Tester

@franton @ddcdennisb Wow that was fast, thank you both very much, exactly what I needed, I'm off and running.

franton
Valued Contributor II

@ddcdennisb I've found that reading that plist file is unreliable. Hence my GitHub post above.