Postfix & Dovecot + VirtualHost & flat passwd-file

Bonjour,

Le monde Linux et surtout Debian, c’est pas nouveau pour moi… Par contre, il y a toujours quelque chose que je n’ai jamais réussi à faire correctement; c’est un serveur de courrier électronique.

J’ai parcouru le net, des forums anglais, des forums français, des dizaines de tutos en ligne… Il y a toujours un truc qui ne fonctionne pas correctement et ça me rend chèvre. bêêêêê!
Peut-être que je m’y prend très mal ?… Je sais pas mais je veux bien un petit cours.

Bref, pour faire au plus simple pour vous épargner le pavé;
— J’ai 1 serveur dédié avec Postfix et Dovecot d’installé
— J’ai 1 adresse IPv4
— J’ai 31 noms de domaines dont les adresses mail doivent être associée à ce serveur
— Ces 31 noms de domaines ont toutes une adresse info@quelquechose.tld et abuse@quelquechose.tld
— Le serveur ne doit prendre en charge QUE les protocoles IMAP (143) et SMTP (25 & 2525)
— L’authentification se fait en clair (PLAIN… Pas de SSL ni de TLS)
— La gestion des domaines, des adresses mails & des alias se fait simplement avec des fichiers plats (texte)

Pour l’instant;
— Je parviens à envoyer des e-mails et les gens les reçoivent donc Postfix est OK.
— Je peux sans soucis écrire un e-mail, une fois envoyé; le mail est transféré dans le dossier Sent donc Dovecot est OK

Ce qui ne fonctionne pas;
— Si j’envoie un e-mail à une adresse hébergée par le serveur; le courrier part (je le vois dans /tmp/spool/postfix/active/) mais n’arrive jamais dans l’INBOX de la boîte de destination.

Si quelqu’un pouvais m’aiguiller sur ce qui coince car, franchement, je vois pas. Ça fait 3 jours que je tourne en rond.

Mon fichier postfix/main.cfg

[code]smtpd_banner = $myhostname ESMTP
biff = no

append_dot_mydomain = no

inet_interfaces = all
inet_protocols = ipv4

myhostname = localhost
myorigin = $myhostname
#mydestination = $myhostname, $virtual_mailbox_domains
mynetworks = 127.0.0.0/8
relayhost =
relay_domains = *

alias_maps = hash:/etc/postfix/vmail_aliases
alias_database = $alias_maps

html_directory = no
readme_directory = no
mailbox_size_limit = 0
setgid_group = postdrop
home_mailbox = Maildir/
message_size_limit = 0
recipient_delimiter = +
broken_sasl_auth_clients = yes

virtual_mailbox_base = /home/vmail
virtual_alias_maps = hash:/etc/postfix/vmail_aliases
virtual_mailbox_domains = hash:/etc/postfix/vmail_domains
virtual_mailbox_maps = hash:/etc/postfix/vmail_mailbox
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = virtual

smtp_use_tls=no

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_authenticated_header = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options

smtpd_use_tls=no
#smtpd_helo_required = yes
#smtpd_helo_restrictions = permit_mynetworks, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, permit
#smtpd_recipient_restrictions = reject_unknown_client_hostname, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_sender
#smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

#unknown_address_reject_code = 550
#unknown_hostname_reject_code = 550
#unknown_client_reject_code = 550

dovecot_destination_recipient_limit = 1
disable_vrfy_command = yes
#local_recipient_maps = $virtual_mailbox_maps, $virtual_alias_maps[/code]

Mon fichier postfix/master.cfg

[code]#

Postfix master process configuration file. For details on the format

of the file, see the master(5) manual page (command: “man 5 master” or

on-line: http://www.postfix.org/master.5.html).

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 - n - - smtpd
#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_reject_unlisted_recipient=no

-o smtpd_client_restrictions=$mua_client_restrictions

-o smtpd_helo_restrictions=$mua_helo_restrictions

-o smtpd_sender_restrictions=$mua_sender_restrictions

-o smtpd_recipient_restrictions=

-o smtpd_relay_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_reject_unlisted_recipient=no

-o smtpd_client_restrictions=$mua_client_restrictions

-o smtpd_helo_restrictions=$mua_helo_restrictions

-o smtpd_sender_restrictions=$mua_sender_restrictions

-o smtpd_recipient_restrictions=

-o smtpd_relay_restrictions=permit_sasl_authenticated,reject

-o milter_macro_daemon_name=ORIGINATING

#628 inet n - - - - qmqpd
pickup unix n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix 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}

dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f $sender -d $recipient[/code]

Mon fichier postfix/vmail_domains

Mon fichier postfix/vmail_mailbox

Mon fichier postfix/vmail_alias

Mon fichier dovecot/dovecot.conf

[code]listen = *
base_dir = /run/dovecot/
instance_name = dovecot
login_greeting = Dovecot ready.
ssl = no
disable_plaintext_auth = no
protocols = imap
auth_username_format=%u
auth_mechanisms = plain

log_path = /tmp/dovecot.log
info_log_path = /tmp/dovecot.log
debug_log_path = /dev/null
syslog_facility = mail
auth_verbose = yes
auth_verbose_passwords = yes
auth_debug = no
auth_debug_passwords = yes
mail_debug = no
verbose_ssl = no

log_timestamp = "%d.%m.%Y %H:%M:%S "
login_log_format_elements = user=<%u> method=%m
login_log_format = %$: %s
mail_log_prefix = "%s(%u): "
deliver_log_format = msgid=%m: %$

mail_shared_explicit_inbox = no

default_login_user = dovenull
default_internal_user = dovecot
mail_access_groups = vmail
default_login_user = vmail
first_valid_uid = 5000
first_valid_gid = 5000

mail_full_filesystem_access = no
mail_location = maildir:/home/vmail/%d/%n

mmap_disable = yes
dotlock_use_excl = no
mail_fsync = never
lock_method = fcntl
mail_temp_dir = /tmp

mail_max_keyword_length = 50

mail_plugin_dir = /usr/lib/dovecot/modules

service imap-login {
inet_listener imap {
port = 143
}
user = vmail
}
protocol imap {
#mail_max_userip_connections = 10
}
userdb {
driver = static
args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
}
passdb {
driver = passwd-file
args = scheme=plain username_format=%u /etc/dovecot/users
}
service auth {
unix_listener /var/spool/postfix/private/dovecot-auth {
group = postfix
mode = 0660
user = postfix
}
}
namespace inbox {
inbox = yes
hidden = no
location =
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Templates {
auto = subscribe

special_use = \Templates

}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox Archives {
auto = subscribe

special_use = \Archives

}
prefix =
}[/code]

Mon fichier dovecot.conf/users

Données du DNS

MX mx.mon-domaine.net 10 MX A x.x.x.x MAIL A x.x.x.x TXT v=spf1 mx a ptr ip4:x.x.x.x a:mail.mon-domaine.net ?all