-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4675 from zenmonkeykstop/4629-v3-tailsconfig
Adds support for v3 Onion urls to ./securedrop-admin tailsconfig`
- Loading branch information
Showing
11 changed files
with
193 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
import sys | ||
import subprocess | ||
|
||
from shutil import copyfile | ||
|
||
|
||
# check for root | ||
if os.geteuid() != 0: | ||
|
@@ -26,6 +28,16 @@ | |
path_gui_updater = os.path.join(path_securedrop_root, | ||
'journalist_gui/SecureDropUpdater') | ||
|
||
paths_v3_authfiles = { | ||
"app-journalist": os.path.join(path_securedrop_root, | ||
'install_files/ansible-base/app-journalist.auth_private'), | ||
"app-ssh": os.path.join(path_securedrop_root, | ||
'install_files/ansible-base/app-ssh.auth_private'), | ||
"mon-ssh": os.path.join(path_securedrop_root, | ||
'install_files/ansible-base/mon-ssh.auth_private') | ||
} | ||
path_onion_auth_dir = '/var/lib/tor/onion_auth' | ||
|
||
# load torrc_additions | ||
if os.path.isfile(path_torrc_additions): | ||
with io.open(path_torrc_additions) as f: | ||
|
@@ -52,11 +64,35 @@ | |
with io.open(path_torrc, 'w') as f: | ||
f.write(torrc + torrc_additions) | ||
|
||
# reload tor | ||
# check for v3 aths files | ||
v3_authfiles_present = False | ||
for f in paths_v3_authfiles.values(): | ||
if os.path.isfile(f): | ||
v3_authfiles_present = True | ||
|
||
# if there are v3 authfiles, make dir and copy them into place | ||
debian_tor_uid = pwd.getpwnam("debian-tor").pw_uid | ||
debian_tor_gid = grp.getgrnam("debian-tor").gr_gid | ||
|
||
if not os.path.isdir(path_onion_auth_dir): | ||
os.mkdir(path_onion_auth_dir) | ||
|
||
os.chmod(path_onion_auth_dir, 0o700) | ||
os.chown(path_onion_auth_dir, debian_tor_uid, debian_tor_gid) | ||
|
||
for key, f in paths_v3_authfiles.items(): | ||
if os.path.isfile(f): | ||
filename = os.path.basename(f) | ||
new_f = os.path.join(path_onion_auth_dir, filename) | ||
copyfile(f, new_f) | ||
os.chmod(new_f, 0o400) | ||
os.chown(new_f, debian_tor_uid, debian_tor_gid) | ||
|
||
# restart tor | ||
try: | ||
subprocess.check_call(['systemctl', 'reload', '[email protected]']) | ||
subprocess.check_call(['systemctl', 'restart', '[email protected]']) | ||
except subprocess.CalledProcessError: | ||
sys.exit('Error reloading Tor') | ||
sys.exit('Error restarting Tor') | ||
|
||
# Turn off "automatic-decompression" in Nautilus to ensure the original | ||
# submission filename is restored (see | ||
|
33 changes: 0 additions & 33 deletions
33
install_files/ansible-base/roles/tails-config/tasks/cleanup_legacy_artifacts.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
install_files/ansible-base/roles/tails-config/tasks/migrate_existing_config.yml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.