Skip to content

Instantly share code, notes, and snippets.

@Lunchb0ne
Created August 6, 2022 20:33
Show Gist options
  • Save Lunchb0ne/d666b4d145aa1e7c54b461385e52bed5 to your computer and use it in GitHub Desktop.
Save Lunchb0ne/d666b4d145aa1e7c54b461385e52bed5 to your computer and use it in GitHub Desktop.
A way to bypass reset attacks that some ISP use for censorship. Works on macOS 12.5.
#
# Default PF configuration file.
#
# This file contains the main ruleset, which gets automatically loaded
# at startup. PF will not be automatically enabled, however. Instead,
# each component which utilizes PF is responsible for enabling and disabling
# PF via -E and -X as documented in pfctl(8). That will ensure that PF
# is disabled only when the last enable reference is released.
#
# Care must be taken to ensure that the main ruleset does not get flushed,
# as the nested anchors rely on the anchor point defined here. In addition,
# to the anchors loaded by this file, some system services would dynamically
# insert anchors into the main ruleset. These anchors will be added only when
# the system service is used and would removed on termination of the service.
#
# See pf.conf(5) for syntax.
#
# Skip loopback
set skip on lo0
# Set ethernet interface here (is en0 by default on macOS)
ether=en0
#
#
# com.apple anchor point
#
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"
# Rule to drop RST which ISPs generally use for censorship
block in on $ether proto tcp from any port 443 flags R/R
@Lunchb0ne
Copy link
Author

Modify /etc/pf.conf and then reload using sudo pfctl -f /etc/pf.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment