2015-05-28 11:32:57 +02:00
|
|
|
smtpd_banner = $myhostname ESMTP $mail_name
|
|
|
|
biff = {{ postfix_biff }}
|
|
|
|
|
|
|
|
# appending .domain is the MUA's job.
|
|
|
|
append_dot_mydomain = {{ postfix_append_dot_mydomain }}
|
|
|
|
|
|
|
|
# Uncomment the next line to generate "delayed mail" warnings
|
|
|
|
#delay_warning_time = 4h
|
|
|
|
|
|
|
|
readme_directory = no
|
|
|
|
|
|
|
|
# TLS parameters
|
|
|
|
# Server
|
2018-05-07 15:55:38 +02:00
|
|
|
{% if letsencrypt_acme_install is defined %}
|
2018-05-04 16:03:21 +02:00
|
|
|
{% if postfix_use_letsencrypt %}
|
|
|
|
smtpd_tls_cert_file={{ letsencrypt_acme_certs_dir }}/cert
|
|
|
|
smtpd_tls_key_file={{ letsencrypt_acme_certs_dir }}/privkey
|
|
|
|
{% else %}
|
2015-05-28 11:32:57 +02:00
|
|
|
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
|
|
|
|
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
2018-05-07 15:55:38 +02:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if letsencrypt_acme_install is not defined %}
|
2018-05-04 16:03:21 +02:00
|
|
|
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
|
|
|
|
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
|
|
|
{% if postfix_relay_server %}
|
|
|
|
smtpd_tls_security_level = encrypt
|
|
|
|
smtpd_tls_auth_only = yes
|
|
|
|
{% endif %}
|
2015-09-03 02:36:22 +02:00
|
|
|
smtpd_tls_security_level={{ postfix_smtpd_tls_security_level }}
|
2015-05-28 11:32:57 +02:00
|
|
|
# Client
|
2015-09-03 02:36:22 +02:00
|
|
|
smtp_tls_security_level = {{ postfix_smtp_tls_security_level }}
|
2015-05-28 11:32:57 +02:00
|
|
|
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
|
|
|
|
|
|
|
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
|
|
|
|
# information on enabling SSL in the smtp client.
|
|
|
|
|
|
|
|
myhostname = {{ ansible_fqdn }}
|
|
|
|
alias_maps = hash:/etc/aliases
|
|
|
|
alias_database = hash:/etc/aliases
|
2019-03-21 19:37:35 +01:00
|
|
|
{% if domain_name is defined %}
|
|
|
|
myorigin = {{ domain_name }}
|
|
|
|
{% else %}
|
|
|
|
myorigin = {{ ansible_fqdn }}
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
mydestination = {{ ansible_fqdn }}, localhost
|
|
|
|
{% if postfix_use_relay_host %}
|
|
|
|
relayhost = {{ postfix_relay_host }}:{{ postfix_relay_port }}
|
|
|
|
{% endif %}
|
|
|
|
{% if not postfix_relay_server %}
|
|
|
|
mynetworks = 127.0.0.1
|
2019-03-21 19:37:35 +01:00
|
|
|
inet_interfaces = localhost
|
2015-05-28 11:32:57 +02:00
|
|
|
inet_protocols = ipv4
|
|
|
|
{% endif %}
|
|
|
|
mailbox_size_limit = 0
|
2020-01-24 13:58:05 +01:00
|
|
|
message_size_limit = {{ postfix_message_size_limit }}
|
2015-05-28 11:32:57 +02:00
|
|
|
recipient_delimiter = +
|
2015-07-06 17:46:26 +02:00
|
|
|
default_destination_concurrency_limit = {{ postfix_default_destination_concurrency_limit }}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if postfix_use_sasl_auth %}
|
|
|
|
smtp_sasl_auth_enable= {{ postfix_smtp_sasl_auth_enable }}
|
|
|
|
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
2019-03-21 19:37:35 +01:00
|
|
|
smtp_sasl_security_options = {{ postfix_smtp_sasl_security_options }}
|
|
|
|
smtp_sasl_tls_security_options = {{ postfix_smtp_sasl_tls_security_options }}
|
|
|
|
smtp_sasl_mechanism_filter = {{ postfix_smtp_sasl_mechanism_filter }}
|
2019-12-19 11:15:41 +01:00
|
|
|
{% if ansible_distribution_file_variety == "Debian" %}
|
|
|
|
{% if ansible_distribution_version is version_compare('18.04', '>=') %}
|
2019-05-08 18:35:58 +02:00
|
|
|
smtpd_relay_restrictions = permit_mynetworks, defer_unauth_destination
|
2019-05-08 17:31:06 +02:00
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endif %}
|
2019-12-19 11:15:41 +01:00
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if postfix_relay_server %}
|
|
|
|
smtpd_sasl_path = smtpd
|
|
|
|
smtpd_sasl_auth_enable = yes
|
2019-03-21 19:37:35 +01:00
|
|
|
smtpd_sasl_security_options = {{ postfix_smtp_sasl_security_options }}
|
|
|
|
smtpd_sasl_tls_security_options = {{ postfix_smtp_sasl_tls_security_options }}
|
2015-05-28 11:32:57 +02:00
|
|
|
smtpd_helo_required = yes
|
|
|
|
mynetworks = {{ postfix_mynetworks }}
|
|
|
|
inet_interfaces = {{ postfix_interfaces }}
|
|
|
|
|
|
|
|
# Don't talk to mail systems that don't know their own hostname.
|
|
|
|
smtpd_helo_restrictions = reject_unknown_helo_hostname
|
|
|
|
# Block clients that speak too early.
|
|
|
|
smtpd_data_restrictions = reject_unauth_pipelining
|
|
|
|
|
|
|
|
# Our internal servers talk to the submission port so they are treated as clients
|
|
|
|
smtpd_client_restrictions = permit_sasl_authenticated, reject
|
|
|
|
|
|
|
|
# Don't accept mail from domains that don't exist.
|
|
|
|
smtpd_sender_restrictions = reject_unknown_sender_domain
|
|
|
|
|
|
|
|
# Relay control: local clients and
|
|
|
|
# authenticated clients may specify any destination domain.
|
|
|
|
smtpd_relay_restrictions = permit_sasl_authenticated, reject
|
|
|
|
{% endif %}
|
2019-12-19 11:15:41 +01:00
|
|
|
{% if ansible_distribution_file_variety == "Debian" %}
|
|
|
|
{% if ansible_distribution_version is version_compare('18.04', '>=') %}
|
|
|
|
compatibility_level=2
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|