[Dovecot] Virtual Alias Forwarding

Eric Biondi eric08 at biondi.com
Wed Jan 30 01:01:15 EET 2008


I'm having a problem with Dovecot and forwarding of aliases. Any help would
be greatly appreciated.

I'm using Postfix, Mysql, dovecot, amavis.

mysql> SELECT * FROM alias;
| address | goto | domain | created | modified | active |

It seems from the logs that incoming mail is being delivered to the mailbox
via dovecot. Mail gets to the correct mailbox (address field), however, if I
change the destination mailbox (goto) in the alias table in mysql, the mail
still goes to the main mailbox (address). 

mysql_virtual_alias_maps.cf looks to be configured correctly but I'm
suspecting that dovecot is circumventing that file. 

I'll post maillog entry, dovecot-deliver.log entry, dovecot-mysql.conf,
mysql_virtual_alias_maps.cf, and dovecot.conf below in case that helps.
Thanks in advance for anything that helps me resolve this.

Maillog:
Jan 29 17:23:04 mail postfix/pipe[29368]: D16F657804A: to=<mtb at domain.net>,
relay=dovecot, delay=0.03, delays=0.01/0.01/0/0.01, dsn=2.0.0, status=sent
(delivered via dovecot service)

dovecot-deliver.log:
deliver(mtb at domain.net): Jan 29 17:23:04 Info:
msgid=<009501c862c5$84086080$4b06a8c0 at comperic>: saved mail to INBOX

dovecot-mysql.conf:
driver = mysql
connect = host=127.0.0.1 dbname=mail user=sqluser password=sqlpasswd
default_pass_scheme = MD5 # Get the mailbox user_query = SELECT
'/home/vmail/%d/%n' as home, 'maildir:/home/vmail/%d/%n' as mail, 5000 AS
uid, 5000 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox
WHERE username = '%u' AND active = '1'
# Get the password
password_query = SELECT username as user, password, '/home/vmail/%d/%n' as
userdb_home, 'maildir:/home/vmail/%d/%n' as userdb_mail, 5000 as userdb_uid,
5000 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
# If using client certificates for authentication, comment the above and
uncomment the following #password_query = SELECT null AS password, '%u' AS
user

mysql_virtual_alias_maps.cf:
user = sqluser
password = sqlpasswd
hosts = 127.0.0.1
dbname = mail
#table = alias
#select_field = goto
#where_field = address
#additional_conditions = and active = '1'
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'

# dovecot -n
# 1.0.7: /etc/dovecot.conf
protocols: imaps pop3s
ssl_listen(default): *:993
ssl_listen(imap): *:993
ssl_listen(pop3): *:995
ssl_cert_file: /etc/pki/tls/certs/mail.domain.com.crt
ssl_key_file: /etc/pki/tls/private/mail.domain.com.pem
disable_plaintext_auth: yes
login_dir: /var/run/dovecot/login
login_executable(default): /usr/libexec/dovecot/imap-login
login_executable(imap): /usr/libexec/dovecot/imap-login
login_executable(pop3): /usr/libexec/dovecot/pop3-login
first_valid_uid: 5000
last_valid_uid: 5000
first_valid_gid: 5000
last_valid_gid: 5000
mail_location: maildir:/home/vmail/%d/%n
mail_executable(default): /usr/libexec/dovecot/imap
mail_executable(imap): /usr/libexec/dovecot/imap
mail_executable(pop3): /usr/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/lib64/dovecot/imap
mail_plugin_dir(imap): /usr/lib64/dovecot/imap
mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3
namespace:
  type: private
  separator: /
  inbox: yes
auth default:
  mechanisms: plain login
  passdb:
    driver: pam
  passdb:
    driver: sql
    args: /etc/dovecot-mysql.conf
  userdb:
    driver: passwd
  userdb:
    driver: static
    args: uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
  userdb:
    driver: sql
    args: /etc/dovecot-mysql.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail





More information about the dovecot mailing list