Information
The socketfilter Firewall is what is used when the Firewall is turned on in the Security & Privacy Preference Pane. In order to appropriately monitor what access is allowed and denied, logging must be enabled.The logging level must be set to "detailed" to be useful in monitoring connection attempts that the firewall detects. Throttled login is not sufficient for examining Firewall connection attempts.
In-depth log monitoring on macOS may require changes to the "Enable-Private-Data" key in SystemLogging.System to ensure more complete logging.
Reviewing macOS Unified Logs
In order to troubleshoot the successes and failures of a Firewall, detailed logging should be enabled.
Solution
Terminal Method:
Run the following command to enable logging of the firewall:
$ /usr/bin/sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingmode on
Turning on log mode
$ /usr/bin/sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingopt detail
Setting detail log option
Note: If the Firewall settings are set through a configuration profile, then modifications cannot be done through the command line. If attempted, you will receive the message Firewall settings cannot be modified from command line on managed Mac computers.
Profile Method:
Create or edit a configuration profile with the following information:
- The PayloadType string is com.apple.security.firewall
- The key to include is EnableFirewall
- The key must be set to <true/>
- The key to also include is EnableLogging
- The key must be set to <true/>
- The key to also include is LoggingOption
- The key must be set to <string>detail</string>
Note: Firewall Logging must be enabled with this profile. It can either be set with the Firewall and Stealth Mode (2.5.2.2 and 2.5.2.3) or as a separate profile. Setting logging with its own profile will not cause a conflict.
Impact:
Detailed logging may result in excessive storage.
Item Details
Category: AUDIT AND ACCOUNTABILITY, SYSTEM AND COMMUNICATIONS PROTECTION
References: 800-53|AU-2, 800-53|AU-3, 800-53|AU-3(1), 800-53|AU-7, 800-53|AU-12, 800-53|SC-7, 800-53|SC-7(5), CSCv7|6.2, CSCv7|6.3, CSCv7|9.2
Control ID: 7b4f2ad8f07cf861d0249656058bc2f8779333337aa08afa6c765628f0bbf4b6