[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-relays] HOWTO: deliver tor-exit-notice_DE.html over ipv6 port 80 too
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
B/c ipv6 of Tor implements currently no DirPort I copied+pasted together the following solution to deliver a Tor exit notice over HTTP port of ipv6 too :
The python snippet runs under a non-privileged user w/o login shell :
$ cat ipv6-httpd.py
import socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
return SimpleHTTPRequestHandler.do_GET(self)
class HTTPServerV6(HTTPServer):
address_family = socket.AF_INET6
def main():
server = HTTPServerV6(('::', 8181), MyHandler)
server.serve_forever()
if __name__ == '__main__':
main()
The ip6table rules to redirect fort 80 from outside to the local non-privileged port :
from=80
to=8181
$IPT -t nat -A PREROUTING -i enp3s0 -p tcp -m tcp --destination-port $from -j REDIRECT --to-ports $to
$IPT -A INPUT -p tcp -m tcp --destination-port $to -j ACCEPT
And finally the script to start it during boot :
$> cat /home/simplehttp/ipv6-httpd.sh
#!/bin/sh
#
d=$(mktemp -d /tmp/XXXXXX) &&\
cd $d &&\
cp /etc/tor/tor-exit-notice_DE.html ./index.html &&\
nice python ~/ipv6-httpd.py 1>./log 2>&1
:-)
- --
Toralf
pgp key: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 0076 E94E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iF4EAREIAAYFAlVeC48ACgkQxOrN3gB26U59HwD8CwnBIpZOkq8tN01ciWsZQh7c
FO42AGmkkhCI/CbucnYA/j3zSq1wJzuHgMdWZUbQCQvHt+KEYkobdNkcHqkK3mWE
=FA7E
-----END PGP SIGNATURE-----
_______________________________________________
tor-relays mailing list
tor-relays@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays