apernet / OpenGFW

OpenGFW is a flexible, easy-to-use, open source implementation of GFW (Great Firewall of China) on Linux
https://gfw.dev/
Mozilla Public License 2.0
9.31k stars 703 forks source link

feat: tor analyzer (phase 1) #140

Open eddc005 opened 1 month ago

eddc005 commented 1 month ago

A very straightforward Tor analyzer. Blocks all public relays by querying the authoritative directory. Doesn't block private bridges yet

Example rule

- name: Block Tor relays
  action: block
  expr: tor != nil && tor.relay

Testing

# Install Tor command line
$ sudo apt-get install tor

# We want to run tor interactively, so stop the service
$ sudo systemctl stop tor

# Without running OpenGFW, tor will bootstrap successfully
$ tor
...
Jun 12 00:00:00.000 [notice] Bootstrapped 100% (done): Done

# With OpenGFW, tor will fail to bootstrap
$ tor
...
Jun 12 00:00:00.000 [notice] Bootstrapped 10% (conn_done): Connected to a relay
(stuck here)

Next step

  1. Periodically update the directory
  2. Block private bridges (more complicated, GFW uses active probe for this)