1
I've been trying to reload pf rules whenever network changes. Here is my plist file. /Library/LaunchAgents/com.wwk.networkchange.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.wwk.networkchange</string>
<key>ProgramArguments</key>
<array>
<string>sudo /sbin/pfctl -f /Users/wwk/pf.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WatchPaths</key>
<array>
<string>/private/var/run/resolv.conf</string>
</array>
</dict>
</plist>
I can see that /private/var/run/resolv.conf is changed when network interfaces are changed but pf rules aren't reloaded at all. FYI, /Users/wwk/pf.conf is there and I've enabled /sbin/pfctl to be run without password prompt via /etc/sudoers file. Thanks in any advance!