Configuration correcte de Postfix sous Debian
Bonjour à tous
J'ai installé un serveur web sur une VM dans une de nos infra, et j'y ai migré les données de l'un de nos anciens serveurs clos au 30 juin ( merci ovh ).
Mon ancien serveur datait de Mathusalem (distrib red hat 7.2 de 2006 ), php4, mysql4, qmail.
Il faisait office de serveur dns pour le domaine example.fr qu'il hébergeait.
Ma nouvelle machine tourne sous debian 7, php5 et postfix pour la gestion des mails ( sortants, pas besoin de recevoir de mails ).
Là où ça bloque:
Au début, j'ai laissé postfix en écoute, et j'avais le problème du "backscatter" où mon install renvoyait des mails qui ne lui était pas destiné à des adresses d'expéditeurs faussées.
Donc j'ai changé le inet_interfaces sur loopback pour ne plus écouter les mails entrants et agir en tant que spammeur ( j'ai conscience que ce n'est pas "la solution" mais un contournement, j'ai essayé deux trois trucs par rapport aux docs trouvés, mais j'avoue n'être pas calé sur les serveurs mails .. )
S'il y a ici des compétences pour m'aider à solutionner ce problème (encore que, ne pas recevoir de mails n'est pas génant )
Le second problème:
Plus important, mes mails sont encore refusés par "pas mal" / "un certain nombre de serveurs" et, ceci dit, ça s'est bien amélioré par rapport au début ( création d'un "transport" spécifique pour free/orange entre autres ).
J'ai le cas par des systèmes qui considèrent mes mails en spam ( ok il y a des liens et du texte dedans, mais ce n'est pas du spam ).
L'ancien serveur n'était pas considéré comme spam.
Donc j'ai plus l'impression que c'est un problème de configuration générale ( DNS/Hostname/SPF ? ) que de postfix ?
Parfois le serveur me donne l'info comme quoi mes mails sont considérés comme du spam, des fois il se contente d'un "bounce or trace service failure" ..
Voilà un petit florilège:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
501 Connection rejected by policy [7.7] xxxxxx, please visit www.messagelabs.com/support for more details about this error message.
Final-Recipient: rfc822; xxxxxxxxx@hotmail.fr
Action: failed
Status: 4.3.0
Remote-MTA: dns; mx3.hotmail.com
Diagnostic-Code: smtp; 550 Requested action not taken: mailbox unavailable
Final-Recipient: rfc822; xxxxxxx@konicaminolta.fr
Action: failed
Status: 4.3.0
Remote-MTA: dns; mx11a.antispameurope.de
Diagnostic-Code: smtp; 554 5.5.4
Final-Recipient: rfc822; xxx@free.fr
Action: failed
Status: 4.0.0
Remote-MTA: dns; mx1.free.fr
Diagnostic-Code: smtp; 451 too many errors from your ip (xxx.xxx.xxx.xxx), please
visit http://postmaster.free.fr/ |
Mon serveur a bien un hostname srvweb01.example.fr
il a bien un reverse DNS sur cette adresse avec son IP
Voilà ma config
postconf -n
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
disable_vrfy_command = yes
inet_interfaces = loopback-only
mailbox_size_limit = 0
mydestination = localhost.localdomain, lcoalhost
myhostname = srvweb01.example.fr
mynetworks = 127.0.0.0/8, mon_adresse_ip_publique
myorigin = example.fr
recipient_delimiter = +
relay_recipient_maps = hash:/etc/postfix/relay_recipients
relayhost =
slow_destination_concurrency_limit = 2
slow_destination_recipient_limit = 20
smtp_bind_address = mon_adresse_ip_publique
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname
smtpd_data_restrictions = reject_multi_recipient_bounce
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname, reject_unknown_reverse_client_hostname, reject_unauth_pipelining, reject_unknown_sender_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unknown_recipient_domain, reject_unverified_recipient
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_unverified_sender
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_aliases.cf,mysql:/etc/postfix/mysql-virtual_aliases_comptes.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/spool/vmail/
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domaines.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_comptes.cf
virtual_uid_maps = static:5000 |
master.cf
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| #
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
# -o content_filter=spamchk
slow unix - - n - 5 smtp
-o syslog_name=postfix-slow
-o smtp_destination_concurrency_limit=3
-o slow_destination_rate_delay=1
#smtp inet n - - - 1 postscreen
#smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
#submission inet n - - - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
# -o syslog_name=postfix/smtps
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
#bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
#spamchk unix - n n - 10 pipe
# flags=Rq user=nobody argv=/usr/local/bin/spamchk -f ${sender} -- ${recipient}
#slow down trafic to some smtp relou |
Je suis complètement open à tout discussion sur le sujet, vous pouvez me lancer des pierres pour tout ce qui n'est pas admin-linux proof ( enfin bon en même temps j'ai eu deux mois pour remonter un serveur complet, migrer, paramétrer etc ! ), car c'est le seul point noir de l'install, les mails. Tout le reste est au poil.
Merci ;)