Topic: Sender dependent relay hosts with both STARTTLS and SMTPS transports
==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version: Ubuntu 16.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No.
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
I'm trying to set up sender dependent relay host, and use multiple identities in RoundCube. With setup (A) below, I was able to send mail as "user1@host1.tld1" (via port 587 / STARTTLS) without problem, but sending as "user2@host2.tld2" (via port 465 / SMTPS) gave error in /var/log/mail.log: postfix/smtp[32530]: 13CC3180E00: to=<user3@host3.tld3>, relay=smtp.mail.host2.tld2 [123.456.7.89]:465, delay=1883, delays=1583/0.05/300/0, dsn=4.4.2, status=deferred (conversation with smtp.mail.host2.tld2 [123.456.7.89] timed out while receiving the initial server greeting).
With setup (B) instead, sending as "user2@host2.tld2" worked OK, but sending as "user1@host1.tld1" gave error: postfix/smtp[1181]: A0710180E00: to=<user3@host3.tld3>, relay=smtp.host1.tld1[98.76.54.32]:587, delay=0.31, delays=0.01/0.01/0.29/0, dsn=4.7.5, status=deferred (Cannot start TLS: handshake failure)
I'm out of my wits now, and would really appreciate some pointers to what to try next. Thanks very much!
====
My setup (A) is:
/etc/postfix/main.cf:
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_security_options = noanonymous
smtp_sender_dependent_authentication = yes
/etc/postfix/sasl_password:
user1@host1.tld1 user1@host1.tld1:passwd1
user2@host2.tld2 user2:passwd2
/etc/postfix/master.cf:
relay-smtps unix - - n - - smtp
# Client-side SMTPS requires 'encrypt' or stronger.
-o smtp_tls_security_level=encrypt
-o smtp_tls_wrappermode=yes
I then added the two domains to vmail.sender_relayhost:
use vmail;
INSERT INTO sender_relayhost (account, relayhost) VALUES ('@host1.tld1', '[smtp.host1.tld1]:587');
INSERT INTO sender_relayhost (account, relayhost) VALUES ('@host2.tld2', '[smtp.mail.host2.tld2]:465');
And set a different transport for host2:
use vmail;
INSERT INTO domain (domain, transport, active, created) VALUES ('smtp.mail.host2.tld2', 'relay-smtps:[smtp.mail.host2.tld2]:465', 1, NOW());
====
Setup (B):
/etc/postfix/main.cf: stuff in (A) +
smtp_tls_security_level=encrypt
smtp_tls_wrappermode=yes
/etc/postfix/sasl_password: same as (A)
/etc/postfix/master.cf: without "relay-smtps" and add the following lines after "smtp-amavis" and after "127.0.0.1:10025":
-o smtp_tls_security_level=none
-o smtp_tls_wrappermode=no
vmail.sender_relayhost: same as (A)
vmail.domain: without the row in (A) for host2.tld2
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.