Hello all,

The mysql_table does lookups in the form of key/value pairs, so if I want match 
subdomains only for some domains, like the ones in the following mysql table:



> select * from transport;
+--------------+----------------+
| lhs       | rhs        |
+--------------+----------------+
| .example.bar | smtp:relay.bar |
| example.bar  | smtp:relay.bar |
| example.foo  | smtp:relay.foo |
+--------------+----------------+
3 rows in set (0.00 sec)


with "query   = SELECT rhs FROM transport WHERE lhs = '%d'" it only works for 
exact matches and fails with subdomain matches:

# postmap  -q u...@example.foo mysql:/etc/postfix/mysql-transport.conf 
smtp:relay.foo
# postmap  -q u...@example.bar mysql:/etc/postfix/mysql-transport.conf 
smtp:relay.bar
# postmap  -q u...@sub.example.bar mysql:/etc/postfix/mysql-transport.conf 
# 

I have tried, without much luck, configure a query template with sql wildcards 
"query = SELECT rhs FROM transport WHERE lhs like '%%%d'" (afaik %% resolve to 
a literal %) but it seems fail to do match the subdomain.

is it possible to use the mysql_table with transport rules for (some) 
subdomains as does the hash table ??


# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd 
$daemon_directory/$process_name $process_id & sleep 5
enable_long_queue_ids = yes
html_directory = no
inet_interfaces = localhost, 10.180.143.100
inet_protocols = ipv4
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
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
relay_domains = example.foo, example.bar
relay_recipient_maps = ldap:/etc/postfix/check_relay_recipient_foo.cf, 
ldap:/etc/postfix/check_relay_recipient_bar.cf
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_mechanism_filter = plain, login
smtpd_relay_restrictions = permit_mynetworks, check_client_access 
cidr:/etc/postfix/relay_ips.cidr, reject_sender_login_mismatch, 
permit_sasl_authenticated, reject
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sender_login_maps = ldap:/etc/postfix/check_login_sender.cf
transport_maps = mysql:/etc/postfix/mysql-transport.conf, 
hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550

Reply via email to