How can I block/close (or drop all the packets coming from) all ports with PF except TCP port 80 and TCP 443? So I only want to make use of port 80 and 443 via TCP.
I tried this, but I receive an error
sudo gedit /etc/pf.conf
scrub-anchor "com.apple/*" nat-anchor "com.apple/*" rdr-anchor "com.apple/*" dummynet-anchor "com.apple/*" anchor "com.apple/*" load anchor "com.apple" from "/etc/pf.anchors/com.apple" set block-policy drop pass in all keep state pass out all keep state block in proto tcp to port 80 block in proto tcp to port 443 block drop from any to 18.104.22.168 block drop from any to 22.214.171.124
sudo pfctl -v -n -f /etc/pf.conf pfctl: Use of -f option, could result in flushing of rules present in the main ruleset added by the system at startup. See /etc/pf.conf for further details. set block-policy drop /etc/pf.conf:8: Rules must be in order: options, normalization, queueing, translation, filtering
I also tried the approach described in the link but that did also not work. Link to repo