Set-OPS-Public/roles/serveur_postfix/templates/main.cf.j2
Daniel Allaire 20329895f7 Zéro-confiance : flux Courriel chiffré (LMTP verify + client_smtp STARTTLS)
Deux sauts est-ouest en clair, corrigés :
- LMTP edge-mta -> infra-mail:24 : lmtp_tls_security_level=verify +
  lmtp_tls_CAfile=root_ca (le CONTENU des courriels). Dovecot LMTP offrait
  déjà STARTTLS (cert step-ca, SAN infra-mail-01) : aucun changement Dovecot.
- client_smtp -> edge-mta:25 : msmtp tls_starttls on + tls_trust_file root_ca.

Prouvé : livraison LMTP status=sent (verify ⇒ TLS obligatoire), msmtp tls=on
smtpstatus=250. Déjà chiffrés : submission :587, Postfix->LDAP ldaps, IMAP :993.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:47:29 -04:00

49 lines
1.9 KiB
Django/Jinja

# Géré par Set-OPS (rôle serveur_postfix). Ne pas éditer à la main.
compatibility_level = 3.6
myhostname = {{ serveur_postfix_nom_hote }}
mydomain = {{ serveur_postfix_domaine }}
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_banner = $myhostname ESMTP
mynetworks = {{ serveur_postfix_reseaux_confiance }}
# Aucune remise locale : ce MTA ne fait QUE des boîtes virtuelles (via LDAP + LMTP).
mydestination =
local_recipient_maps =
# --- Boîtes virtuelles : validation LDAP + remise LMTP vers le nœud mail-store (Dovecot) ---
virtual_mailbox_domains = {{ serveur_postfix_domaine }}
virtual_mailbox_maps = ldap:/etc/postfix/ldap-mailboxes.cf
virtual_transport = lmtp:inet:[{{ serveur_postfix_mailstore_hote }}]:{{ serveur_postfix_lmtp_port }}
# Résolution via le plancher /etc/hosts (indépendant du DNS) pour la remise interne.
lmtp_host_lookup = native
{% if serveur_postfix_tls_actif %}
# --- TLS (certificat step_ca) ---
smtpd_tls_cert_file = {{ serveur_postfix_tls_dir }}/cert.pem
smtpd_tls_key_file = {{ serveur_postfix_tls_dir }}/key.pem
smtpd_tls_security_level = may
smtpd_tls_protocols = >=TLSv1.2, !SSLv2, !SSLv3
smtp_tls_security_level = may
{% if serveur_postfix_lmtp_tls_verify | default(false) %}
# Zero-confiance : livraison LMTP vers Dovecot chiffree ET verifiee (cert step-ca).
lmtp_tls_security_level = verify
lmtp_tls_CAfile = {{ serveur_postfix_lmtp_tls_cafile }}
{% endif %}
{% endif %}
{% if serveur_postfix_rspamd_milter %}
# --- Milter rspamd (antispam + signature DKIM), co-localisé sur edge-mta ---
smtpd_milters = inet:localhost:{{ serveur_postfix_rspamd_milter_port }}
non_smtpd_milters = $smtpd_milters
milter_protocol = 6
milter_default_action = accept
{% endif %}
# --- Restrictions de base ---
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination