Skip to content

Commit

Permalink
removed v2 auth token from staging facts
Browse files Browse the repository at this point in the history
  • Loading branch information
zenmonkeykstop committed Apr 23, 2021
1 parent 390eb44 commit 40c55ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
28 changes: 13 additions & 15 deletions install_files/ansible-base/roles/app-test/files/tor_app.fact
Expand Up @@ -8,36 +8,34 @@ import json
import os

TOR_SVC_PATH = "/var/lib/tor/services/"
JOURNALIST_DIR = "journalist"
SOURCE_DIR = "source"
JOURNALIST_DIR = "journalistv3"
SOURCE_DIR = "sourcev3"


def extract_sd_onion_data(tor_path=TOR_SVC_PATH,
journalist_dir=JOURNALIST_DIR,
source_dir=SOURCE_DIR,
protocol="http"):

for interface in [journalist_dir, source_dir]:
def get_int_addr(base_path):
hostname_file = os.path.join(TOR_SVC_PATH, interface, 'hostname')
try:
with open(hostname_file) as f:
tor_config = f.readline().rstrip().split()

onion_addr = "{p}://{a}".format(p=protocol, a=tor_config[0])
auth_token = tor_config[1]

# This must be a source interface because we dont see hidservauth info
except IndexError:
source_int = onion_addr
# One of the files doesn't exist :| Maybe tor setup hasnt run yet.
return onion_addr
# The file doesn't exist :/ Maybe tor setup hasn't run yet.
except IOError:
return dict()
else:
journalist_int = onion_addr
pass

try:
journalist_int = get_int_addr(JOURNALIST_DIR)
source_int = get_int_addr(SOURCE_DIR)
except Exception:
return dict()

return dict(journalist_location=journalist_int,
source_location=source_int,
hidserv_token=auth_token)
source_location=source_int)


if __name__ == '__main__':
Expand Down
Expand Up @@ -21,7 +21,6 @@
- name: Gather apptest facts to dict to prepare for output
set_fact:
_tbb_selenium_dict:
hidserv_token: "{{ ansible_local.tor_app.hidserv_token }}"
journalist_location: "{{ ansible_local.tor_app.journalist_location }}"
source_location: "{{ ansible_local.tor_app.source_location }}"
timeout: "{{ tbb_timeout }}"
Expand Down

0 comments on commit 40c55ff

Please sign in to comment.