I'm in the process of re-setting up a server of mine due to a serious harddrive crash, and I'm currently banging my head against the wall trying to set up Postfix with MySQL virtual users and aliases on Debian (the previous version of this server was on Gentoo).
Thankful for doing backups, I'm re-using the MySQL database for e-mail users and aliases, and I'm following
this tutorial to a certain degree (of course, adjusting for my database and directory structure), and have just finished page 2 of that tutorial. I'm stuck doing the tutorial because I didn't have a backup of the entire /etc (only the Apache and Bind configs were backed up there), and the entire harddisk was wiped in the crash.
However, I'm stuck when testing the sending and receiving of mail. POP3 works perfectly, so does sending e-mail to a mailbox user, as well as authenticated e-mail. Sending e-mail from an outside server to an alias user on the system doesn't work, and it just bounces back after the e-mail itself has been accepted. This is exactly where I'm stuck.
I've temporarily enabled logging on MySQL so I can see what queries are being made, and for some reason, Postfix seems to switch the sender and the recipient when looking up the alias table when the queue is run -- that is, after the message has been queued.
Here are the query reactions to each SMTP command (EHLO and QUIT are omitted, since they didn't produce any reactions in MySQL):
Quote:
Code:
091104 15:05:06 432 Connect postfix@localhost on root_mail
432 Query SELECT `transport` FROM `transport` WHERE `domain`='*'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='*'
433 Connect postfix@localhost on root_mail
433 Query SELECT `domain` AS virtual FROM `domain` WHERE `domain`='example.com' AND `active`=1
432 Query SELECT `transport` FROM `transport` WHERE `domain`='sender@example.com'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='example.com'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='.com'
Quote:
Code:
091104 15:05:59 433 Query SELECT `domain` AS virtual FROM `domain` WHERE `domain`='example.org' AND `active`=1
432 Query SELECT `transport` FROM `transport` WHERE `domain`='recipient@example.org'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='example.org'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='.org'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='*'
434 Connect postfix@localhost on root_mail
434 Query SELECT `goto` FROM `alias` WHERE `address`='recipient@example.org' AND `active`=1
Quote:
DATA
(after sending data)
Code:
091104 15:06:54 433 Query SELECT `domain` AS virtual FROM `domain` WHERE `domain`='example.org' AND `active`=1
432 Query SELECT `transport` FROM `transport` WHERE `domain`='recipient@example.org'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='example.org'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='.org'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='*'
435 Connect postfix@localhost on root_mail
435 Query SELECT `maildir` FROM `mailbox` WHERE `username`='recipient@example.org' AND `active`=1
435 Query SELECT `maildir` FROM `mailbox` WHERE `username`='@example.org' AND `active`=1
434 Query SELECT `goto` FROM `alias` WHERE `address`='sender@example.com' AND `active`=1
436 Connect postfix@localhost on root_mail
436 Query SELECT `username` as email FROM `mailbox` WHERE `username`='sender@example.com' AND `active`=1
434 Query SELECT `goto` FROM `alias` WHERE `address`='@example.com' AND `active`=1
436 Query SELECT `username` as email FROM `mailbox` WHERE `username`='@example.com' AND `active`=1
091104 15:06:55 433 Query SELECT `domain` AS virtual FROM `domain` WHERE `domain`='example.com' AND `active`=1
432 Query SELECT `transport` FROM `transport` WHERE `domain`='sender@example.com'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='example.com'
432 Query SELECT `transport` FROM `transport` WHERE `domain`='.com'
The "recipient@example.org" exists on the mail system as an alias, the "sender@example.com" does not, and the "transport" table is emtpy.
Here is my main.cf:
Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = mx3.betadome.net Betadome Digital Media support@betadome.com
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = /usr/share/doc/postfix
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mx3.betadome.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mx3.betadome.net, nansen.betadome.net, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 52428800
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
smtpd_helo_required = yes
strict_rfc821_envelopes = no
unknown_local_recipient_reject_code = 450
message_size_limit = 50000000
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /space/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_hostname,
reject_rbl_client bl.spamcop.net,
reject_rbl_client zen.spamhaus.org
reject_unauth_destination
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
receive_override_options = no_address_mappings
check_recipient_mx_access = pcre:/etc/postfix/sender_mx_access
check_recipient_access = pcre:/etc/postfix/sender_domains
smtpd_discard_ehlo_keywords = silent-discard, dsn
virtual_alias_domains =
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
Do let me know if you need to see any of the other config files.
I know this server technically isn't a Linode server, it
is supposed to work together with my two Linodes in Dallas when it's back up. Hopefully, some guru here knows what could be wrong.
Thanks in advance for any help.