Skip to content

Commit

Permalink
testinfra: remove some postfix tests duplicating Ansible
Browse files Browse the repository at this point in the history
The original is at install_files/ansible-base/roles/postfix/templates/main.cf
  • Loading branch information
Loic Dachary committed Jan 28, 2018
1 parent c6fb4e2 commit 2eb3e36
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions testinfra/mon/test_postfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,6 @@ def test_postfix_headers(File, header):
assert re.search(regex, f.content, re.M)


@pytest.mark.parametrize('setting', [
'relayhost = [smtp.gmail.com]:587',
'smtp_sasl_auth_enable = yes',
'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd',
'smtp_sasl_security_options = noanonymous',
'smtp_use_tls = yes',
'smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache',
'smtp_tls_security_level = secure',
'smtp_tls_CApath = /etc/ssl/certs',
'smtp_tls_ciphers = high',
'smtp_tls_protocols = TLSv1.2 TLSv1.1 TLSv1 !SSLv3 !SSLv2',
'myhostname = ossec.server',
'myorigin = $myhostname',
'smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)',
'biff = no',
'append_dot_mydomain = no',
'readme_directory = no',
'smtp_header_checks = regexp:/etc/postfix/header_checks',
'mailbox_command = /usr/bin/procmail',
'inet_interfaces = loopback-only',
'alias_maps = hash:/etc/aliases',
'alias_database = hash:/etc/aliases',
'mydestination = $myhostname, localhost.localdomain , localhost',
'mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128',
'mailbox_size_limit = 0',
'recipient_delimiter = +',
])
def test_postfix_settings(File, setting):
"""
Check all postfix configuration lines. There are technically multiple
configuration paths regarding the TLS settings, particularly the
fingerprint verification logic, but only the base default config is tested
currently.
"""
f = File("/etc/postfix/main.cf")
assert f.is_file
assert f.user == 'root'
assert oct(f.mode) == "0644"
regex = '^{}$'.format(re.escape(setting))
assert re.search(regex, f.content, re.M)


def test_postfix_generic_maps(File):
"""
Regression test to check that generic Postfix maps are not configured
Expand Down

0 comments on commit 2eb3e36

Please sign in to comment.