-
Notifications
You must be signed in to change notification settings - Fork 685
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 #7230 from freedomofpress/release/2.10.0
Backport 2.10.0 changes
- Loading branch information
Showing
64 changed files
with
1,087 additions
and
314 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
2.9.0 | ||
2.10.0 |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
Test redis is configured as desired | ||
""" | ||
|
||
import re | ||
|
||
import testutils | ||
|
||
sdvars = testutils.securedrop_test_vars | ||
testinfra_hosts = [sdvars.app_hostname] | ||
|
||
|
||
def test_auth_required(host): | ||
""" | ||
Verify the redis server requires authentication | ||
""" | ||
response = host.run("bash -c 'echo \"PING\" | redis-cli'").stdout.strip() | ||
assert response == "NOAUTH Authentication required." | ||
|
||
|
||
def test_password_works(host): | ||
""" | ||
Verify the redis password works | ||
""" | ||
f = host.file("/var/www/securedrop/rq_config.py") | ||
with host.sudo(): | ||
# First let's check file permissions | ||
assert f.is_file | ||
assert f.user == "root" | ||
assert f.group == "www-data" | ||
assert f.mode == 0o640 | ||
contents = f.content_string | ||
password = re.search('"(.*?)"', contents).group(1) | ||
# Now run an authenticated PING | ||
response = host.run( | ||
f'bash -c \'echo "PING" | REDISCLI_AUTH="{password}" redis-cli\'' | ||
).stdout.strip() | ||
assert response == "PONG" |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import base64 | ||
import subprocess | ||
|
||
from jinja2 import Environment, FileSystemLoader | ||
|
||
|
||
def generate_random(length): | ||
# Emulate the {"stdout": "..."} dictionaries Ansible produces when configuring non-development environments. | ||
return {'stdout': base64.b64encode(os.urandom(length)).decode()} | ||
|
||
|
||
env = Environment(loader=FileSystemLoader(".")) | ||
|
||
ctx = { | ||
"securedrop_app_gpg_fingerprint": "65A1B5FF195B56353CC63DFFCC40EF1228271441", | ||
'source_secret_key': generate_random(32), | ||
'journalist_secret_key': generate_random(32), | ||
'scrypt_id_pepper': generate_random(32), | ||
'scrypt_gpg_pepper': generate_random(32), | ||
'redis_password': generate_random(32), | ||
} | ||
|
||
with open('securedrop/config.py', 'w') as f: | ||
text = env.get_template("securedrop/config.py.example").render(ctx) | ||
text += '\n' | ||
supported_locales = subprocess.check_output(['make', '--quiet', 'supported-locales']).decode().strip() | ||
text += f'SUPPORTED_LOCALES = {supported_locales}\n' | ||
text += 'SUPPORTED_LOCALES.append("en_US")\n' | ||
f.write(text) | ||
|
||
with open('securedrop/rq_config.py', 'w') as f: | ||
f.write('REDIS_PASSWORD = "{}"\n'.format(ctx['redis_password']['stdout'])) |
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
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
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
Oops, something went wrong.