From 2e19758372b01a0f6cc24970670f23879cf08919 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Thu, 5 Mar 2020 07:22:06 -0500 Subject: [PATCH] towards fixing parsing torrc.d twice bug https://forums.whonix.org/t/configuring-onion-service/9042/29 --- .../anon_connection_wizard/repair_torrc.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/usr/lib/python3/dist-packages/anon_connection_wizard/repair_torrc.py b/usr/lib/python3/dist-packages/anon_connection_wizard/repair_torrc.py index d2f291e..79aef44 100644 --- a/usr/lib/python3/dist-packages/anon_connection_wizard/repair_torrc.py +++ b/usr/lib/python3/dist-packages/anon_connection_wizard/repair_torrc.py @@ -6,9 +6,8 @@ import fileinput, os, shutil '''repair_torrc() function will be called when we want to guarantee the existence of: -1. /etc/torrc.d/95_whonix.conf -2. /etc/tor/torrc -3. "%include /etc/torrc.d/95_whonix.conf" line in /etc/tor/torrc file +1. "%include /etc/torrc.d/95_whonix.conf" line in /etc/tor/torrc file +2. "%include /usr/local/etc/torrc.d/" line in /etc/torrc.d/95_whonix.conf file ''' if os.path.exists('/usr/share/anon-gw-base-files/gateway'): @@ -21,14 +20,12 @@ def repair_torrc(): if not os.path.exists('/etc/torrc.d/95_whonix.conf'): with open('/etc/torrc.d/95_whonix.conf', "w+") as f: - f.write("%include /usr/local/etc/torrc.d/40_tor_control_panel.conf") - f.write('\n') - f.write("%include /usr/local/etc/torrc.d/50_user.conf") + f.write("%include /usr/local/etc/torrc.d/") f.write('\n') if not os.path.exists('/etc/tor/torrc'): with open('/etc/tor/torrc', "w+") as f: - f.write("%include /etc/torrc.d/95_whonix.conf") + f.write("%include /etc/torrc.d/") f.write('\n') else: with open('/etc/tor/torrc', "r") as f: @@ -38,12 +35,12 @@ def repair_torrc(): torrcd_line_exists = False for line in lines: str = line.strip() - if (str == '%include /etc/torrc.d/95_whonix.conf'): + if (str == '%include /etc/torrc.d/'): torrcd_line_exists = True if not torrcd_line_exists: with open('/etc/tor/torrc', "a") as f: - f.write("%include /etc/torrc.d/95_whonix.conf\n") + f.write("%include /etc/torrc.d/") f.write('\n')