Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes |
informatique:reseau:exim4 [04/06/2020 17:42] – [Exim4] cyrille | informatique:reseau:exim4 [11/08/2021 16:24] – [DKIM] cyrille |
---|
* [[/informatique/spam|/informatique/spam]] pour de la "bonne" configuration | * [[/informatique/spam|/informatique/spam]] pour de la "bonne" configuration |
| |
| Documentation: |
* [[http://bradthemad.org/tech/notes/exim_cheatsheet.php|Exim Cheatsheet]] | * [[http://bradthemad.org/tech/notes/exim_cheatsheet.php|Exim Cheatsheet]] |
| * [[https://www.exim.org/exim-html-current/doc/html/spec_html/ch-main_configuration.html|main configuraiton]] |
* [[https://manpages.debian.org/stretch/exim4-base/exim.8.en.html|exim4-base manpage]] | * [[https://manpages.debian.org/stretch/exim4-base/exim.8.en.html|exim4-base manpage]] |
===== Tips & Tricks ===== | ===== Tips & Tricks ===== |
| |
===== fallback (wildcard) alias ===== | ==== fallback (wildcard) alias ==== |
| |
In ''/etc/exim4/exim4.conf.template'' replace: | In ''/etc/exim4/exim4.conf.template'' replace: |
| |
<code> | <code> |
/usr/sbin/exim -M email-id => Force delivery of one message | exim4 -M email-id => Force delivery of one message |
/usr/sbin/exim -qf => Force another queue run | exim4 -qf => Force another queue run |
/usr/sbin/exim -qff => Force another queue run and attempt to flush the frozen message | exim4 -qff => Force another queue run and attempt to flush the frozen message |
/usr/sbin/exim -Mvl messageID => View the log for the message | exim4 -Mvl messageID => View the log for the message |
/usr/sbin/exim -Mvb messageID => View the body of the message | exim4 -Mvb messageID => View the body of the message |
/usr/sbin/exim -Mvh messageID => View the header of the message | exim4 -Mvh messageID => View the header of the message |
/usr/sbin/exim -Mrm messageID => Remove message without sending any error message | exim4 -Mrm messageID => Remove message without sending any error message |
/usr/sbin/exim -Mg messageID => Giveup and fail message to bounce the message to the Sender | exim4 -Mg messageID => Giveup and fail message to bounce the message to the Sender |
| |
/usr/sbin/exim -bpr | grep “<” | wc -l =>Number of emails in the que | exim4 -bpr | grep “<” | wc -l =>Number of emails in the que |
/usr/sbin/exim -bpr | grep frozen | wc -l => How many Frozen mails on the queue | exim4 -bpr | grep frozen | wc -l => How many Frozen mails on the queue |
| |
# Deleteing Frozen Messages | # Deleteing Frozen Messages |
$ sudo /usr/sbin/exim -bpr | grep frozen | awk {'print $3'} | xargs sudo /usr/sbin/exim -Mrm | $ sudo exim4 -bpr | grep frozen | awk {'print $3'} | xargs sudo /usr/sbin/exim -Mrm |
</code> | </code> |
| |
| |
View new config: ''$ sudo exim4 -bP | grep smtp_accept_'' | View new config: ''$ sudo exim4 -bP | grep smtp_accept_'' |
| |
| ====== Configuration ====== |
| |
| Smarthost + TLS : |
| * https://wiki.debian.org/Exim |
| * [[https://logd.fr/exim4-connexion-smtp-securisee-via-tls/|Exim4, connexion SMTP sécurisée via TLS]] |
| |
| |
| ===== DKIM ===== |
| |
| Cet exemple pour ''domain.tld'' et ses sous-domaines, avec le selecteur ''default'' |
| |
| Générer les clés: |
| <code bash> |
| $ openssl genrsa -out dkim.key 2048 |
| $ openssl rsa -in dkim.key -out dkim.pub -pubout -outform PEM |
| </code> |
| |
| Publier la clé publique sur le DNS |
| |
| <code> |
| default._domainkey.domain.tld. 60 DKIM "k=rsa;s=email;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzy1WyiyUadvXnEP8skIRZ4g27gqINVOH64i9EvF9xNCAI3kuJyASqMOixwMksjm1FtGC1d+M6+oF80RicwRQ06oUTYN0kmZylXtJgWuWhX8eB0PJQ5Jod6QIkdDfS1xxLydxvK1gJ5QviRJwn2fpXn5+UqthtRGByjvkkqSwz5qX0ypJIYocvPLkt2g/08dkYKH72IXGHlFDqmlz5k7SS3p113H6M3tzdAOLKGfLu7qcTSoist8nlKW+1F6hN7dxVRV7zTo39MAKp9oAr/f/ypIeyCqzr1z9bXIDZ9Eedr6V5RXwfTeVVnAhMuojzPHWoKrNuYKsArciviRfVCN63wIDAQAB;" |
| </code> |
| |
| Configurer exim4 dans ''/etc/exim4/exim4.conf.localmacros'' |
| <code bash> |
| MAIN_TLS_ENABLE=1 |
| REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS=* |
| |
| DKIM_DRIVER=smtp |
| DKIM_DOMAIN=domain.tld |
| #DKIM_DOMAIN=${lc:${domain:$h_from:}} |
| DKIM_SELECTOR=default |
| DKIM_CANON=relaxed |
| DKIM_PRIVATE_KEY=/etc/exim4/dkim.key |
| </code> |
| |
| Générer la config et informer le service: |
| <code bash> |
| $ sudo update-exim4.conf |
| $ sudo systemctl reload exim4.service |
| </code> |
| |
| |