|
@@ -10,44 +10,6 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-optional')
|
|
|
|
|
|
|
|
|
def test_smtp_tls_files(host):
|
|
|
"""
|
|
|
Tests if SMTP TLS private key has been deployed correctly.
|
|
|
"""
|
|
|
|
|
|
hostname = host.run('hostname').stdout.strip()
|
|
|
|
|
|
with host.sudo():
|
|
|
|
|
|
tls_file = host.file('/etc/ssl/private/%s_smtp.key' % hostname)
|
|
|
assert tls_file.is_file
|
|
|
assert tls_file.user == 'root'
|
|
|
assert tls_file.group == 'root'
|
|
|
assert tls_file.mode == 0o640
|
|
|
assert tls_file.content_string == open("tests/data/x509/parameters-optional_smtp.key.pem", "r").read().rstrip()
|
|
|
|
|
|
tls_file = host.file('/etc/ssl/certs/%s_smtp.pem' % hostname)
|
|
|
assert tls_file.is_file
|
|
|
assert tls_file.user == 'root'
|
|
|
assert tls_file.group == 'root'
|
|
|
assert tls_file.mode == 0o644
|
|
|
assert tls_file.content_string == open("tests/data/x509/parameters-optional_smtp.cert.pem", "r").read().rstrip()
|
|
|
|
|
|
tls_file = host.file('/etc/ssl/private/%s_imap.key' % hostname)
|
|
|
assert tls_file.is_file
|
|
|
assert tls_file.user == 'root'
|
|
|
assert tls_file.group == 'root'
|
|
|
assert tls_file.mode == 0o640
|
|
|
assert tls_file.content_string == open("tests/data/x509/parameters-optional_imap.key.pem", "r").read().rstrip()
|
|
|
|
|
|
tls_file = host.file('/etc/ssl/certs/%s_imap.pem' % hostname)
|
|
|
assert tls_file.is_file
|
|
|
assert tls_file.user == 'root'
|
|
|
assert tls_file.group == 'root'
|
|
|
assert tls_file.mode == 0o644
|
|
|
assert tls_file.content_string == open("tests/data/x509/parameters-optional_imap.cert.pem", "r").read().rstrip()
|
|
|
|
|
|
|
|
|
def test_certificate_validity_check_configuration(host):
|
|
|
"""
|
|
|
Tests if certificate validity check configuration file has been deployed
|