View Full Version : Alias mappings
rusty
25th January 2008, 03:34
Hi.
My virtual users are working fine. mail goes to the right mailbox. However, mail that needs to be forwarded to another user on the same domain, instead goes in that user's mailbox. (ie. joe@example.com goto mike@example.com lands in Joe's mailbox.) Postfix is referring to the correct db table (if I alter the name in mysql, the mail bounces). Somehow, postfix ignores the destination address in the goto field.
I'm using postfix, dovecot, postfixadmin, amavis
Any help would be greatly appreciated.
Thanks,
Eric
falko
25th January 2008, 18:22
Any errors in your mail log? What's in your main.cf?
rusty
27th January 2008, 00:56
Falko,
You're the best! Thanks for replying. First, I pasted contents of the log file. I don't see any errors. Two emails were sent at the same time, one to a virtual mailbox, and another to an alias that forwards to a virutal mailbox of another user. I can't see any difference. For the alias email, the message ends up in the recipient's mailbox instead of forwarding to another user's mailbox. Do I need to delete the recipient's mailbox now that I want it to forward to another user. To help make it clear, one employee quit, so their mail needs to forward to another employee's mailbox.
After the maillog entries, I pasted the contents of main.cf.
MAILLOG:
Jan 25 21:41:56 mail postfix/smtpd[7764]: connect from mailhost.sendersmtp.com[71.14.6.9]
Jan 25 21:41:56 mail postfix/smtpd[7766]: connect from mailhost.sendersmtp.com[71.14.6.9]
Jan 25 21:41:56 mail sqlgrey: grey: from awl match: updating 71.14.6(71.14.6.9), ric@sender.com(ric@sender.com)
Jan 25 21:41:56 mail sqlgrey: grey: from awl match: updating 71.14.6(71.14.6.9), ric@sender.com(ric@sender.com)
Jan 25 21:41:56 mail postfix/smtpd[7764]: 27E88578048: client=mailhost.sendersmtp.com[71.14.6.9]
Jan 25 21:41:56 mail postfix/cleanup[7771]: 27E88578048: message-id=<000001c85fc5$000bf9c0$06aba8c0@laptop>
Jan 25 21:41:56 mail postfix/smtpd[7766]: 2907657804D: client=mailhost.sendersmtp.com[71.14.6.9]
Jan 25 21:41:56 mail postfix/cleanup[7773]: 2907657804D: message-id=<000501c85fc5$0033a600$06aba8c0@laptop>
Jan 25 21:41:56 mail postfix/qmgr[31548]: 27E88578048: from=<ric@sender.com>, size=2962, nrcpt=1 (queue active)
Jan 25 21:41:56 mail postfix/smtpd[7764]: disconnect from mailhost.sendersmtp.com[71.14.6.9]
Jan 25 21:41:56 mail postfix/smtpd[7766]: disconnect from mailhost.sendersmtp.com[71.14.6.9]
Jan 25 21:41:56 mail postfix/qmgr[31548]: 2907657804D: from=<ric@sender.com>, size=2943, nrcpt=1 (queue active)
Jan 25 21:41:57 mail postfix/smtpd[7783]: connect from unknown[127.0.0.1]
Jan 26 02:41:57 mail postfix/smtpd[7783]: C6CE857804E: client=unknown[127.0.0.1]
Jan 25 21:41:57 mail postfix/cleanup[7771]: C6CE857804E: message-id=<000001c85fc5$000bf9c0$06aba8c0@laptop>
Jan 25 21:41:57 mail postfix/qmgr[31548]: C6CE857804E: from=<ric@sender.com>, size=3360, nrcpt=1 (queue active)
Jan 25 21:41:57 mail amavis[2783]: (02783-16) Passed CLEAN, [71.14.6.9] [71.14.6.9] <ric@sender.com> -> <mtg@nonalias.net>, Message-ID: <000001c85fc5$000bf9c0$06aba8c0@laptop>, mail_id: FGdRVLxZpJBi, Hits: 2.32, size: 2962, queued_as: C6CE857804E, 1653 ms
Jan 25 21:41:57 mail postfix/smtp[7774]: 27E88578048: to=<mtg@nonalias.net>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.7, delays=0.02/0.01/0.01/1.7, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C6CE857804E)
Jan 25 21:41:57 mail postfix/qmgr[31548]: 27E88578048: removed
Jan 26 02:41:57 mail postfix/smtpd[7783]: disconnect from unknown[127.0.0.1]
Jan 25 21:41:57 mail postfix/pipe[7785]: C6CE857804E: to=<mtg@nonalias.net>, relay=dovecot, delay=0.03, delays=0.01/0.01/0/0.01, dsn=2.0.0, status=sent (delivered via dovecot service)
Jan 25 21:41:57 mail postfix/qmgr[31548]: C6CE857804E: removed
Jan 26 02:41:57 mail postfix/smtpd[7783]: connect from unknown[127.0.0.1]
Jan 26 02:41:57 mail postfix/smtpd[7783]: F3DC4578048: client=unknown[127.0.0.1]
Jan 25 21:41:58 mail postfix/cleanup[7773]: F3DC4578048: message-id=<000501c85fc5$0033a600$06aba8c0@laptop>
Jan 25 21:41:58 mail postfix/qmgr[31548]: F3DC4578048: from=<ric@sender.com>, size=3199, nrcpt=1 (queue active)
Jan 26 02:41:58 mail postfix/smtpd[7783]: disconnect from unknown[127.0.0.1]
Jan 25 21:41:58 mail amavis[2784]: (02784-16) Passed CLEAN, [71.14.6.9] [71.14.6.9] <ric@sender.com> -> <mtb@alias.net>, Message-ID: <000501c85fc5$0033a600$06aba8c0@laptop>, mail_id: dkN9GpJf915h, Hits: 0.001, size: 2943, queued_as: F3DC4578048, 1828 ms
Jan 25 21:41:58 mail postfix/smtp[7775]: 2907657804D: to=<mtb@alias.net>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.9, delays=0.02/0.01/0/1.8, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as F3DC4578048)
Jan 25 21:41:58 mail postfix/qmgr[31548]: 2907657804D: removed
Jan 25 21:41:58 mail postfix/pipe[7785]: F3DC4578048: to=<mtb@alias.net>, relay=dovecot, delay=0.05, delays=0.01/0/0/0.04, dsn=2.0.0, status=sent (delivered via dovecot service)
Jan 25 21:41:58 mail postfix/qmgr[31548]: F3DC4578048: removed
MAIN.CF
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, mail.$mydomain
mydomain = myserver.com
myhostname = mail.myserver.com
mynetworks = 127.0.0.0/8
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
receive_override_options = no_address_mappings
recipient_delimiter = +
relayhost =
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject _unauth_destination, check_policy_service inet:127.0.0.1:2501
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/mail.myserver.com.crt
smtpd_tls_key_file = /etc/pki/tls/private/mail.myserver.com.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:/var/spool/postfix/mtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = dovecot
virtual_uid_maps = static:5000
falko
27th January 2008, 15:52
What's in /etc/postfix/mysql_virtual_alias_maps.cf?
rusty
27th January 2008, 20:18
See below for the file requested.
My mysql database was setup by the script that comes with postfixadmin.
As mentioned in my initial post, if I alter the address field in the alias table, delivery fails completely (so it is sucessfully accessing the mysql db).
I have also used this file with the last line commented and all the others uncommented:
mysql_virtual_alias_maps.cf
*********
user = myuser
password = mypassword
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'
falko
28th January 2008, 18:00
Looks good.
What's in your alias table?
SELECT * FROM alias;
rusty
28th January 2008, 20:07
mysql> SELECT * FROM alias;
+-------------------------------+-------------------------------+--------------------+---------------------+---------------------+--------+
| address | goto | domain | created | modified | active |
+-------------------------------+-------------------------------+--------------------+---------------------+---------------------+--------+
Does this answer your question, or do you need to see the actual data?
falko
29th January 2008, 21:21
If the table is empty, then it's clear why it's not working, but if the forward is in there, then I don't know what's wrong... :confused:
rusty
29th January 2008, 23:01
Yes, the table has data in it. I have examined it and it looks correct. Thanks for trying.
Could you answer one question? Does it look like the Dovecot service is involved in delivery to the mailbox? Here is an entry in the log:
Jan 29 15:56:06 mail postfix/pipe[28583]: 4AD4C57805F: to=<mtb@domain.net>, relay=dovecot, delay=0.03, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
Should I look there for the problem? I've been assuming Postfix is controlling 100% of the delivery.
falko
30th January 2008, 16:38
Jan 29 15:56:06 mail postfix/pipe[28583]: 4AD4C57805F: to=<mtb@domain.net>, relay=dovecot, delay=0.03, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
Should I look there for the problem? I've been assuming Postfix is controlling 100% of the delivery.
That's strange. Normally the delivery is done by Postfix, and Dovecot is used only for fetching mails from the server.
topdog
30th January 2008, 16:56
That's strange. Normally the delivery is done by Postfix, and Dovecot is used only for fetching mails from the server.
This is being delivered using dovecots LDA mechanisim.
http://wiki.dovecot.org/LDA/Postfix
rusty
30th January 2008, 18:15
Yes, topdog is right.
The dovecot.org list told me dovecot ignores alias mapping. Since the postmap command showed the alias address was properly output, I looked at where in between postfix and dovecot the alias mapping was being lost. I did some research and I found that when using amavis, alias mapping was applied after it returned the message to postfix.
So I focused my attention on the master.cf in the amavis section. That's when I found a stray # found it's way into the line that starts with -o receive_override_options=
Stupid mistakes can be the hardest to figure out!
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.