Menu bar firewall status indicator #
BitBar (open source) can be used to display an emoji of choice in the menubar depending on the built-in Application Firewall's state: off (0), on for specific services (1), or on for essential services (aka stealth mode) (2):
- Install and launch BitBar
- Create a new directory (e.g., ~/bitbar/) to store plugins when prompted
- Save the following Bash script as ~/bitbar/firewall_status_indicator.10s.sh and make it executable (chmod +x firewall_status_indicator.10s.sh):
#!/bin/bash
state=$(defaults read "/Library/Preferences/com.apple.alf" globalstate);
if [ "$state" -eq 2 ]; then
echo "🔒"
elif [ "$state" -eq 1 ]; then
echo "❗️"
else
echo "‼️"
fi
echo "---"
echo "Open Firewall preference pane| href='x-apple.systempreferences:com.apple.preference.security?Firewall'"
GeekTool (free) can display a tiny red or green status LED on the desktop or in the menubar to indicate the firewall status:
- Steps:
- Install and launch GeekTool
- Check "Enable" and "Automatically launch at login"
- Drag "Shell" to the desktop
- Position: 1007 | 4 (change as needed)
- Size: 95 | 45
- Check "Keep on Top"
- Command: if [ `defaults read "/Library/Preferences/com.apple.alf" globalstate` -eq 2 ];then EX=0;else EX=1;fi;exit $EX
- Refresh every: 60s (change as desired)
- Check "Display status feedback image"
- Notes:
- To check for (1), change "-eq 2" to "-eq 1" and to check for either (1) or (2), change to "-ge 1"
- If your geeklet causes GeekTool to freeze, delete ~/Library/Preferences/org.tynsoe.geeklet.shell.plist to start over.
- Props:
TextBar ($2.99) can be used to display a shield icon and the firewall state (0, 1, or 2 as explained above) in the menu bar:
- Install and launch TextBar
- Disable the default items
- Click the plus symbol to add a new item
- Replace echo 'Hello' with defaults read /Library/Preferences/com.apple.alf globalstate
- Check the far left box to enable and select the shield image
/mac | Sep 10, 2017
Subscribe or visit the archives.