mailer
sur le domaine du SINP, configurer le service de relai SMTP de Google comme indiqué ici : https://support.google.com/a/answer/2956491apt install libsasl2-modules postfix bsd-mailx
site internet
silene.eu
vi /etc/postfix/sasl/sasl_passwd
<mot-de-passe>
par le mot de passe du compte email mailer@<domaine-sinp> d'OVH et <domaine-sinp> par le domaine du SINP, ex. silene.eu): [ssl0.ovh.net]:587 mailer@<domaine-sinp>:<mot-de-passe>
postmap /etc/postfix/sasl/sasl_passwd ll /etc/postfix/sasl/
chown root:root /etc/postfix/sasl/sasl_passwd* chmod 0600 /etc/postfix/sasl/sasl_passwd*
vi /etc/postfix/main.cf
<server-name>
peut valoir web-paca-sinp
par exemple : smtpd_banner = $myhostname ESMTP relayhost = [ssl0.ovh.net]:587 myhostname = <server-name> mydestination = $myhostname, localhost.$mydomain, localhost
smtp_tls_security_level=may smtpd_tls_security_level=may
# Enable SASL authentication smtp_sasl_auth_enable = yes # Disallow methods that allow anonymous authentication smtp_sasl_security_options = noanonymous # Location of sasl_passwd smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd # Enable STARTTLS encryption smtp_tls_security_level = encrypt # Location of CA certificates smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt # Add Header rewrite (solution 1 🗑️) # smtp_header_checks = pcre:/etc/postfix/smtp_header_checks # Add Sender rewrite (solution 2) sender_canonical_classes = envelope_sender, header_sender sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
systemctl status postfix*
Si l'on souhaite contrôler l'adresse email qui envoie les emails du serveur (le FROM:
), deux solutions :
smtp_header_check
et mettre en place un fichier de remplacement à l'aide du paramètre smtp_generic_maps
. Cette solution semble poser problème si l'on souhaite installer OpenDkim.sender_canonical_maps
🗑️ Pour la solution 1 (voir aussi : https://superuser.com/a/695191):
apt install postfix-pcre
vi /etc/postfix/main.cf
# Add Header rewrite smtp_header_checks = pcre:/etc/postfix/smtp_header_checks
vi /etc/postfix/smtp_header_checks
/^From:\s+.*/ REPLACE From: "<nom-sinp>" <mailer@<domaine-sinp>>
/^From:\s+.*/ REPLACE From: "Silene web" <mailer@silene.eu>
systemctl restart postfix
Pour la solution 2, sender_canonical_maps
:
vi /etc/postfix/sender_canonical_maps
/.+/ mailer@<domaine-sinp>
vi /etc/postfix/main.cf
# Add Sender rewrite sender_canonical_classes = envelope_sender, header_sender sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
systemctl restart postfix
echo "THIS IS A TEST EMAIL sended at $(date "+%F %H:%M")" | mail -s "[${HOSTNAME}] Test email" adminsys@<domaine-sinp>
tail -f /var/log/syslog