diff --git a/admin/securedrop_admin/__init__.py b/admin/securedrop_admin/__init__.py index 86ee58688d0..5aea8d356fe 100755 --- a/admin/securedrop_admin/__init__.py +++ b/admin/securedrop_admin/__init__.py @@ -547,6 +547,7 @@ def sdconfig(args): SiteConfig(args).load_and_update_config() return 0 + def generate_new_v3_keys(): """This function generate new keys and returns them as tuple. @@ -559,14 +560,15 @@ def generate_new_v3_keys(): format=serialization.PrivateFormat.Raw, encryption_algorithm=serialization.NoEncryption()) public_key = private_key.public_key() - public_bytes = public_key.public_bytes( - encoding=serialization.Encoding.Raw , + public_bytes = public_key.public_bytes( + encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw) public = base64.b32encode(public_bytes)[:-4].decode("utf-8") private = base64.b32encode(private_bytes)[:-4].decode("utf-8") return public, private + def get_v3_keys(filepath): """ Returns the stored v3 public and private keys as Tuple. @@ -578,6 +580,7 @@ def get_v3_keys(filepath): return data + def find_or_generate_new_torv3_keys(args): """ This method will either read the old keys or generate a new @@ -594,8 +597,10 @@ def find_or_generate_new_torv3_keys(args): # For mon ssh service mon_ssh_key, mon_ssh_private_key = generate_new_v3_keys() data = {"public_key": public_key, "private_key": private_key, - "app_ssh_key": app_ssh_key, "app_ssh_private_key": app_ssh_private_key, - "mon_ssh_key": mon_ssh_key, "mon_ssh_private_key": mon_ssh_private_key,} + "app_ssh_key": app_ssh_key, + "app_ssh_private_key": app_ssh_private_key, + "mon_ssh_key": mon_ssh_key, + "mon_ssh_private_key": mon_ssh_private_key} with open(secret_key_path, 'w') as fobj: json.dump(data, fobj) diff --git a/install_files/ansible-base/roles/tor-hidden-services/tasks/configure_tor_hidden_services.yml b/install_files/ansible-base/roles/tor-hidden-services/tasks/configure_tor_hidden_services.yml index 3a216d90384..fefac66f713 100644 --- a/install_files/ansible-base/roles/tor-hidden-services/tasks/configure_tor_hidden_services.yml +++ b/install_files/ansible-base/roles/tor-hidden-services/tasks/configure_tor_hidden_services.yml @@ -77,7 +77,7 @@ - name: Get the keys for app set_fact: tor_v3_app: "{{ tor_v3_public_key.stdout | from_json if (tor_v3_public_key.rc == 0) else localdata.stdout | from_json }}" - when: inventory_hostname == 'app' + when: inventory_hostname == 'app' - name: Get the keys for mon set_fact: @@ -110,7 +110,7 @@ - enable_ssh_over_tor tags: - tor - + - name: Create the client auth file for the mon server for ssh interface template: src: client_auth_mon_ssh.j2 @@ -189,4 +189,3 @@ tags: - tor - admin -