nusenu / ansible-relayor

An Ansible Role for Tor Relay Operators
GNU General Public License v3.0
248 stars 43 forks source link

torrc generation fails with dirport 0 and tor_dedicatedExitIP #236

Closed appliedprivacy closed 1 year ago

appliedprivacy commented 2 years ago

Describe the bug

torrc generation fails with dirport 0 and tor_dedicatedExitIP enabled.

To Reproduce

  1. setup an exit
  2. with dirport set to 0
  3. and tor_dedicatedExitIP: True

Expected behavior

torrc gets generated

Version information (please include the following information):

Playbook information

tor_ports:
        - { orport: 443, dirport: 0 }
        - { orport: 8080, dirport: 0 }
tor_dedicatedExitIP: True
tor_ExitRelay: True

OS information

target: debian 11

Debug information

TASK [ansible-relayor : Ensure torrc configuration file(s) are in place] *******
failed: [roberto] (item=[{'ipv4': '109.70.100.1', 'ipv6': '2a03:e600:100::1'}, {'orport': 443, 'dirport': 0}]) => 
{"ansible_index_var": "loop_idx", "ansible_loop_var": "item", "changed": false, "checksum": 
"65239c6838e167b9e80b6f8064ec167986e0c78e", "exit_status": 1, "item": 
[{"ipv4": "109.70.100.1", "ipv6": "2a03:e600:100::1"}, {"dirport": 0, "orport": 443}], "loop_idx": 0, "msg": "failed to validate", "stderr": "", "stderr_lines": [], "stdout": "
Nov 21 20:16:24.960 [notice] Tor 0.4.8.0-alpha-dev running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1n, Zlib 1.2.11, Liblzma 5.2.5, Libzstd 1.4.8 and Glibc 2.31 as libc.
Nov 21 20:16:24.961 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Nov 21 20:16:24.961 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Nov 21 20:16:24.971 [notice] Read configuration file \"/home/blup/.ansible/tmp/ansible-tmp-1669058091.1417763-1431-208701920587042/source\".
Nov 21 20:16:24.978 [warn] Port \"0\" out of range
Nov 21 20:16:24.991 [warn] Port \"0\" out of range
Nov 21 20:16:24.991 [warn] Couldn't parse address \"109.70.100.19:0\" for DirPort
Nov 21 20:16:24.992 [warn] Failed to parse/validate config: Invalid DirPort configuration
Nov 21 20:16:24.992 [err] Reading config failed--see warnings above.
nusenu commented 2 years ago

Thanks for the report, I'll release a fixed version soon.