Skip to content

Commit

Permalink
Add tests for ecryptfs PAM module removal
Browse files Browse the repository at this point in the history
  • Loading branch information
emkll committed Jan 11, 2019
1 parent aa3f63c commit 3cb6d5c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions molecule/testinfra/staging/common/test_system_hardening.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_twofactor_disabled_on_tty(host):
pam_auth_file = host.file("/etc/pam.d/common-auth").content_string

assert "auth required pam_google_authenticator.so" not in pam_auth_file
assert "pam_ecryptfs.so unwrap" not in pam_auth_file


@pytest.mark.parametrize('sshd_opts', [
Expand All @@ -106,3 +107,18 @@ def test_sshd_config(host, sshd_opts):

line = "{} {}".format(sshd_opts[0], sshd_opts[1])
assert line in sshd_config_file


@pytest.mark.parametrize('filenames', [
'/var/log/auth.log',
'/var/log/syslog',
])
def test_pam_(host, filenames, Command, Sudo):
"""
Ensure pam_ecryptfs is removed from /etc/pam.d/common-auth : not only is
no longer needed, it causes error messages (see issue #3963)
"""
error_message = "pam_ecryptfs.so: cannot open shared object file"
with Sudo():
log_file = host.file(filenames).content_string
assert error_message not in log_file

0 comments on commit 3cb6d5c

Please sign in to comment.