Hello
I already asked in the IRC, but apart from recommendations reading the mailing lists, nobody could help me. I read all postfix-update related articles but non of them seemed to match or resolve my problem:
Everything works fine, apart from one host, which we are doing MX backups for (backupdomain.com):
Sep 22 12:18:58 homer postfix/smtp[18784]: 6BD7B1189E4: to=user@backupdomain.com, relay=none, delay=53, status=bounced (mail for backupdomain.com loops back to myself) Sep 22 12:18:58 homer postfix/cleanup[18791]: B3DD6118A13: message-id=20060922111858.B3DD6118A13@mail.mydomain.com Sep 22 12:18:58 homer postfix/qmgr[18776]: B3DD6118A13: from=<>, size=2758, nrcpt=1 (queue active) Sep 22 12:18:58 homer postfix/qmgr[18776]: 6BD7B1189E4: removed
The backup MX in our domain record for the backupdomain has priority 20, we 10.
dig MX mydomain.com
mydomain.com. 86400 IN MX 20 mail.backupdomain.com. mydomain.com. 86400 IN MX 10 mail.mydomain.com.
postfix's transport_map is configured to use mysql. a
postmap -q backupdomain.com mysql:/etc/postfix/sql/transport returns: smtp:mail.backupdomain.com
so it was forwarding a message to that domain. That worked fine.
After the postfix upgrade, this stopped working. The target the error, I removed the smtp:mail.backupdomain.com entry from the mysql table and also removed the MX entry for the backupdomain, which I was told, could cause problems as well.
It still says: mail for backupdomain.com loops back to myself.
So, I am wondering, where postfix gets this information from? Can you give me some further advise?
thx, thorsten.
David Hrbáč wrote:
# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases biff = no command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix debug_peer_level = 2 default_destination_concurrency_limit = 50 default_process_limit = 30 delay_warning_time = 4h disable_vrfy_command = yes fallback_transport = virtual home_mailbox = Maildir/ html_directory = no in_flow_delay = 1s inet_interfaces = $myhostname, localhost local_destination_concurrency_limit = 5 local_recipient_maps = unix:passwd.byname $alias_maps mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man maximal_queue_lifetime = 3d message_size_limit = 15240000 mydestination = $myhostname, localhost.$mydomain, $mydomain mydomain = mydomain.com myhostname = mail.mydomain.com mynetworks = 127.0.0.0/8 <MYOFFICENETWORKIP> newaliases_path = /usr/bin/newaliases.postfix owner_request_special = no proxy_interfaces = <BACKUPMXIP> queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.2.10/README_FILES relay_domains = $transport_maps sample_directory = /usr/share/doc/postfix-2.2.10/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_helo_required = yes smtpd_recipient_restrictions = permit_mynetworks, reject_rbl_client sbl-xbl.spamhaus.org, reject_unauth_destination, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, reject_unknown_recipient_domain, reject_unauth_destination soft_bounce = no transport_maps = mysql:/etc/postfix/sql/transport unknown_local_recipient_reject_code = 550 virtual_gid_maps = static:507 virtual_mailbox_base = /server/vmail virtual_mailbox_maps = mysql:/etc/postfix/sql/vmailbox virtual_minimum_uid = 500 virtual_transport = $transport_maps virtual_uid_maps = static:507
master.cf
smtp inet n - n - 25 smtpd pickup fifo n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr fifo n - n 300 1 qmgr rewrite unix - - n - - trivial-rewrite bounce unix - - n - 0 bounce defer unix - - n - 0 bounce trace unix - - n - 0 bounce verify unix - - n - 1 verify flush unix n - n 1000? 0 flush proxymap unix - - n - - proxymap smtp unix - - n - 10 smtp relay unix - - n - - smtp # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - n - - showq error unix - - n - - error local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} old-cyrus unix - n n - - pipe flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user} # Also specify in main.cf: cyrus_destination_recipient_limit=1 cyrus unix - n n - - pipe user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user} uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) 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=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient scache unix - - n - 1 scache
my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 port=3306 # # Local changes. /JRG # max_connections = 125 thread_cache = 25 thread_concurrency = 4 key_buffer = 64M table_cache = 1024 sort_buffer_size = 2M read_buffer_size = 1M join_buffer_size = 1M query_cache_limit = 2M query_cache_size = 32M max_allowed_packet = 8M
# # Set buffer pool size to 50-80% of your computer's memory set-variable = innodb_buffer_pool_size=64M set-variable = innodb_additional_mem_pool_size=16M # # Set the log file size to about 25% of the buffer pool size set-variable = innodb_log_file_size=5M set-variable = innodb_log_buffer_size=8M
[mysql.server] user=mysql basedir=/var/lib set-variable = thread_concurrent=4 set-variable = wait_timeout=30 set-variable = thread_cache_size=25 port=3306
[mysqld_safe] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid nice = -5 open_files_limit = 8192
sorry. here they are.
transport_maps = mysql:/etc/postfix/sql/transport
# cat transport user = vmail password = <hidden> dbname = vmail table = domains select_field = transport where_field = domain hosts = localhost
virtual_mailbox_maps = mysql:/etc/postfix/sql/vmailbox
# cat vmailbox user = vmail password = <hidden> dbname = vmail table = passwd select_field = maildir where_field = id hosts = localhost
thorsten napsal(a):
Well, I do not understand it now.
domain.tld has: mx 20 some_server2 mx 10 some_server1
If we are talking about postfix configuration on backup server - some_server1, it has to forward messages to some_server1, so postmap -q domain.tld mysql:/etc/postfix/sql/transport must return smtp:some_server1 or smtp:[some_server1_ip_address]. David
David Hrbáč wrote:
The problem occurs on domain.tld == some_server1, which is a mail server. domain.tld does backups for some_server2.tld and vice versa.
so, domain.tld has: mx 20 some_server2.tld (so, they do backup in case our server is down) mx 10 domain.tld (this server. should deliver mails for domain.tld)
if some_server2.tld (which for we are doing mx backup as well) is down, our system keeps mails but does not deliver them.
BUT: (and that's the problem)
if one of us here on domain.tld wants to send an email to some_server2.tld, then this problem with 'loops back to me' occurs (since centos update).
so IMO, it is correct having
postmap -q some_server2.tld mysql:/etc/postfix/sql/transport returning smtp:some_server2.tld
and
postmap -q domain.tld mysql:/etc/postfix/sql/transport returning maildrop:
so, if mails for some_server2.tld are arriving at domain.tld, it tries to forward them via smtp to some_server2.tld which should be done via:
smtp inet n - n - 25 smtpd (from master.cf), AFAIK
and EVEN, if I REMOVE the mysql entry for smtp:some_server2.tld, so it should appear to postfix like every other domain in the world, postfix finds a loop back to itself.
And that's, what I don't understand.
This configuration was already working and productive.
thorsten.
thorsten napsal(a):
OK, so let's sum it up.
Let's have domain1.tld and domain2.tld.
domain1.tld has: 20 server.domain2.tld 10 server.domain1.tld
domain2.tld has: 20 server.domain1.tld 10 server.domain2.tld
on server.domain1.tld we need to have: domain1.tld within virtual domains or local domain domain2.tld within transport
on server.domain2.tld we need to have: domain2.tld within virtual domains or local domain domain1.tld within transport
David
thorsten napsal(a):
So what does return postmap -q domain2.tld mysql:/etc/postfix/sql/transport on server.domain1.tld? what does return postmap -q domain1.tld mysql:/etc/postfix/sql/transport on server.domain2.tld?
I guess you should also really perform name resolution on both machines, as mentioned in one reply. I think that you should also correct transport_maps vs virtual_transport, both use the same sql statements, aka gets the very same values... I guess that's the issue.
We use slightly different config: alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases 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 mynetworks = 127.0.0.0/8, 193.165.161.232/29, 194.212.173.165 newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.2.10/README_FILES relay_domains = mysql:/etc/postfix/mysql_virtual_transport_maps.cf sample_directory = /usr/share/doc/postfix-2.2.10/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop transport_maps = mysql:/etc/postfix/mysql_virtual_transport_maps.cf unknown_local_recipient_reject_code = 550 virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_gid_maps = static:1001 virtual_mailbox_base = /pudu/mails 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
Regards, David
David Hrbáč wrote:
That brings something to mind that I ran up against a while back. In your transport map the destination needs to be enclosed in square brackets. If not, then any MX records for it are used to determine the destination. On server.domain1.tld, the map entry for domain2.tld needs to contain 'smtp:[server.domain2.tld]' instead of 'smtp:server.domain2.tld'. The brackets tell Postfix (and Sendmail, for that matter) NOT to look up the MX records.
Hope that helps!