Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add securedrop keyring package and update Release Key in sys-firewall #563

Merged
merged 4 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dom0/fpf-apt-test-repo.sls
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@ configure-apt-test-apt-repo:
- clean_file: True # squash file to ensure there are no duplicates
- require:
- pkg: install-python-apt-for-repo-config

# This will install the production keyring package. This package will delete
# the prod key from the default keyring in /etc/apt/trusted.gpg but will
# preserve the apt-test key in this default keyring.
install-securedrop-keyring-package:
pkg.installed:
- pkgs:
- securedrop-keyring
- require:
- pkgrepo: configure-apt-test-apt-repo
4 changes: 2 additions & 2 deletions dom0/sd-clean-whonix.sls
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
##

remove-securedrop-log-package-from-whonix:
pkg.removed:
pkg.purged:
- pkgs:
- securedrop-log
- securedrop-keyring

sd-cleanup-whonix-gw-15:
cmd.run:
Expand All @@ -17,4 +18,3 @@ sd-cleanup-whonix-gw-15:
- sudo rm -f /etc/apt/sources.list.d/securedrop_workstation.list
- sudo systemctl restart rsyslog
- sudo apt-key del 4ED79CC3362D7D12837046024A3BE4A92211B03C
- sudo apt-key del 22245C81E3BAEB4138B36061310F561200F4AD77
58 changes: 29 additions & 29 deletions sd-workstation/securedrop-release-signing-pubkey.asc
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@ ZZKLSApWXbB32ug5WNoGaQmq+hye1i40zu3fx8MRYefkpSSatNuIbrwLLnq0NR+k
qXcP1SPgtoy/EnW0oa/NDiT/rSh1PuAjG7oOpiNdQdmnA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wwqwbRRaIVNcdytDIi
LvXxOZf/TjX3xHbwTHYghclZZX3ZCiZ8OTD+yLkCqTJsT9GVfIlO/algc+7ezz7B
acsSuTa77/+8vy78dA5k9JM6rSZzfl/8T3LOmDLq+RE+DCUXx8ZJ+qnrr5aSruPB
BSlu7S/26NIAtB6LyKtSBpX39y66/9lYCaQWZDcNraq5PWInv0kQqXEc6C8Vi25q
BFE3a4Lt45bZMGCREYvLWXRxzH9rESVVekxZVZEjgmldh94OLRuXRvU8nlu2fq4G
YH0a+Oy/87LemKv7q2IZX6s7uTZg5xMBTaPqFsE/AGQWQfHvj1EWthcaeoIasfxE
lsWi9qHE4N+Jg/L+XC90S0kogDWGdyS+mKf0dE6jq4ioKf29zRJ4629id6VYHeib
i3df/KOdUeeth5X9ann6/KNncX7Us16rV4a6Tl1OLoV7xkwh2Hy8MfClDkTYeoHc
Y6V2vWAk0Rc=
=LOAb
-----END PGP PUBLIC KEY BLOCK-----
44 changes: 44 additions & 0 deletions tests/test_vms_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,40 @@ def _ensure_jessie_backports_disabled(self, vm):
# We expect zero hits, so confirm output is empty string.
self.assertEqual(results, "")

def _ensure_keyring_package_exists_and_has_correct_key(self, vm):
"""
Inspect the securedrop-keyring used by apt to ensure the correct key
and only the correct key is installed in that location.
"""
keyring_path = "/etc/apt/trusted.gpg.d/securedrop-keyring.gpg"
# apt-key finger doesnt work here due to stdout/terminal
# We also set the homedir to bypass whonix-specific gnupg.conf
cmd = "gpg --homedir /tmp --no-default-keyring --keyring {} -k".format(keyring_path)
stdout, stderr = vm.run(cmd)
results = stdout.rstrip().decode("utf-8")
fpf_gpg_pub_key_info = ["{}".format(keyring_path)]
fpf_gpg_pub_key_info += [
"---------------------------------------------",
"pub rsa4096 2016-10-20 [SC] [expires: 2021-06-30]",
" 22245C81E3BAEB4138B36061310F561200F4AD77",
"uid [ unknown] SecureDrop Release Signing Key",
"uid [ unknown] SecureDrop Release Signing Key <[email protected]>" # noqa: E501
]
self.assertEqual(fpf_gpg_pub_key_info, results.split('\n'))

def _ensure_trusted_keyring_securedrop_key_removed(self, vm):
"""
Ensures the production key is no longer found in the default apt keyring
In testeing dev/staging, that keyring will be used for the test apt key,
the goal is to reduce of the production key
"""
# apt-key finger doesnt work here due to stdout/terminal
cmd = "gpg --no-default-keyring --keyring /etc/apt/trusted.gpg -k"
stdout, stderr = vm.run(cmd)
results = stdout.rstrip().decode("utf-8")
fpf_gpg_pub_key_fp = "22245C81E3BAEB4138B36061310F561200F4AD77"
self.assertFalse(fpf_gpg_pub_key_fp in results)

def test_all_jessie_backports_disabled(self):
"""
Asserts that all VMs lack references to Jessie in apt config.
Expand Down Expand Up @@ -209,6 +243,16 @@ def test_all_sd_vm_apt_sources(self):
vm = self.app.domains[vm_name]
self._validate_apt_sources(vm)

def test_debian_keyring_config(self):
"""
Ensure the securedrop keyring package is properly installed and the
key it contains is up-to-date.
"""
for vm_name in WANTED_VMS:
vm = self.app.domains[vm_name]
self._ensure_keyring_package_exists_and_has_correct_key(vm)
self._ensure_trusted_keyring_securedrop_key_removed(vm)


def load_tests(loader, tests, pattern):
suite = unittest.TestLoader().loadTestsFromTestCase(SD_VM_Platform_Tests)
Expand Down