bonjour,
j'ai un serveur mail virtuel mutidomaine avec postfix, courier-pop, mysql, sasl et openssl.
Le truc, c'est que j'arrive à envoyer des mails à des domaines quelconques comme hotmail.com mais je n'arrive pas à envoyer des mails en locale entre 2 comptes distinctes de mon domaine, du moins je peux envoyer mais je ne sais pas où est ce que ces mails atterrissent et pourtant mes répertoires virtuels ont bien été crée du type /home/vmail/domaine/user/...tmp...cur....new
voici ma config :
main.cf
Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
queue_directory = /var/spool/postfix
mail_spool_directory = /var/spool/mail
myhostname = server.nci.lan
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
# DISTRIBUTION DES MESSAGES LOCAUX
mailbox_command = /usr/bin/procmail
mailbox_size_limit = 0
recipient_delimiter =
inet_interfaces = all
inet_protocols = all
mynetworks = 127.0.0.0/8
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
master.cf
#
# Postfix master process configuration file. For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#submission inet n - - - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps inet n - - - - smtpd
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - - - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#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 - - 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
smtp unix - - - - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - - - - smtp
-o fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error 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}
#
# 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}
les fichier .cf
/etc/postfix/mysql-virtual_domains.cf:
user = root
password = pass
dbname = mail
table = domains
select_field = 'virtual'
where_field = domain
hosts = 127.0.0.1
/etc/postfix/mysql-virtual_forwardings.cf:
user = root
password = pass
dbname = mail
table = forwardings
select_field = destination
where_field = source
hosts = 127.0.0.1
/etc/postfix/mysql-virtual_mailboxes.cf:
user = root
password = pass
dbname = mail
table = users
select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
where_field = email
hosts = 127.0.0.1
/etc/postfix/mysql-virtual_email2email.cf:
user = root
password = pass
dbname = mail
table = users
select_field = email
where_field = email
hosts = 127.0.0.1
/etc/postfix/mysql-virtual_transports.cf:
user = root
password = pass
dbname = mail
table = transport
select_field = transport
where_field = domain
hosts = 127.0.0.1
/etc/postfix/mysql-virtual_mailbox_limit_maps.cf:
user = root
password = pass
dbname = mail
table = users
select_field = quota
where_field = email
hosts = 127.0.0.1
Mes tables SQL :
mysql> show tables;
+----------------+
| Tables_in_mail |
+----------------+
| domains |
| forwardings |
| transport |
| users |
+----------------+
4 rows in set (0.00 sec)
mysql> select * from domains ;
+-------------+
| domain |
+-------------+
| example.com |
+-------------+
1 row in set (0.00 sec)
mysql> select * from forwardings;
+--------------+---------------+
| source | destination |
+--------------+---------------+
| info@nci.lan | admin@nci.lan |
+--------------+---------------+
1 row in set (0.00 sec)
mysql> select * from transport
+---------+-------------------+
| domain | transport |
+---------+-------------------+
| nci.lan | smtp:mail.nci.lan |
| * | : |
+---------+-------------------+
2 rows in set (0.00 sec)
mysql> select * from users;
+---------------+---------------+----------+
| email | password | quota |
+---------------+---------------+----------+
| admin@nci.lan | lnEUWbxckw5jI | 10485760 |
| user@nci.lan | FCnbCGnQQyX6Q | 10485760 |
+---------------+---------------+----------+
2 rows in set (0.00 sec)
et voici mes dernieres lignes de mail.log lorsque j'envoie un mail dans mon propre domaine :
Aug 17 15:16:17 server pop3d-ssl: Connection, ip=[::ffff:10.1.0.150]
Aug 17 15:16:18 server pop3d-ssl: LOGIN, user=user@nci.lan, ip=[::ffff:10.1.0.150]
Aug 17 15:16:18 server pop3d-ssl: LOGOUT, user=user@nci.lan, ip=[::ffff:10.1.0.150], top=0, retr=0, time=0
Aug 17 15:16:48 server postfix/smtpd[4102]: connect from unknown[10.1.0.150]
Aug 17 15:16:58 server postfix/smtpd[4102]: 576BE95B: client=unknown[10.1.0.150], sasl_method=PLAIN, sasl_username=admin@nci.lan
Aug 17 15:16:58 server postfix/cleanup[4109]: 576BE95B: message-id=<44E45023.8030903@nci.lan>
Aug 17 15:16:58 server postfix/qmgr[3849]: 576BE95B: from=<admin@nci.lan>, size=503, nrcpt=2 (queue active)
Aug 17 15:16:58 server postfix/smtpd[4102]: disconnect from unknown[10.1.0.150]
Aug 17 15:16:58 server postfix/smtp[4112]: 576BE95B: to=<admin@nci.lan>, relay=none, delay=0, status=bounced (mail for mail.nci.lan loops back to myself)
Aug 17 15:16:58 server postfix/smtp[4112]: 576BE95B: to=<user@nci.lan>, relay=none, delay=0, status=bounced (mail for mail.nci.lan loops back to myself)
Aug 17 15:16:58 server postfix/cleanup[4109]: 9457E5020: message-id=<20060817111658.9457E5020@server.nci.lan>
Aug 17 15:16:58 server postfix/qmgr[3849]: 9457E5020: from=<>, size=2317, nrcpt=1 (queue active)
Aug 17 15:16:58 server postfix/qmgr[3849]: 576BE95B: removed
Aug 17 15:16:58 server postfix/smtp[4112]: 9457E5020: to=<admin@nci.lan>, relay=none, delay=0, status=bounced (mail for mail.nci.lan loops back to myself)
Aug 17 15:16:58 server postfix/qmgr[3849]: 9457E5020: removed
et les log de mysql :
060817 15:16:18 16 Connect root@localhost on
16 Init DB mail
16 Query SELECT email, password, "", 5000, 5000, "/home/vmail", CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/'), "", "", "" FROM users WHERE email = "user@nci.lan"
060817 15:16:58 17 Connect root@localhost on mail
17 Init DB mail
17 Query SELECT password FROM users WHERE email = 'admin@nci.lan'
17 Quit
18 Connect root@localhost on mail
18 Init DB mail
18 Query SELECT 0, password FROM users WHERE email = 'admin@nci.lan'
18 Quit
19 Connect root@localhost on mail
19 Query SELECT 'virtual' FROM domains WHERE domain='nci.lan'
20 Connect root@localhost on mail
20 Query SELECT transport FROM transport WHERE domain='admin@nci.lan'
20 Query SELECT transport FROM transport WHERE domain='nci.lan'
21 Connect root@localhost on mail
21 Query SELECT destination FROM forwardings WHERE source='admin@nci.lan'
22 Connect root@localhost on mail
22 Query SELECT email FROM users WHERE email='admin@nci.lan'
19 Query SELECT 'virtual' FROM domains WHERE domain='nci.lan'
20 Query SELECT transport FROM transport WHERE domain='user@nci.lan'
20 Query SELECT transport FROM transport WHERE domain='nci.lan'
21 Query SELECT destination FROM forwardings WHERE source='user@nci.lan'
22 Query SELECT email FROM users WHERE email='user@nci.lan'
23 Connect root@localhost on mail
23 Query SELECT destination FROM forwardings WHERE source='admin@nci.lan'
24 Connect root@localhost on mail
24 Query SELECT email FROM users WHERE email='admin@nci.lan'
23 Query SELECT destination FROM forwardings WHERE source='user@nci.lan'
24 Query SELECT email FROM users WHERE email='user@nci.lan'
19 Query SELECT 'virtual' FROM domains WHERE domain='nci.lan'
20 Query SELECT transport FROM transport WHERE domain='user@nci.lan'
20 Query SELECT transport FROM transport WHERE domain='nci.lan'
23 Query SELECT destination FROM forwardings WHERE source='admin@nci.lan'
24 Query SELECT email FROM users WHERE email='admin@nci.lan'
19 Query SELECT 'virtual' FROM domains WHERE domain='nci.lan'
20 Query SELECT transport FROM transport WHERE domain='admin@nci.lan'
20 Query SELECT transport FROM transport WHERE domain='nci.lan'
060817 15:17:58 21 Quit
22 Quit
19 Quit
20 Quit
23 Quit
24 Quit