

- #Block outgoing connections for a program mac upgrade
- #Block outgoing connections for a program mac pro
Present in the main ruleset added by the system at startup. Pfctl: Use of -f option, could result in flushing of rules Load your custom rules ( sudo pfctl -f /etc/pf.conf) - output should resemble the following if all is well: The ProcessĬreate a backup of the default pf.conf file ( sudo cp -p /etc/pf.conf /etc/pf.conf.bak)Īdd your own rules to /etc/pf.conf (appending them after the default Apple anchors) - see examples below
#Block outgoing connections for a program mac pro
In my case, I worked around these concerns by using Jamf Pro (a device management / MDM tool) to apply a Policy with 2 payloads: one to push out my centrally managed, custom pf.conf file (containing my rules) as a Package and one to run a Script containing the commands that load the PF config and activate packet filter my Policy runs at Startup (Ongoing) and on periodic check-in so that in-scope Macs are always configured with my custom rules.
#Block outgoing connections for a program mac upgrade
For example, in an upgrade from High Sierra (macOS 10.13.x) to Catalina (10.15.x), the following pf files were overwritten on my test Mac:Ĭustom anchors under /etc/pf.anchors/ were retained, but they were not especially useful since the references to them in pf.conf were overwritten!Īdditionally, you must re-enable PF ( pfctl -E) each time your Mac reboots ideally, you should create a launchd job for this (see Pfctl launch daemon does not seem to process program arguments). Note, this approach is not perfect one of the drawbacks of modifying pf.conf directly is that macOS upgrades revert that file to its default contents (removing your custom rules). For example, to restrict access to SSH (TCP/22) on your Mac, you first create a rule to block all traffic to port 22, then create additional rules after the initial block to allow IP addresses, subnets, etc. Pf works on the principle of first blocking traffic, then allowing it.

In the hopes that it helps someone in a similar situation. Marc Kerr, I was able to accomplish what I needed. With the help of an awesome post called A simple guild to the Mac PF Firewall by I am more familiar with CentOS/RHEL-based distributions, TCP wrappers, and iptables which may have contributed to my confusion. This would be an easy task but my lack of familiarity with BSD and packet filter (pf) made it a little more challenging than I expected. Ports on a Mac Mini “server” running macOS High Sierra (also tested successfully on Mojave, Catalina, Big Sur, and Monterey). I encountered a scenario recently where I needed to quickly restrict access to specific subnets and specific All product names, logos, and brands used in this post are property of their respective owners.
