Can't achieve alias working with SQL

Samuel compte-dovecot at ingescom.com
Tue May 19 11:23:33 UTC 2015


Hello,

On a fresh install of Jessie, I achieve to make dovecot/postfix working 
with SQL, but I still can't send email to alias for wich one I get : 
"Unknown user"

After debug enable in dovecot, I see that the user_query SQL , just 
query for the "users" table and not the "forward" table so the final 
alias user is not known.

But when I check postfix for alias, it seems ok :

root at cluster-dovecot:/etc/dovecot# postmap -q contact2 at XXXXXXXX.com 
mysql:alias_maps
contact at XXXXXXXXXX.com

So what do I missed for alias working with dovecot ?

Do I need a special conf in master.conf for sending alias AND final 
recipient or do I have to change the dovecot user_query for taking in 
acount the "forward" table in the SQL query ?  .... or other thing I 
could miss ...

Thanks a lot ...

Samuel.

DOVECOT :

root at cluster-dovecot:/etc/dovecot# dovecot --version
2.2.13

root at cluster-dovecot:/etc/dovecot# dovecot -n
# 2.2.13: /etc/dovecot/dovecot.conf
# OS: Linux 3.16.0-4-amd64 x86_64 Debian 8.0
auth_debug_passwords = yes
auth_mechanisms = plain login
dict {
   quota = mysql:/etc/dovecot/dovecot-dict-sql-user.conf
   quota_domain = mysql:/etc/dovecot/dovecot-dict-sql-domain.conf
}
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_debug = yes
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_plugins = quota fts fts_solr acl zlib mail_log notify
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope 
encoded-character vacation subaddress comparator-i;ascii-numeric 
relational regex imap4flags copy include variables body enotify 
environment mailbox date ihave
namespace inbox {
   inbox = yes
   location =
   mailbox Drafts {
     special_use = \Drafts
   }
   mailbox Junk {
     special_use = \Junk
   }
   mailbox Sent {
     special_use = \Sent
   }
   mailbox "Sent Messages" {
     special_use = \Sent
   }
   mailbox Trash {
     special_use = \Trash
   }
   prefix =
}
passdb {
   args = /etc/dovecot/dovecot-sql.conf
   driver = sql
}
plugin {
   quota = dict:user::proxy::quota
   quota2 = dict:domain:%d:proxy::quota_domain
   quota_grace = 1M
   quota_warning = storage=100%% quota-warning 100 %u
   quota_warning2 = storage=95%% quota-warning 95 %u
   quota_warning3 = storage=80%% quota-warning 80 %u
   quota_warning4 = -storage=100%% quota-warning below %u
   sieve = ~/.dovecot.sieve
   sieve_dir = ~/sieve
}
protocols = imap pop3 sieve lmtp
service auth {
   unix_listener /var/spool/postfix/private/auth {
     group = mail
     mode = 0660
     user = postfix
   }
   unix_listener auth-master {
     mode = 0660
     user = vmail
   }
   unix_listener auth-userdb {
     mode = 0660
     user = vmail
   }
}
service dict {
   unix_listener dict {
     mode = 0666
     user = dovecot
   }
}
service imap-login {
   inet_listener imap {
     address = *
     port = 143
   }
   inet_listener imaps {
     address = *
     port = 993
   }
   process_limit = 256
}
service managesieve-login {
   inet_listener sieve {
     port = 4190
   }
}
service managesieve {
   process_limit = 1024
}
service quota-status {
   executable = quota-status -p postfix
   inet_listener {
     port = 12340
   }
}
service quota-warning {
   executable = script /usr/local/bin/quota-warning.sh
   unix_listener quota-warning {
     mode = 0666
     user = vmail
   }
   user = vmail
}
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
   args = /etc/dovecot/dovecot-sql.conf
   driver = sql
}
protocol lmtp {
   mail_plugins = " sieve"
}
protocol lda {
   mail_plugins = " quota sieve"
}
protocol imap {
   mail_plugins = " quota imap_quota"
}

POSTFIX :

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
alias_maps_dbname = $mysql_dbname
alias_maps_hosts = $mysql_host
alias_maps_password = $mysql_passwd
alias_maps_select_field = destination
alias_maps_table = forwards
alias_maps_user = $mysql_user
alias_maps_where_field = source
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
dovecot_destination_concurrency_limit = 1
dovecot_destination_recipient_limit = 1
gid_maps_dbname = $mysql_dbname
gid_maps_hosts = $mysql_host
gid_maps_password = $mysql_passwd
gid_maps_select_field = gid
gid_maps_table = users
gid_maps_user = $mysql_user
gid_maps_where_field = concat(username,'@',domain)
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_domains_dbname = $mysql_dbname
mailbox_domains_hosts = $mysql_host
mailbox_domains_password = $mysql_passwd
mailbox_domains_select_field = domain
mailbox_domains_table = domains
mailbox_domains_user = $mysql_user
mailbox_domains_where_field = domain
mailbox_maps_dbname = $mysql_dbname
mailbox_maps_hosts = $mysql_host
mailbox_maps_password = $mysql_passwd
mailbox_maps_select_field = home
mailbox_maps_table = users
mailbox_maps_user = $mysql_user
mailbox_maps_where_field = concat(username,'@',domain)
mailbox_size_limit = 0
maximal_queue_lifetime = 1d
mydestination = cluster-dovecot.ingescom.com, localhost.ingescom.com, , 
localhost
myhostname = cluster-dovecot.ingescom.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
mysql_dbname = mail
mysql_host = 10.40.30.1
mysql_passwd = mail_admin
mysql_user = mail_admin
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_delay_reject = yes
smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:12340
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated 
defer_unauth_destination reject
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_security_options = noanonymous
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
uid_maps_dbname = $mysql_dbname
uid_maps_hosts = $mysql_host
uid_maps_password = $mysql_passwd
uid_maps_select_field = uid
uid_maps_table = users
uid_maps_user = $mysql_user
uid_maps_where_field = concat(username,'@',domain)
virtual_alias_maps = mysql:alias_maps
virtual_gid_maps = mysql:gid_maps
virtual_mailbox_base = /
virtual_mailbox_domains = mysql:mailbox_domains
virtual_mailbox_limit = 1024000000
virtual_mailbox_maps = mysql:mailbox_maps
virtual_minimum_uid = 2000
virtual_transport = dovecot
virtual_uid_maps = mysql:uid_maps

master.conf : (I tried several conf)

dovecot unix    -       n       n       -       -       pipe
   flags=DRhu user=vmail:vmail argv=/usr/bin/sudo 
/usr/lib/dovecot/deliver -d ${recipient} -a ${original_recipient}
   #flags=DRhu user=vmail: argv=/usr/bin/sudo /usr/lib/dovecot/deliver 
-f ${sender} -d ${user}@${nexthop} -a ${recipient}
   #flags=DRhu user=vmail: argv=/usr/bin/sudo /usr/lib/dovecot/deliver 
-f ${sender} -d ${user}@${nexthop} -a ${original_recipient}
   #flags=DRhu user=vmail:vmail argv=/usr/bin/sudo 
/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} -a 
${original_recipient}





More information about the dovecot mailing list