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

Fixes #205 installs libreoffice in svs disp #263

Merged
merged 5 commits into from
Jun 7, 2019
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
3 changes: 3 additions & 0 deletions dom0/sd-export.sls
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ sd-export-usb-dvm:
- tags:
- add:
- sd-workstation
- features:
- enable:
- service.paxctld
- require:
- qvm: sd-export-template

Expand Down
8 changes: 8 additions & 0 deletions dom0/sd-svs-disp-files.sls
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ sd-svs-disp-install-mimetype-handler-package:
- securedrop-workstation-svs-disp
- require:
- sls: fpf-apt-test-repo

sd-svs-disp-install-libreoffice:
pkg.installed:
- name: libreoffice
- retry:
attempts: 3
interval: 60
- install_recommends: False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the install_recommends: False sidesteps the PaX flags problem, do we still need the retry logic? Doesn't hurt to keep it in, but it seems like we resolve the problem without resorting to retries.

3 changes: 3 additions & 0 deletions dom0/sd-svs-disp.sls
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ sd-svs-disp:
- add:
- sd-workstation
- sd-svs-disp-vm
- features:
- enable:
- service.paxctld
- require:
- qvm: sd-svs-disp-template
3 changes: 3 additions & 0 deletions dom0/sd-svs.sls
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ sd-svs:
- tags:
- add:
- sd-workstation
- features:
- enable:
- service.paxctld
- require:
- qvm: sd-svs-template

Expand Down
10 changes: 10 additions & 0 deletions dom0/sd-workstation-template-files.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ sd-workstation-template-install-kernel-config-packages:
- securedrop-workstation-grsec
- require:
- sls: fpf-apt-test-repo

# Ensure that paxctld starts immediately. For AppVMs,
# use qvm.features.enabled = ["paxctld"] to ensure service start.
sd-workstation-template-enable-paxctld:
service.running:
- name: paxctld
- enable: True
- reload: True
- require:
- pkg: sd-workstation-template-install-kernel-config-packages
3 changes: 3 additions & 0 deletions dom0/sd-workstation-template.sls
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ sd-workstation-template:
- tags:
- add:
- sd-workstation
- features:
- enable:
- service.paxctld
- require:
- pkg: dom0-install-securedrop-workstation-template
10 changes: 0 additions & 10 deletions tests/test_svs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ def test_sd_client_package_installed(self):
self.assertTrue(self._package_is_installed("securedrop-client"))


class SD_SVS_Disp_Tests(SD_VM_Local_Test):
def setUp(self):
self.vm_name = "sd-svs-disp"
super(SD_SVS_Disp_Tests, self).setUp()

def test_sd_client_package_installed(self):
pkg = "securedrop-workstation-svs-disp"
self.assertTrue(self._package_is_installed(pkg))


def load_tests(loader, tests, pattern):
suite = unittest.TestLoader().loadTestsFromTestCase(SD_SVS_Tests)
return suite
21 changes: 21 additions & 0 deletions tests/test_svs_disp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import unittest

from base import SD_VM_Local_Test


class SD_SVS_Disp_Tests(SD_VM_Local_Test):
def setUp(self):
self.vm_name = "sd-svs-disp"
super(SD_SVS_Disp_Tests, self).setUp()

def test_sd_svs_disp_config_package_installed(self):
pkg = "securedrop-workstation-svs-disp"
self.assertTrue(self._package_is_installed(pkg))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch on re-enabling these tests! Some of the test names still refer to sd-svs (specifically test_sd_client_package_installed), will clean up for clarity.


def test_sd_svs_disp_libreoffice_installed(self):
self.assertTrue(self._package_is_installed("libreoffice"))


def load_tests(loader, tests, pattern):
suite = unittest.TestLoader().loadTestsFromTestCase(SD_SVS_Disp_Tests)
return suite
13 changes: 13 additions & 0 deletions tests/test_vms_exist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ def _check_kernel(self, vm):
assert kernel_version.endswith("-grsec")
assert kernel_version == EXPECTED_KERNEL_VERSION

def _check_service_running(self, vm, service):
"""
Ensures a given service is running inside a given VM.
Uses systemctl is-active to query the service state.
"""
cmd = "systemctl is-active {}".format(service)
stdout, stderr = vm.run(cmd)
service_status = stdout.decode("utf-8").rstrip()
assert service_status == "active"

def test_sd_whonix_config(self):
vm = self.app.domains["sd-whonix"]
nvm = vm.netvm
Expand Down Expand Up @@ -65,6 +75,7 @@ def test_sd_svs_config(self):
self.assertFalse(vm.provides_network)
self.assertFalse(vm.template_for_dispvms)
self._check_kernel(vm)
self._check_service_running(vm, "paxctld")
self.assertTrue('sd-workstation' in vm.tags)

def test_sd_svs_disp_config(self):
Expand All @@ -75,6 +86,7 @@ def test_sd_svs_disp_config(self):
self.assertFalse(vm.provides_network)
self.assertTrue(vm.template_for_dispvms)
self._check_kernel(vm)
self._check_service_running(vm, "paxctld")
self.assertTrue('sd-workstation' in vm.tags)

def test_sd_gpg_config(self):
Expand All @@ -97,6 +109,7 @@ def test_sd_workstation_template(self):
self.assertTrue(vm.kernel == "")
self.assertTrue('sd-workstation' in vm.tags)
self._check_kernel(vm)
self._check_service_running(vm, "paxctld")

def test_sd_proxy_template(self):
vm = self.app.domains["sd-proxy-template"]
Expand Down