OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Virtual domains relay problem

From: Pawel Wasylyszyn (pawel.wasylyszyngmail.com)
Date: Tue Aug 26 2008 - 12:11:13 CDT


Hello,

I have a problem with virtual domains - when I'm trying to send an e-mail
from any host outside the localhost to user in virtual domain, I get 'relay
access denied'.
However, when I'm trying to send it from localhost, everything's OK. MX is
set to my Postfix machine, entries in MySQL are OK.

When I'm trying to send mail from remote host, in MySQL logs I can see that
postfix doesn't query for full address, but only for the part after - it
also queries for domain I'm sending mail from:

my source email: abcdomain.com
my dest email : defvirtual.com

From any host outside localhost postfix sends following queries:
--
080826 18:37:53 133 Connect postfixxxxxxxxx on postfix
                    133 Query SELECT goto FROM alias WHERE address='
domain.com'
                    134 Connect postfixxxxxxxxxxx on postfix
                    134 Query SELECT domain FROM domain WHERE domain='
domain.com'
                    133 Query SELECT goto FROM alias WHERE address='
virtual.com'
                    134 Query SELECT domain FROM domain WHERE domain='
virtual.com
--

When I'm sending it from localhost, it queries OK, though:

--
080826 19:01:10 179 Connect postfixxxxxxxxx on postfix
                    179 Query SELECT goto FROM alias WHERE address='
defvirtual.com'
                    176 Query SELECT goto FROM alias WHERE address='
virtual.com'
                    177 Query SELECT domain FROM domain WHERE domain='
virtual.com'
                    180 Connect postfixxxxxxxxxxx on postfix
                    180 Query SELECT maildir FROM mailbox WHERE
username='defdomain.com'
--

Here's my configuration:

--
rootfresh:~# postconf -n
append_dot_mydomain = yes
biff = no
bounce_queue_lifetime = 2
config_directory = /etc/postfix
default_destination_concurrency_limit = 40
default_process_limit = 500
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
maximal_queue_lifetime = 2
minimal_backoff_time = 900
mydestination = xxxxxxxxxx, localhost
myhostname = xxxxxxxxxx
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
qmgr_message_recipient_limit = 50000
queue_run_delay = 900
recipient_delimiter = +
relayhost =
smtp_connect_timeout = 4
smtp_helo_timeout = 4
smtpd_banner = $myhostname ESMTP
smtpd_timeout = 60
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:1001
virtual_mailbox_base = /home/virtual
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 51200000
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 1001
virtual_transport = virtual
virtual_uid_maps = static:1001

rootfresh:~# cat /etc/postfix/mysql_virtual_alias_maps.cf
user = postfix
password = xxxxx
hosts = yyyyyy
table = alias
dbname = postfix
select_field = goto
where_field = address

rootfresh:~# cat /etc/postfix/mysql_virtual_domains_maps.cf
user = postfix
password = xxxxxxx
hosts = yyyyyyyyy
dbname = postfix
table = domain
select_field = domain
where_field = domain

rootfresh:~# cat /etc/postfix/mysql_virtual_mailbox_maps.cf
user = postfix
password = xxxxxxx
hosts = yyyyyyyy
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
--

Postfix version 2.3.8-2, Debian 4.

Thanks in advance for any tips !

Best regards,
Pawel