-
Notifications
You must be signed in to change notification settings - Fork 697
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 #4114 from freedomofpress/4110-pax-flags-for-xenia…
…l-apache [xenial] Manages PaX flags on Apache under Xenial
- Loading branch information
Showing
4 changed files
with
64 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
import re | ||
|
||
|
||
testinfra_hosts = ["app-staging"] | ||
securedrop_test_vars = pytest.securedrop_test_vars | ||
|
||
|
||
def test_paxctld_installed(host): | ||
""" | ||
Ensure the paxctld package is installed. | ||
""" | ||
# Only relevant to Xenial installs | ||
if host.system_info.codename == "xenial": | ||
pkg = host.package("paxctld") | ||
assert pkg.is_installed | ||
|
||
|
||
def test_paxctld_config(host): | ||
""" | ||
Ensure the relevant binaries have appropriate flags set in paxctld config. | ||
""" | ||
f = host.file("/etc/paxctld.conf") | ||
|
||
# Only relevant to Xenial installs | ||
if host.system_info.codename == "xenial": | ||
assert f.is_file | ||
regex = "^/usr/sbin/apache2\s+m$" | ||
assert re.search(regex, f.content, re.M) | ||
|
||
|
||
def test_paxctld_service(host): | ||
""" | ||
Ensure the paxctld service is enabled and running. | ||
""" | ||
# Only relevant to Xenial installs | ||
if host.system_info.codename == "xenial": | ||
s = host.service("paxctld") | ||
assert s.is_running | ||
assert s.is_enabled |