Created
August 29, 2020 10:07
-
-
Save smokeev-dev/66a880bba4ad605430fbc1d1706349d5 to your computer and use it in GitHub Desktop.
How To Block Tor Exit-Nodes with Nginx (GeoIP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Download a list of exit-nodes | |
| wget -qO- https://check.torproject.org/torbulkexitlist | sort | awk '{print "" $1 " 1;"}' > /tmp/tor_exit_list.txt | |
| # Prepare a geoip config | |
| echo -e "geo \$isTor {\ndefault 0; \n$(cat /tmp/tor_exit_list.txt) \n}" > /etc/nginx/conf.d/deny-geoip-tor.conf | |
| ## Add to virtual host | |
| # location / { | |
| # if ($isTor) { | |
| # return 403; | |
| # } | |
| # try_files $uri $uri/ =404; | |
| # } | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment