From e17ae54fda0884f2b74830bb92d7069dc2c10c59 Mon Sep 17 00:00:00 2001 From: Daniel Allaire Date: Thu, 2 Jul 2026 17:31:22 -0400 Subject: [PATCH] =?UTF-8?q?serveur=5Fpostfix=20:=20r=C3=A9solution=20du=20?= =?UTF-8?q?plancher=20/etc/hosts=20(native=20+=20chroot)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trouvés au premier flux réel : - lmtp_host_lookup = native (Postfix faisait du DNS-only, ignorant le plancher /etc/hosts → « Host not found » pour le mail-store) ; - copie de /etc/hosts, resolv.conf, nsswitch.conf, services dans le chroot Postfix (/var/spool/postfix/etc) pour la résolution en chroot. Résultat : Postfix atteint bien le mail-store en LMTP. Reste un nœud de config Dovecot 2.4 (userdb LMTP renvoie NOTFOUND via auth-master) à résoudre pour clore le flux interne. Co-Authored-By: Claude Opus 4.8 --- roles/serveur_postfix/tasks/main.yml | 23 ++++++++++++++++++++++ roles/serveur_postfix/templates/main.cf.j2 | 2 ++ 2 files changed, 25 insertions(+) diff --git a/roles/serveur_postfix/tasks/main.yml b/roles/serveur_postfix/tasks/main.yml index ba3c56d..514e561 100644 --- a/roles/serveur_postfix/tasks/main.yml +++ b/roles/serveur_postfix/tasks/main.yml @@ -36,6 +36,29 @@ state: present update_cache: true +- name: Assurer le répertoire etc du chroot Postfix + ansible.builtin.file: + path: /var/spool/postfix/etc + state: directory + owner: root + group: root + mode: "0755" + +- name: Fournir la résolution de noms au chroot Postfix (plancher /etc/hosts) + ansible.builtin.copy: + src: "{{ item }}" + dest: "/var/spool/postfix{{ item }}" + remote_src: true + owner: root + group: root + mode: "0644" + loop: + - /etc/hosts + - /etc/resolv.conf + - /etc/nsswitch.conf + - /etc/services + notify: Recharger postfix + # --- Pont de certificat step_ca (déposé par client_pki) --- - name: TLS — créer le répertoire des certificats ansible.builtin.file: diff --git a/roles/serveur_postfix/templates/main.cf.j2 b/roles/serveur_postfix/templates/main.cf.j2 index d724bfb..f440a3a 100644 --- a/roles/serveur_postfix/templates/main.cf.j2 +++ b/roles/serveur_postfix/templates/main.cf.j2 @@ -19,6 +19,8 @@ local_recipient_maps = 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) ---