Changeset - 35fff2909917
[Not reviewed]
0 7 0
Branko Majic (branko) - 4 years ago 2020-05-20 09:51:52
branko@majic.rs
MAR-157: Added parameter to mail_server role for specifying maximum incoming mail size.
7 files changed with 46 insertions and 0 deletions:
0 comments (0 inline, 0 general)
docs/releasenotes.rst
Show inline comments
 
@@ -56,6 +56,12 @@ New features/improvements:
 
* Tests have been updated to work with latest Molecule/Testinfra as
 
  part of the Ansible upgrade process.
 

	
 
* ``mail_server`` role
 

	
 
  * The role now supports specifying the maximum mail message size
 
    limit for the SMTP server to accept via
 
    ``mail_message_size_limit`` role parameter.
 

	
 
Deprecations:
 

	
 
* ``backup_server`` and ``backup_client`` role
docs/rolereference.rst
Show inline comments
 
@@ -1113,6 +1113,13 @@ Parameters
 
**mail_ldap_dovecot_password** (string, mandatory)
 
  Password for authenticating the Dovecot LDAP user.
 

	
 
**mail_message_size_limit** (integer, optional, ``10240000``)
 
  Maximum size of message in bytes that the SMTP server should accept
 
  for incoming mails. If the mail message size exceeds the listed
 
  value, it will be rejected by the server. The size is also
 
  advertised as part of SMTP server capabilities (in response to the
 
  ``ehlo`` SMTP command).
 

	
 
**mail_server_tls_protocols** (list, optional, ``[ "TLSv1.2" ]``)
 
  List of TLS protocols the mail server should support. Each value specified
 
  should be compatible with Postfix configuration option
roles/mail_server/defaults/main.yml
Show inline comments
 
@@ -18,3 +18,4 @@ mail_server_tls_protocols:
 
mail_server_tls_ciphers: "DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-GCM-SHA384:\
 
DHE-RSA-AES256-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-GCM-SHA384:\
 
ECDHE-RSA-AES256-SHA384:!aNULL:!MD5:!EXPORT"
 
mail_message_size_limit: 10240000
roles/mail_server/molecule/default/group_vars/parameters-optional.yml
Show inline comments
 
@@ -29,6 +29,7 @@ smtp_rbl:
 
mail_postmaster: "webmaster@parameters-optional"
 
smtp_allow_relay_from:
 
  - "10.31.127.22"
 
mail_message_size_limit: 20480001
 

	
 
# common
 
ca_certificates:
roles/mail_server/molecule/default/tests/test_mandatory.py
Show inline comments
 
@@ -268,3 +268,17 @@ def test_sieve_tls_configuration(host):
 
    # @TODO: Currently not possible to test since openssl s_client does not
 
    # support STARTTLS for Sieve.
 
    pass
 

	
 

	
 
def test_mail_message_size_limit(host):
 
    """
 
    Tests if the mail message size limit advertised by the SMTP server
 
    is correct.
 
    """
 

	
 
    capabilities = host.run("(echo 'ehlo localhost' && sleep 2) | telnet localhost 25")
 
    begin = capabilities.stdout.find("250-SIZE")
 
    end = capabilities.stdout.find("\n", begin)
 
    mail_message_size_limit = capabilities.stdout[begin:end]
 

	
 
    assert mail_message_size_limit == "250-SIZE 10240000"
roles/mail_server/molecule/default/tests/test_optional.py
Show inline comments
 
@@ -301,3 +301,17 @@ def test_sieve_tls_configuration(host):
 
    # @TODO: Currently not possible to test since openssl s_client does not
 
    # support STARTTLS for Sieve.
 
    pass
 

	
 

	
 
def test_mail_message_size_limit(host):
 
    """
 
    Tests if the mail message size limit advertised by the SMTP server
 
    is correct.
 
    """
 

	
 
    capabilities = host.run("(echo 'ehlo localhost' && sleep 2) | telnet localhost 25")
 
    begin = capabilities.stdout.find("250-SIZE")
 
    end = capabilities.stdout.find("\n", begin)
 
    mail_message_size_limit = capabilities.stdout[begin:end]
 

	
 
    assert mail_message_size_limit == "250-SIZE 20480001"
roles/mail_server/templates/main.cf.j2
Show inline comments
 
@@ -77,3 +77,6 @@ notify_classes = resource, software, 2bounce
 
# Fall-back to using native lookups (/etc/hosts etc) if DNS lookup fails. Useful
 
# for local overrides of mail servers.
 
smtp_host_lookup = dns, native
 

	
 
# Explicitly set maximum allowed mail size that should be accepted.
 
message_size_limit = {{ mail_message_size_limit }}
0 comments (0 inline, 0 general)