0

Let me explain what I'm doing and what I want to reach from this postfix multiple instances

I have domain for example "example1.com" and "mail.example1.com" for mail server and has proper DNS MX records and everything is fine, Now I have another domain "example2.com" and "mail.example2.com" for mail server, Each time I send mail from server the mail went to clients SPAM folder and the smtp.mailfrom shows "mail.example1.com"& IP: 1.1.1.1 (for example) at the end I found the newer domain in websites mails blacklist databases, So I searched for a solution but at the end it appears that I must use 2 myhostname by create additional postfix instance to accomplish this and for complete isolation.

I created another instance called "postfix-secondary" via this command:

postmulti -e init

Then created it by this command:

postmulti -I postfix-secondary -e create

After that mad it run via this:

postmulti -i postfix-secondary -p start

The problem now is the emails still forced to go through "mail.example1.com" even with disabled the default mail server and I see it kept gathered in the default queue

I will list the configs now (example1.com) /etc/postfix/main.cf:

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.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

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination check_sender_access hash:/etc/postfix/mail_blacklist
myhostname = mail.example1.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.example1.com, example1.com, localhost.example1.com, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = 1.1.1.1
inet_protocols = ipv4

smtpd_recipient_restrictions = reject_invalid_hostname,
        reject_unknown_recipient_domain,
        reject_unauth_destination,
        reject_invalid_hostname,
        reject_non_fqdn_hostname,
        reject_non_fqdn_sender,
        reject_non_fqdn_recipient,
        reject_unknown_sender_domain,
        reject_unknown_recipient_domain,
        reject_rbl_client sbl.spamhaus.org,
        reject_rbl_client cbl.abuseat.org,
        reject_rbl_client dul.dnsbl.sorbs.net,
        permit

smtpd_helo_restrictions = reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname,
        reject_non_fqdn_hostname,
        reject_invalid_hostname,
        reject_unknown_helo_hostname


default_process_limit = 100
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 30
queue_minfree = 20971520
header_size_limit = 51200
message_size_limit = 10485760
smtpd_recipient_limit = 100
disable_vrfy_command= yes
smtpd_helo_required = yes
smtpd_delay_reject = yes
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20

(example1.com) /etc/postfix/master.cf (default)

smtp      inet  n       -       -       -       -       smtpd

(example2.com) /etc/postfix-secondary/main.cf

unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5

readme_directory = no
inet_protocols = ipv4
#master_service_disable = inet
authorized_submit_users = 
queue_directory = /var/spool/postfix-secondary
multi_instance_name = postfix-secondary

myhostname = mail.example2.com
inet_interfaces = 2.2.2.2
multi_instance_enable = yes
mydestination = mail.example2.com, example2.com, localhost.example2.com, localhost



smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination check_sender_access hash:/etc/postfix/mail_blacklist
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
relayhost = 
mailbox_size_limit = 0
recipient_delimiter = +
#smtp_bind_address = 0.0.0.0


smtpd_recipient_restrictions = reject_invalid_hostname,
        reject_unknown_recipient_domain,
        reject_unauth_destination,
        reject_invalid_hostname,
        reject_non_fqdn_hostname,
        reject_non_fqdn_sender,
        reject_non_fqdn_recipient,
        reject_unknown_sender_domain,
        reject_unknown_recipient_domain,
        reject_rbl_client sbl.spamhaus.org,
        reject_rbl_client cbl.abuseat.org,
        reject_rbl_client dul.dnsbl.sorbs.net,
        permit

smtpd_helo_restrictions = reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname,
        reject_non_fqdn_hostname,
        reject_invalid_hostname,
        reject_unknown_helo_hostname


default_process_limit = 100
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 30
queue_minfree = 20971520
header_size_limit = 51200
message_size_limit = 10485760
smtpd_recipient_limit = 100
disable_vrfy_command= yes
smtpd_helo_required = yes
smtpd_delay_reject = yes
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20



append_dot_mydomain = no


smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.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

(example2.com) /etc/postfix-secondary/master.cf (default)

smtp      inet  n       -       -       -       -       smtpd

The DNS records for (example1.com) is fine and same as DNS for (example2.com) execpt different domain & IP:

example2.com.   IN  MX  10 mail.example2.com.
mail.example2.com.          IN      A  2.2.2.2
example2.      IN TXT     "v=spf1 mx ip4:2.2.2.2/32 ~all"
_dmarc.example2.com.    IN  TXT "v=DMARC1; pct=100; p=none; adkim=r; aspf=r"

Thanks in advance

1 Answer 1

0

It's completely normal to have a mail server e.g. mail.example.com as an outgoing MTA for a different domain e.g. example.net. As a matter of facts this is the usual way; service providers hosting hundreads of domains doesn't have a new Postfix instance for every single domain.

Forget what you are doing and deploy Sender Policy Framework (SPF), instead. Let the receiving MTAs know that mail.example.com is allowed to send mail for example.net, or even better, refer to the server with its IP address i.e. use the ip4 mechanism.

6
  • Thanks for reply, But I really need to hide the first domain (example1.com) from the mails info of (example2.com) mails. I need complete isolation. So if anyone try to know the sender he only gets (mail.example2.com) Thanks
    – Dante
    Sep 3, 2017 at 8:22
  • I tried your method when I gave up on the idea of my last comment here, But unfortunately My mails still go to SPAM folder.
    – Dante
    Sep 5, 2017 at 3:42
  • See the full headers of the message flagged as spam. There should be hints of the reason. Sep 5, 2017 at 4:02
  • Can you check the message source, it can't fit here so I posted it in pastebin: pastebin.com/0ziZ07Kj Edit: 1.1.1.1 for main mail server -which is working fine- mail.example1.com In the 2nd domain (example2.com) DNS records: TXT @ v=spf1 mx ip4:1.1.1.1/32 -all TXT _dmarc v=DMARC1; p=none A mail 1.1.1.1 MX example2 mail.example1.com
    – Dante
    Sep 5, 2017 at 4:53
  • According to this the SPF record hasn't yet been used, none. Probably there's still DNS cache that hasn't expired. Sep 5, 2017 at 4:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .