OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Same address delivering to multiple mailboxes

From: Sean Holdsworth (shhob.cx)
Date: Mon Nov 23 2009 - 06:18:09 CST


On 21 Nov 2009, at 10:58, mouss wrote:

> Sean Holdsworth a écrit :
>> [snip]
>>
>> If I allow that address rewite then mail for p1domain or p2domain will
>> get
>> sent on to the MTA with an envelope recipient address of catchalldomain
>> rather than their original recipient address.
>>
>> I've tried various work arounds without success. The one that seems most
>> natural, but which DOES NOT WORK, is the following:
>>
>> virtual_aliases:
>> p1domain domain p1domain
>> p2domain domain p2domain
>>
>> This results in mail for either address only arriving in their own mailbox.
>>
>> Is there another approach to this that I'm missing?
>>
>
> you want smtp_generic_maps.

Sorry but having reread the address rewrite documentation several times, I don't understand how smtp_generic maps would help in this case. To restate the problem, I'm trying to figure out a way of doing the following deliveries:

domain => smtp:[MTA]
p1domain => B, smtp:[MTA]
p2domain => C, smtp:[MTA]

(where domain is a virtual domain, B and C are virtual mailboxes and MTA is another Postfix server. I have the following configuration in place:

virtual_alias_maps = hash:virtual_aliases
virtual_mailbox_maps = hash:virtual_mailbox_recipients
transport_maps = hash:transport

virtual_aliases:
p1domain p1domain catchalldomain
p2domain p2domain catchalldomain

virtual_mailbox_recipients:
domain OK
p1domain B
p2domain C

transport:
domain smtp:[MTA]
p1domain virtual
p2domain virtual

I think I understand the purpose of smtp_generic_maps to do rewrite of both envelope and header addresses for smtp deliveries, but I can't see how that would help in this case. What would I have as my LHS in such a mapping? If I add the following configuration:

smtp_generic_maps = hash:generic_aliases

what would my generic_aliases file look like? If I have catchalldomain as my LHS then I've lost the information about which of p1domain or p2domain that I need to rewrite to, or am I missing the point?

Alternatively I've played around with using the domain format in the virtual_aliases and using that as the RHS of the generic_aliases file, but that results in just a single virtual mailbox delivery and nothing being sent over the smtp transport.

For completeness, here's the output of postconf -n

address_verify_map = btree:/var/mta/verify
address_verify_sender = postmastermydomain.net
address_verify_transport_maps = hash:/etc/postfix/verify_transport
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
default_process_limit = 500
disable_vrfy_command = yes
header_checks = regexp:/etc/postfix/header_checks
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
maps_rbl_reject_code = 554
message_size_limit = 40960000
myhostname = mx.mydomain.net
mynetworks = 127.0.0.0/8 10.0.1.0/24
readme_directory = /usr/share/doc/postfix
relay_domains = /etc/postfix/relay_domains
relayhost =
smtp_generic_maps = hash:/etc/postfix/generic_maps
smtpd_banner = $myhostname ESMTP
smtpd_client_connection_rate_limit = 60
smtpd_client_message_rate_limit = 60
smtpd_client_recipient_rate_limit = 60
smtpd_client_restrictions = permit_mynetworks check_recipient_access hash:/etc/postfix/nofilter_domains reject_rbl_client bl.spamcop.net reject_rbl_client sbl-xbl.spamhaus.org check_client_access hash:/etc/postfix/known_clients check_client_access hash:/etc/postfix/blacklist check_client_access hash:/etc/postfix/whitelist reject_unknown_reverse_client_hostname check_client_access cidr:/etc/postfix/spam_ranges check_client_access regexp:/etc/postfix/spam_domains
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_discard_ehlo_keywords = silent-discard, dsn
smtpd_error_sleep_time = 10s
smtpd_helo_required = yes
smtpd_helo_restrictions = check_recipient_access hash:/etc/postfix/nofilter_domains reject_invalid_hostname check_helo_access regexp:/etc/postfix/helo_restrictions reject_non_fqdn_hostname
smtpd_recipient_restrictions = reject_non_fqdn_recipient reject_invalid_hostname reject_unauth_destination check_recipient_access hash:/etc/postfix/recipient_restrictions check_recipient_access hash:/etc/postfix/recipient_access check_recipient_access hash:/etc/postfix/fallback_domain_access check_recipient_access hash:/etc/postfix/nofilter_domains check_recipient_access hash:/etc/postfix/spammed_addresses check_policy_service inet:192.168.25.1:60000
smtpd_restriction_classes = check_if_from_hsbc.co.uk check_if_from_hsbc.com check_if_from_halifax check_if_from_lloydstsb.co.uk check_if_from_lloydstsb.com check_if_from_barclays.co.uk check_if_from_abbey check_if_from_citibank.co.uk check_if_from_paypal check_if_from_egg check_if_from_natwest check_if_from_rbs check_if_from_cooperative check_if_from_alliance most_spammed_addresses
smtpd_sender_restrictions = reject_non_fqdn_sender check_recipient_access hash:/etc/postfix/nofilter_domains reject_unknown_sender_domain check_sender_access hash:/etc/postfix/sender_restrictions check_sender_mx_access cidr:/etc/postfix/bogon_networks.cidr check_client_access hash:/etc/postfix/broken_dns_clients check_client_access regexp:/etc/postfix/forwarders check_sender_access hash:/etc/postfix/sender_access check_sender_access regexp:/etc/postfix/spammer_addresses
smtpd_soft_error_limit = 2
strict_rfc821_envelopes = yes
transport_maps = hash:/etc/postfix/transport
unverified_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual_aliases
virtual_gid_maps = static:109
virtual_mailbox_base = /raid/popboxes
virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox_recipients
virtual_uid_maps = static:1010