====== Postfix ======
MTA, Service SMTP
voir aussi
* [[/informatique/reseau/exim4|Exim4]]
* [[/informatique/spam|/informatique/spam]] pour de la "bonne" configuration
* [[http://www.postfix.org/documentation.html|Documentation officielle]]
* [[http://www.postfix.org/SMTPD_ACCESS_README.html|Postfix SMTP relay and access control ]]
* [[http://www.postfix.org/SMTPD_PROXY_README.html|Postfix Before-Queue Content Filter]]
* [[http://www.postfix.org/FILTER_README.html|Postfix After-Queue Content Filter]]
* [[http://www.postfix.org/ADDRESS_REWRITING_README.html|Postfix Address Rewriting]]
* [[http://www.postfix.org/docs.html|Postfix Howtos and FAQs]]
* [[http://x.guimard.free.fr/postfix/|Doc en français]]
* [[http://www.postfix.org/DEBUG_README.html|Postfix Debugging Howto]]
* http://www.posluns.com/guides/
* https://calomel.org/postfix.html
* [[http://www.jopa.fr/index.php/2009/02/03/installation-dun-serveur-mail-brique-par-brique-openldap-postfix-cyrus-imap-tls-sasl-spamassassin-amavis-etc/|Installation d’un serveur mail brique par brique… (OpenLDAP, Postfix, Cyrus-imap, TLS, SASL, Spamassassin, Amavis, etc…)]]
* [[http://www.jopa.fr/index.php/2009/07/28/alias-forward-postfix-openldap/|« Alias » et « forward » avec Postfix + LDAP]]
===== Tips =====
==== Gérer la pile de mails ====
Voir le contenu de la pile (queue):
# mailq
ou
# postqueue -p
Forcer l'envoi (tentative) des mails:
# postfix flush
> (Force delivery: attempt to deliver every message in the deferred mail queue. Normally, attempts to deliver delayed mail happen at regular intervals, the interval doubling after each failed attempt. Warning: flushing undeliverable mail frequently will result in poor delivery performance of all other mail.
Supprimer un message
# lister les messages en queue
mailq
# supprimer un message
sudo postsuper -d C0E7B5E4FA
postsuper: C0E7B5E4FA: removed
postsuper: Deleted: 1 message
To remove all mail from the queue, enter:
# postsuper -d ALL
To remove all mails in the deferred queue, enter:
# postsuper -d ALL deferred
See more:
* http://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html
==== rewrite the Sender/From ====
=== méthode #1 ===
dans le fichier de configuration principal ''/etc/postfix/main.cf'' :
append_dot_mydomain = yes
=== méthode #2 smtp_generic_maps ===
Sub mon Ubuntu les mails envoyés de la console partaient avec from= ...
Création du fichier ''/etc/postfix/generic'':
Édition:
cyrille@cyrille-W740SU w740su@giquello.fr
Compiler la table
sudo postmap /etc/postfix/generic
Ajouter sa réf dans /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic
Redémarrer postfix
sudo service postfix restart
Et voilà, maintenant les mails arrivent dans les boites avec from w740su@giquello.fr
=== méthode #3 sender_canonical ===
PAS TESTÉE
Avec une table canonique de re-écriture:
/etc/postfix/sender_canonical, and add user -> email references like this:
infinito infinito@hotmail.com
Donc dans mon cas :
tripwire tripwire@artefacts.coop
==== Restrictions ====
> Difference entre **smtpd_client_restrictions** et **smtpd_recipient_restrictions**
>> `client' est le nom de la machine qui se connecte au serveur Postfix (le client SMTP). On peut restreindre l'accès selon certains critères.
>> `recipient' est l'adresse du destinataire dans l'enveloppe du message. On peut restreindre l'accès selon d'autres critères.
>>
>> Les restrictions correspondent grosso-modo à l'ordre des commandes SMTP : (client) HELO, MAIL FROM, RCPT TO, DATA.
>>
>> Il faut savoir que, par défaut, Postfix applique les restrictions listées uniquement à l'étape RCPT TO, même si une règle aurait arrêté la connexion avant. Il est donc possible de mettre toutes les restrictions dans la variable `smtpd_recipient_restrictions'.
==== Stats tools ====
[[http://mailgraph.schweikert.ch|Mailgraph]]: Mailgraph is a very simple mail statistics RRDtool frontend for Postfix and Sendmail that produces daily, weekly, monthly and yearly graphs of received/sent and bounced/rejected mail.
[[https://calomel.org/pflogsumm.html|Pflogsumm]]: The Postfix Log Entry Summarizer
[[http://www.enderunix.org/isoqlog/|Isoqlog]]: Isoqlog is an MTA log analysis program written in C. It designed to scan [[/informatique/reseau/qmail|QMail]], Postfix, [[/informatique/reseau/sendmail|Sendmail]] and exim logfile and produce usage statistics in HTML format for viewing through a browser. It produces Top domains output according to Sender, Receiver, Total mails and bytes; it keeps your main domain mail statistics with regard to Days Top Domain, Top Users values for per day, per month and years.
==== Dovecot SASL configuration for the Postfix SMTP server ====
In order to enable SASL support in the Postfix SMTP server:
/etc/postfix/main.cf:
smtpd_sasl_auth_enable = yes
In order to allow mail relaying by authenticated remote SMTP clients:
/etc/postfix/main.cf:
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
Dovecot SASL support is available in Postfix 2.3 and later. On the Postfix side you need to specify the location of the Dovecot authentication daemon socket. We use a pathname relative to the Postfix queue directory, so that it will work whether or not the Postfix SMTP server runs chrooted:
/etc/postfix/main.cf:
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
On the Dovecot side you also need to specify the Dovecot authentication daemon socket. In this case we specify an absolute pathname. In the example we assume that the Postfix queue is under /var/spool/postfix/.
/some/where/dovecot.conf:
auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
See the Dovecot documentation for how to configure and operate the Dovecot authentication server.
==== Non-Unix users ====
[[https://help.ubuntu.com/community/PostfixVirtualMailBoxClamSmtpHowto|PostfixVirtualMailBoxClamSmtpHowto]]
==== SpamAssassin et ClamAV ====
La clé c'est : amavisd-new
http://www.drakonix.fr/?id=3&page=27
http://www.section6.net/wiki/index.php/Setting_up_Postfix_Spamassassin_Amavisd_Clamav
http://www.freespamfilter.org/FC4.html#_Toc110999194
http://www.ijs.si/software/amavisd/amavisd-new-docs.html
http://www.scalix.com/wiki/index.php?title=HowTos/Amavisd#Configuring_amavisd-new
==== LDAP ====
* [[http://postfix.traduc.org/index.php/LDAP_README.html|Postfix LDAP Howto - Support de LDAP dans Postfix]]
http://wiki.dovecot.org/AuthDatabase/LDAP
http://wiki.dhits.nl/index.php/Dovecot_postfix_ldap#Postfix
http://www.linuxmail.info/postfix-dovecot-ldap-centos-5/
http://blogpmenier.dynalias.net/docext/postfix-ldap/postfix-ldap.htm