-
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 #5915 from freedomofpress/remove-v2-services
Removes v2 service configuration and setup support
- Loading branch information
Showing
34 changed files
with
37 additions
and
837 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,76 +47,6 @@ | |
smtp_relay: smtp.gmail.com | ||
smtp_relay_port: 587 | ||
ssh_users: sd | ||
v2_onion_services: false | ||
v3_onion_services: true | ||
''' | ||
|
||
WHEN_BOTH_TRUE = '''app_hostname: app | ||
app_ip: 10.20.2.2 | ||
daily_reboot_time: 5 | ||
dns_server: | ||
- 8.8.8.8 | ||
- 8.8.4.4 | ||
enable_ssh_over_tor: true | ||
journalist_alert_email: '' | ||
journalist_alert_gpg_public_key: '' | ||
journalist_gpg_fpr: '' | ||
monitor_hostname: mon | ||
monitor_ip: 10.20.3.2 | ||
ossec_alert_email: [email protected] | ||
ossec_alert_gpg_public_key: sd_admin_test.pub | ||
ossec_gpg_fpr: 1F544B31C845D698EB31F2FF364F1162D32E7E58 | ||
sasl_domain: gmail.com | ||
sasl_password: testpassword | ||
sasl_username: testuser | ||
securedrop_app_gpg_fingerprint: 1F544B31C845D698EB31F2FF364F1162D32E7E58 | ||
securedrop_app_gpg_public_key: sd_admin_test.pub | ||
securedrop_app_https_certificate_cert_src: '' | ||
securedrop_app_https_certificate_chain_src: '' | ||
securedrop_app_https_certificate_key_src: '' | ||
securedrop_app_https_on_source_interface: false | ||
securedrop_supported_locales: | ||
- de_DE | ||
- es_ES | ||
smtp_relay: smtp.gmail.com | ||
smtp_relay_port: 587 | ||
ssh_users: sd | ||
v2_onion_services: true | ||
v3_onion_services: true | ||
''' | ||
|
||
WHEN_ONLY_V2 = '''app_hostname: app | ||
app_ip: 10.20.2.2 | ||
daily_reboot_time: 5 | ||
dns_server: | ||
- 8.8.8.8 | ||
- 8.8.4.4 | ||
enable_ssh_over_tor: true | ||
journalist_alert_email: '' | ||
journalist_alert_gpg_public_key: '' | ||
journalist_gpg_fpr: '' | ||
monitor_hostname: mon | ||
monitor_ip: 10.20.3.2 | ||
ossec_alert_email: [email protected] | ||
ossec_alert_gpg_public_key: sd_admin_test.pub | ||
ossec_gpg_fpr: 1F544B31C845D698EB31F2FF364F1162D32E7E58 | ||
sasl_domain: gmail.com | ||
sasl_password: testpassword | ||
sasl_username: testuser | ||
securedrop_app_gpg_fingerprint: 1F544B31C845D698EB31F2FF364F1162D32E7E58 | ||
securedrop_app_gpg_public_key: sd_admin_test.pub | ||
securedrop_app_https_certificate_cert_src: '' | ||
securedrop_app_https_certificate_chain_src: '' | ||
securedrop_app_https_certificate_key_src: '' | ||
securedrop_app_https_on_source_interface: false | ||
securedrop_supported_locales: | ||
- de_DE | ||
- es_ES | ||
smtp_relay: smtp.gmail.com | ||
smtp_relay_port: 587 | ||
ssh_users: sd | ||
v2_onion_services: true | ||
v3_onion_services: false | ||
''' | ||
|
||
JOURNALIST_ALERT_OUTPUT = '''app_hostname: app | ||
|
@@ -149,8 +79,6 @@ | |
smtp_relay: smtp.gmail.com | ||
smtp_relay_port: 587 | ||
ssh_users: sd | ||
v2_onion_services: false | ||
v3_onion_services: true | ||
''' | ||
|
||
HTTPS_OUTPUT = '''app_hostname: app | ||
|
@@ -183,8 +111,6 @@ | |
smtp_relay: smtp.gmail.com | ||
smtp_relay_port: 587 | ||
ssh_users: sd | ||
v2_onion_services: false | ||
v3_onion_services: true | ||
''' | ||
|
||
|
||
|
@@ -339,21 +265,6 @@ def verify_locales_prompt(child): | |
child.expect(rb'Space separated list of additional locales to support') # noqa: E501 | ||
|
||
|
||
def verify_v2_onion_for_first_time(child): | ||
child.expect(rb'Do you want to enable v2 onion services\?\:', timeout=2) # noqa: E501 | ||
assert ANSI_ESCAPE.sub('', child.buffer.decode("utf-8")).strip() == 'no' # noqa: E501 | ||
|
||
|
||
def verify_v3_onion_for_first_time(child): | ||
child.expect(rb'Do you want to enable v3 onion services \(recommended\)\?\:', timeout=2) # noqa: E501 | ||
assert ANSI_ESCAPE.sub('', child.buffer.decode("utf-8")).strip() == 'yes' # noqa: E501 | ||
|
||
|
||
def verify_v3_onion_when_v2_is_enabled(child): | ||
child.expect(rb'Do you want to enable v3 onion services \(recommended\)\?\:', timeout=2) # noqa: E501 | ||
assert ANSI_ESCAPE.sub('', child.buffer.decode("utf-8")).strip() == 'yes' # noqa: E501 | ||
|
||
|
||
def verify_install_has_valid_config(): | ||
""" | ||
Checks that securedrop-admin install validates the configuration. | ||
|
@@ -424,9 +335,7 @@ def test_sdconfig_on_first_run(): | |
child.sendline('') | ||
verify_locales_prompt(child) | ||
child.sendline('de_DE es_ES') | ||
verify_v2_onion_for_first_time(child) | ||
child.sendline('\b' * 3 + 'no') | ||
verify_v3_onion_for_first_time(child) | ||
child.sendline('\b' * 4 + 'yes') | ||
|
||
child.expect(pexpect.EOF, timeout=10) # Wait for validation to occur | ||
|
@@ -441,134 +350,6 @@ def test_sdconfig_on_first_run(): | |
verify_install_has_valid_config() | ||
|
||
|
||
def test_sdconfig_both_v2_v3_true(): | ||
cmd = os.path.join(os.path.dirname(CURRENT_DIR), | ||
'securedrop_admin/__init__.py') | ||
child = pexpect.spawn('python {0} --force --root {1} sdconfig'.format(cmd, SD_DIR)) | ||
verify_username_prompt(child) | ||
child.sendline('') | ||
verify_reboot_prompt(child) | ||
child.sendline('\b5') # backspace and put 5 | ||
verify_ipv4_appserver_prompt(child) | ||
child.sendline('') | ||
verify_ipv4_monserver_prompt(child) | ||
child.sendline('') | ||
verify_hostname_app_prompt(child) | ||
child.sendline('') | ||
verify_hostname_mon_prompt(child) | ||
child.sendline('') | ||
verify_dns_prompt(child) | ||
child.sendline('') | ||
verify_app_gpg_key_prompt(child) | ||
child.sendline('\b' * 14 + 'sd_admin_test.pub') | ||
verify_https_prompt(child) | ||
# Default answer is no | ||
child.sendline('') | ||
verify_app_gpg_fingerprint_prompt(child) | ||
child.sendline('1F544B31C845D698EB31F2FF364F1162D32E7E58') | ||
verify_ossec_gpg_key_prompt(child) | ||
child.sendline('\b' * 9 + 'sd_admin_test.pub') | ||
verify_ossec_gpg_fingerprint_prompt(child) | ||
child.sendline('1F544B31C845D698EB31F2FF364F1162D32E7E58') | ||
verify_admin_email_prompt(child) | ||
child.sendline('[email protected]') | ||
verify_journalist_gpg_key_prompt(child) | ||
child.sendline('') | ||
verify_smtp_relay_prompt(child) | ||
child.sendline('') | ||
verify_smtp_port_prompt(child) | ||
child.sendline('') | ||
verify_sasl_domain_prompt(child) | ||
child.sendline('') | ||
verify_sasl_username_prompt(child) | ||
child.sendline('testuser') | ||
verify_sasl_password_prompt(child) | ||
child.sendline('testpassword') | ||
verify_ssh_over_lan_prompt(child) | ||
child.sendline('') | ||
verify_locales_prompt(child) | ||
child.sendline('de_DE es_ES') | ||
verify_v2_onion_for_first_time(child) | ||
child.sendline('\b' * 3 + 'yes') | ||
verify_v3_onion_when_v2_is_enabled(child) | ||
child.sendline('\b' * 3 + 'yes') | ||
|
||
child.expect(pexpect.EOF, timeout=10) # Wait for validation to occur | ||
child.close() | ||
assert child.exitstatus == 0 | ||
assert child.signalstatus is None | ||
|
||
with open(os.path.join(SD_DIR, 'install_files/ansible-base/group_vars/all/site-specific')) as fobj: # noqa: E501 | ||
data = fobj.read() | ||
assert data == WHEN_BOTH_TRUE | ||
|
||
verify_install_has_valid_config() | ||
|
||
|
||
def test_sdconfig_only_v2_true(): | ||
cmd = os.path.join(os.path.dirname(CURRENT_DIR), | ||
'securedrop_admin/__init__.py') | ||
child = pexpect.spawn('python {0} --force --root {1} sdconfig'.format(cmd, SD_DIR)) | ||
verify_username_prompt(child) | ||
child.sendline('') | ||
verify_reboot_prompt(child) | ||
child.sendline('\b5') # backspace and put 5 | ||
verify_ipv4_appserver_prompt(child) | ||
child.sendline('') | ||
verify_ipv4_monserver_prompt(child) | ||
child.sendline('') | ||
verify_hostname_app_prompt(child) | ||
child.sendline('') | ||
verify_hostname_mon_prompt(child) | ||
child.sendline('') | ||
verify_dns_prompt(child) | ||
child.sendline('') | ||
verify_app_gpg_key_prompt(child) | ||
child.sendline('\b' * 14 + 'sd_admin_test.pub') | ||
verify_https_prompt(child) | ||
# Default answer is no | ||
child.sendline('') | ||
verify_app_gpg_fingerprint_prompt(child) | ||
child.sendline('1F544B31C845D698EB31F2FF364F1162D32E7E58') | ||
verify_ossec_gpg_key_prompt(child) | ||
child.sendline('\b' * 9 + 'sd_admin_test.pub') | ||
verify_ossec_gpg_fingerprint_prompt(child) | ||
child.sendline('1F544B31C845D698EB31F2FF364F1162D32E7E58') | ||
verify_admin_email_prompt(child) | ||
child.sendline('[email protected]') | ||
verify_journalist_gpg_key_prompt(child) | ||
child.sendline('') | ||
verify_smtp_relay_prompt(child) | ||
child.sendline('') | ||
verify_smtp_port_prompt(child) | ||
child.sendline('') | ||
verify_sasl_domain_prompt(child) | ||
child.sendline('') | ||
verify_sasl_username_prompt(child) | ||
child.sendline('testuser') | ||
verify_sasl_password_prompt(child) | ||
child.sendline('testpassword') | ||
verify_ssh_over_lan_prompt(child) | ||
child.sendline('') | ||
verify_locales_prompt(child) | ||
child.sendline('de_DE es_ES') | ||
verify_v2_onion_for_first_time(child) | ||
child.sendline('\b' * 3 + 'yes') | ||
verify_v3_onion_when_v2_is_enabled(child) | ||
child.sendline('\b' * 3 + 'no') | ||
|
||
child.expect(pexpect.EOF, timeout=10) # Wait for validation to occur | ||
child.close() | ||
assert child.exitstatus == 0 | ||
assert child.signalstatus is None | ||
|
||
with open(os.path.join(SD_DIR, 'install_files/ansible-base/group_vars/all/site-specific')) as fobj: # noqa: E501 | ||
data = fobj.read() | ||
assert data == WHEN_ONLY_V2 | ||
|
||
verify_install_has_valid_config() | ||
|
||
|
||
def test_sdconfig_enable_journalist_alerts(): | ||
cmd = os.path.join(os.path.dirname(CURRENT_DIR), | ||
'securedrop_admin/__init__.py') | ||
|
@@ -621,10 +402,6 @@ def test_sdconfig_enable_journalist_alerts(): | |
child.sendline('') | ||
verify_locales_prompt(child) | ||
child.sendline('de_DE es_ES') | ||
verify_v2_onion_for_first_time(child) | ||
child.sendline('\b' * 3 + 'no') | ||
verify_v3_onion_for_first_time(child) | ||
child.sendline('\b' * 4 + 'yes') | ||
|
||
child.expect(pexpect.EOF, timeout=10) # Wait for validation to occur | ||
child.close() | ||
|
@@ -697,10 +474,6 @@ def test_sdconfig_enable_https_on_source_interface(): | |
child.sendline('') | ||
verify_locales_prompt(child) | ||
child.sendline('de_DE es_ES') | ||
verify_v2_onion_for_first_time(child) | ||
child.sendline('\b' * 3 + 'no') | ||
verify_v3_onion_for_first_time(child) | ||
child.sendline('\b' * 4 + 'yes') | ||
|
||
child.expect(pexpect.EOF, timeout=10) # Wait for validation to occur | ||
child.close() | ||
|
Oops, something went wrong.