From 8890cfe7ad798ec4f88dee294b1faf30cba238ee Mon Sep 17 00:00:00 2001 From: mtrossevin Date: Tue, 1 Feb 2022 15:12:38 +0100 Subject: [PATCH] Il y a eu un changement de format pour la configuration de opensmtpd, corrige la doc --- HowtoOpenSMTPD.md | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/HowtoOpenSMTPD.md b/HowtoOpenSMTPD.md index 007fb5bb..51286a5d 100644 --- a/HowtoOpenSMTPD.md +++ b/HowtoOpenSMTPD.md @@ -50,11 +50,14 @@ table aliases file:/etc/mail/aliases # listen on lo0 +action "mbox" mbox alias +action "relay" relay + # Uncomment the following to accept external mail for domain "example.org" # -# accept from any for domain "example.org" alias deliver to mbox -accept for local alias deliver to mbox -accept from local for any relay +# match from any for domain "example.org" action "mbox" +match for local action "mbox" +match from local for any action "relay" ~~~ Cette configuration permet de relayer juste les mails qui viennent de @@ -73,6 +76,25 @@ listen on localhost # If you edit the file, you have to run "smtpctl update table aliases" table aliases file:/etc/aliases +action "mbox" mbox alias +action "relay" relay + +# Uncomment the following to accept external mail for domain "example.org" +#match from any for domain "example.org" action "mbox" + +match for local action "mbox" +match for any action "relay" +~~~ + +ou pour Debian <11: + +~~~ +# To accept external mail, replace with: listen on all +listen on localhost + +# If you edit the file, you have to run "smtpctl update table aliases" +table aliases file:/etc/aliases + # Uncomment the following to accept external mail for domain "example.org" #accept from any for domain "example.org" alias deliver to mbox @@ -91,17 +113,19 @@ On a ce cas quand on veut que les mails de root soient avec un autre nom de domaine que le hostname. ~~~ -accept from local for any relay as "root@example.com" +action "relayAs" relay mail-from "root@example.com" +match from local for any action "relayAs" ~~~ Attention, dans ce cas cela ré-écrit même les messages envoyés avec un autre utilisateur. ### Utiliser un relai SMTP -On peut utiliser un relai en modifiant la règle `accept for any relay` et en ajoutant le mot clé `via` : +On peut utiliser un relai en ajoutant le mot clé `host` dans la définition de l'action : ~~~ -accept from local for any relay via 192.0.2.25 +action "relayVia" relay host "192.0.2.25" +match from local for any action "relayVia" ~~~ On peut notamment utiliser cela pour contourner un blocage du port 25 @@ -109,7 +133,8 @@ et renvoyer sur un port différent (il faut évidemment que sur le relai SMTP réponde sur ce port). Par exemple sur le port 2525 : ~~~ -accept from local for any relay via 192.0.2.25:2525 +action "relayVia" relay host "192.0.2.25:2525" +match from local for any action "relayVia" ~~~