cmehay / docker-tor-hidden-service

232 stars 53 forks source link

tor control password produces error when container is restarted #87

Closed blob42 closed 2 years ago

blob42 commented 2 years ago

Using TOR_CONTROL_PASSWORD in a container will produce an error when the container is restarted.

ERROR:root:Command '['tor', '--quiet', '--hash-password', '*****']' returned non-zero exit stat
us 1.
t-lnd-main        | Entrypoint WARNING  Traceback (most recent call last):
t-lnd-main        | Entrypoint WARNING    File "/usr/local/src/onions/onions/Onions.py", line 499, in main
t-lnd-main        | Entrypoint WARNING      onions.setup_hosts()
t-lnd-main        | Entrypoint WARNING    File "/usr/local/src/onions/onions/Onions.py", line 354, in setup_hosts
t-lnd-main        | Entrypoint WARNING      self._setup_control_port()
t-lnd-main        | Entrypoint WARNING    File "/usr/local/src/onions/onions/Onions.py", line 90, in _setup_control_port
t-lnd-main        | Entrypoint WARNING      self._hash_control_port_password(os.environ[
t-lnd-main        | Entrypoint WARNING    File "/usr/local/src/onions/onions/Onions.py", line 60, in _hash_control_port_password
t-lnd-main        | Entrypoint WARNING      self.control_hashed_password = subprocess.check_output([
t-lnd-main        | Entrypoint WARNING    File "/usr/local/lib/python3.9/subprocess.py", line 424, in check_output
t-lnd-main        | Entrypoint WARNING      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
t-lnd-main        | Entrypoint WARNING    File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
t-lnd-main        | Entrypoint WARNING      raise CalledProcessError(retcode, process.args,
t-lnd-main        | Entrypoint WARNING  subprocess.CalledProcessError: Command '['tor', '--quiet', '--hash-password', '*****']' returne
d non-zero exit status 1.

It took me a day to find that this error was due to using TOR_CONTROL_PASSWORD. I could now fix it by simply giving directly the hashed password using the TOR_EXTRA_OPTIONS while still using TOR_CONTROL_PORT on the service config, and the issue is resolved for me.