mirror of
https://github.com/cmehay/docker-tor-hidden-service.git
synced 2025-04-23 07:19:11 +00:00
commit
7f16f43cdf
1 changed files with 9 additions and 1 deletions
|
@ -11,8 +11,9 @@ def set_conf():
|
||||||
with open("/etc/tor/torrc", "a") as conf:
|
with open("/etc/tor/torrc", "a") as conf:
|
||||||
for link in links:
|
for link in links:
|
||||||
path = "/var/lib/tor/hidden_service/{service}".format(service=link)
|
path = "/var/lib/tor/hidden_service/{service}".format(service=link)
|
||||||
|
env_port = links[link]['environment'].get('PORT')
|
||||||
# Test if link has ports
|
# Test if link has ports
|
||||||
if len(links[link]['ports']) == 0:
|
if len(links[link]['ports']) == 0 and not env_port:
|
||||||
print("{link} has no port")
|
print("{link} has no port")
|
||||||
continue
|
continue
|
||||||
conf.write('HiddenServiceDir {path}\n'.format(path=path))
|
conf.write('HiddenServiceDir {path}\n'.format(path=path))
|
||||||
|
@ -26,6 +27,13 @@ def set_conf():
|
||||||
conf.write('HiddenServicePort {service}\n'.format(
|
conf.write('HiddenServicePort {service}\n'.format(
|
||||||
service=service
|
service=service
|
||||||
))
|
))
|
||||||
|
if env_port:
|
||||||
|
service = '80 {ip}:{port}'.format(
|
||||||
|
port=env_port, ip=links[link]['ip']
|
||||||
|
)
|
||||||
|
conf.write('HiddenServicePort {service}\n'.format(
|
||||||
|
service=service
|
||||||
|
))
|
||||||
# set relay if enabled in env (not so secure)
|
# set relay if enabled in env (not so secure)
|
||||||
if 'RELAY' in os.environ:
|
if 'RELAY' in os.environ:
|
||||||
conf.write("ORPort 9001\n")
|
conf.write("ORPort 9001\n")
|
||||||
|
|
Loading…
Add table
Reference in a new issue