Linux – Postfix-PostfixAdmin-Dovecot: Set up for multiple Domains

domainsdovecotlinuxpostfix

This is as far as i know a question which is sometimes asked but noone has an answer.
(That is how I expirenced it...)

Yes, i've seen this kind of question on serverfault, but never in this way (postfixadmin)

I have 2 Domains (domain1.de and domain2.de) and 1 Mailserver (mailserver.domain1.de).
SPF, PTR/ReverseDNS, DKIM, DMARC Records are set for both domains.
Until a few days ago i only had one domain (domain1.de) and the setup worked.

Now i have a second one and i have used postfixAdmin to add it to the Postfix MTA.
I got the following error and decided to use the virtual_alias to send any mail going to …@domain2.de to admin@domain1.de(This way i do get important emails even if the system is currently not good):

Jun 12 17:34:06 441335-696 postfix/smtpd[18907]: NOQUEUE: reject:
RCPT from xxxxxx-xxx.pph-server.de[91.134.xxx.xxx]:
553 5.7.1 'user1@domain2.de': Sender address rejected:
not owned by user admin@domain1.de;
from='user1@domain2.de' to='xxx.xxx@gmail.com'
proto=ESMTP helo='mails.domain1.de'

mails.domain1.de is Roundcube

Now to my setup again:

/etc/postfix:

main.cf
master.cf
mysql-virtual-alias-maps.cf
mysql-vitrual-domains-maps.cf
mysql-vitrual-mailbox-maps.cf
mysql-virtual-alias-domain.cf
mysql-sender-login-maps.cf
...

postconf -n:

alias_database = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
inet_interfaces = all
local_transport = virtual
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 6
mydestination = mailserver.domain1.de, localhost.pph-server.de, localhost, localhost.localdomain
myhostname = mailserver.domain1.de
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = local:/opendkim/opendkim.sock
policyd-spf_time_limit = 3600
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 $smtpd_sender_login_maps
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_cert_file = /etc/letsencrypt/live/***.de/fullchain.pem
smtp_tls_key_file = /etc/letsencrypt/live/***.de/privkey.pem
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_milters = local:/opendkim/opendkim.sock
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination check_policy_service unix:private/policyd-spf
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/auth_dovecot
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql-sender-login-maps.cf
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch reject_unknown_sender_domain
smtpd_tls_cert_file = /etc/letsencrypt/live/***.de/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/***.de/privkey.pem
smtpd_tls_loglevel = 3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_high_cipherlist = EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
tls_ssl_options = NO_COMPRESSION
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_gid_maps = static:6000
virtual_mailbox_base = /var/vmail/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual-domains-maps.cf
virtual_mailbox_limit = 0
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_minimum_uid = 104
virtual_transport = dovecot
virtual_uid_maps = static:6000

/etc/postfix/mysql-virtual-alias-maps.cf(Without Login data ;D):

query = SELECT goto FROM alias WHERE address='%s' AND active = '1'
#Output = user@domain2.de

/etc/postfix/mysql-virtual-domains-maps.cf(…):

query = SELECT domain FROM domain WHERE domain='%s' AND active = '1'
#Output = domain2.de

/etc/postfix/mysql-virtual-mailbox-maps.cf(…):

query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'
#Output = domain2.de/user/

/etc/postfix/mysql-virtual-alias-domains.cf(…):

query = SELECT alias_domain FROM alias_domain WHERE alias_domain='%s' AND active = '1'
#Output = domain2.de
#Btw. i'm not sure if this query is correct...

/etc/postfix/mysql-sender-login-maps.cf(…):

query = SELECT username AS allowedUser FROM mailbox WHERE username="%s" AND active = 1 UNION SELECT goto FROM alias WHERE address="%s" AND active = 1
#Output = user@domain.de

If you need more information, just ask for it ;D

Thanks in advance.

Luke Roeper

Best Answer

Lösung/Solution:

https://serversupportforum.de/forum/mail/60287-postfix-dovecot-postfixadmin-2-domains-sender-address-reject-not-owned-admin.html

Would be great to see more effort for concrete questions on serverfault...