brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: stop the Mac firewall from waving through every signed app

Security
~/tips/tip-macos-socketfilterfw-allowsigned

/usr/libexec/ApplicationFirewall/socketfilterfw --getallowsigned

Makes new downloaded apps ask before the Mac firewall lets incoming connections in.

With the macOS firewall on, a downloaded app that’s signed by a valid certificate authority is let in automatically by default. It can accept incoming connections without you ever seeing a prompt. I’d rather decide that myself, at least on a laptop that sits on hotel and train Wi-Fi.

The firewall has a command-line tool that’s not on your PATH. First check what it does now:

/usr/libexec/ApplicationFirewall/socketfilterfw --getallowsigned

That shows whether built-in and downloaded signed apps are allowed automatically. To stop it for downloaded apps:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsignedapp off

The built-in apps from Apple are a separate switch (--setallowsigned), and I’d leave that one alone. In System Settings it’s the same pair of options: Network, then Firewall, then Options, where you’ll find “Automatically allow downloaded signed software to receive incoming connections”.

To see which apps already have their own firewall entry:

/usr/libexec/ApplicationFirewall/socketfilterfw --listapps

This only matters when the firewall is on at all, which --getglobalstate tells you. It’s about incoming connections only, so it doesn’t stop an app from calling home. After the change, a new app that wants to listen for connections, like a game server or a sync tool, makes macOS ask you first, which is the whole point but takes some getting used to. And if the firewall is set by a configuration profile on a managed Mac, the command line can’t change it.

Further reading: Change Firewall settings on Mac, socketfilterfw man page

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link