# Problem with TLS/SSL

**URL:** <https://community.ciphermail.com/t/problem-with-tls-ssl/597>\
**Category:** Gateway\
**Created:** [February 5, 2018, 12:51pm UTC](https://community.ciphermail.com/t/problem-with-tls-ssl/597 "2018-02-05T12:51:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Gunther](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@Stefan\_Gunther](https://community.ciphermail.com/u/Stefan_Gunther)\
**Post date:** [February 5, 2018, 12:51pm UTC](https://community.ciphermail.com/t/problem-with-tls-ssl/597/1 "2018-02-05T12:51:17Z")

</div>

Hello,

we have setup a server for a client (domain: client.ag), where the external MX requires a connection on port 465 with SSL/TLS.  
Therefore we added the following lines to main.cf

relayhost = smtp.mailbox.org:465  
# SMTPS wrappermode (TCP port 465) requires setting "smtp\_tls\_wrappermode = yes", and "smtp\_tls\_security\_level = encrypt" (or stronger)  
smtp\_tls\_wrappermode = yes  
smtp\_tls\_security\_level = encrypt

With these setting postfix is able to connect to the external server, but internal connections fail:

Feb 5 13:34:56 ciphermail postfix/qmgr[6260]: 0D70040AA5: from=\<edifact(a)client.ag\>, size=601, nrcpt=1 (queue active)  
Feb 5 13:34:56 ciphermail postfix/smtp[6269]: SSL\_connect error to 127.0.0.1[127.0.0.1]:10025: -1  
Feb 5 13:34:56 ciphermail postfix/smtp[6269]: warning: TLS library problem: error:140770FC:SSL routines:SSL23\_GET\_SERVER\_HELLO:unknown protocol:s23\_clnt.c:794:  
Feb 5 13:34:56 ciphermail postfix/smtp[6269]: 0D70040AA5: to=\<edifact(a)web.de\>, relay=127.0.0.1[127.0.0.1]:10025, delay=0.14, delays=0.12/0.01/0/0, dsn=4.7.5, status=deferred (Cannot start TLS: handshake failure)

This is the current main.cf

djigzo\_myhostname = ciphermail.client.ag  
djigzo\_mydestination = client.ag  
djigzo\_mynetworks = 127.0.0.1/32  
djigzo\_relayhost = smtp.mailbox.org  
djigzo\_relayhost\_mx\_lookup =  
djigzo\_relayhost\_port = 465  
djigzo\_relay\_domains =  
djigzo\_before\_filter\_message\_size\_limit = 102400000  
djigzo\_after\_filter\_message\_size\_limit = 102400000  
djigzo\_mailbox\_size\_limit = 102400000  
djigzo\_smtp\_helo\_name =  
djigzo\_relay\_transport\_host = 127.0.0.1  
djigzo\_relay\_transport\_host\_mx\_lookup =  
djigzo\_relay\_transport\_host\_port = 25  
djigzo\_reject\_unverified\_recipient =  
djigzo\_unverified\_recipient\_reject\_code = 450  
djigzo\_parent\_domain\_matches\_subdomains =  
djigzo\_rbl\_clients =  
myhostname = ${djigzo\_myhostname}  
mydestination = ciphermail, $myhostname, ubuntu-2gb-nbg1-dc3-1, localhost.localdomain, localhost, ${djigzo\_mydestination}  
mynetworks = 127.0.0.0/8, ${djigzo\_mynetworks}  
relay\_domains = ${djigzo\_relay\_domains}  
parent\_domain\_matches\_subdomains = ${djigzo\_parent\_domain\_matches\_subdomains}  
smtp\_helo\_name = ${djigzo\_smtp\_helo\_name?$djigzo\_smtp\_helo\_name}${djigzo\_smtp\_helo\_name:${myhostname}}  
relay\_transport = relay${djigzo\_relay\_transport\_host?:${djigzo\_relay\_transport\_host\_mx\_lookup:[}${djigzo\_relay\_transport\_host}${djigzo\_relay\_transport\_host\_mx\_lookup:]}:${djigzo\_relay\_transport\_host\_port}}  
relayhost = ${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?[}}${djigzo\_relayhost}${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?]}}${djigzo\_relayhost?:${djigzo\_relayhost\_port}}  
smtpd\_recipient\_restrictions = permit\_mynetworks permit\_sasl\_authenticated reject\_unauth\_destination reject\_invalid\_hostname reject\_unknown\_sender\_domain reject\_unknown\_recipient\_domain  
&nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_rbl\_clients}  
&nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_reject\_unverified\_recipient? reject\_unverified\_recipient}  
smtpd\_discard\_ehlo\_keywords = silent-discard VRFY ETRN DSN  
unverified\_recipient\_reject\_code = ${djigzo\_unverified\_recipient\_reject\_code}  
compatibility\_level=2  
smtpd\_banner = $myhostname ESMTP $mail\_name  
biff = no  
append\_dot\_mydomain = no  
readme\_directory = no  
smtpd\_relay\_restrictions = permit\_mynetworks permit\_sasl\_authenticated defer\_unauth\_destination  
mydomain = client.ag  
alias\_maps = hash:/etc/aliases  
alias\_database = hash:/etc/aliases  
mailbox\_transport = cyrus  
content\_filter = djigzo:[127.0.0.1]:10025  
recipient\_delimiter = +  
mailbox\_size\_limit = ${djigzo\_mailbox\_size\_limit}  
message\_size\_limit = ${djigzo\_after\_filter\_message\_size\_limit}  
inet\_interfaces = all  
inet\_protocols = ipv4  
myorigin = client.ag  
smtpd\_sasl\_path = smtpd  
smtpd\_sasl\_auth\_enable = yes  
broken\_sasl\_auth\_clients = yes  
smtpd\_sasl\_security\_options = noanonymous  
smtp\_sasl\_auth\_enable = yes  
smtp\_sasl\_password\_maps = hash:/etc/postfix/saslpasswd  
smtp\_sasl\_security\_options =  
sender\_canonical\_maps = hash:/etc/postfix/sender\_canonical

Which parameters do we have to change, to achieve a communication in both directions?

Thanks for any suggestions,

Stefan

---

<div class="post-metadata">

**Author:** ![martijn](https://dub1.discourse-cdn.com/flex017/user_avatar/community.ciphermail.com/martijn/32/127_2.png) [@martijn](https://community.ciphermail.com/u/martijn)\
**Post date:** [February 7, 2018, 8:24am UTC](https://community.ciphermail.com/t/problem-with-tls-ssl/597/2 "2018-02-07T08:24:32Z")

</div>

Because you changed the global values for smtp\_tls\_wrappermode and  
smtp\_tls\_security\_level, you should override these values for the  
connection to the back-end.

In master.cf, add smtp\_tls\_wrappermode=no and  
smtp\_tls\_security\_level=none to the djigzo service definition.

djigzo unix - - n - 4 smtp  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-o smtp\_send\_xforward\_command=yes  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-o disable\_dns\_lookups=yes  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-o smtp\_generic\_maps=  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-o smtp\_tls\_wrappermode=no  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-o smtp\_tls\_security\_level=none

After modifying master.cf, restart postfix

There are probably other option like not changing the global settings  
but only override for some destinations. See  
[Postfix TLS Support](http://www.postfix.org/TLS_README.html) (Postfix ≥ 3.0: Sending only mail  
for a specific destination via SMTPS) for some examples

Note: the smtp\_tls\_wrappermode settings is only supported on Postfix \>= 3.

Kind regards,

Martijn Brinkers

> **···**
>
> On 05-02-18 13:51, Stefan Günther via Users wrote:
> 
> > Hello,
> > 
> > we have setup a server for a client (domain: client.ag), where the external MX requires a connection on port 465 with SSL/TLS.  
> > Therefore we added the following lines to main.cf
> > 
> > relayhost = smtp.mailbox.org:465  
> > # SMTPS wrappermode (TCP port 465) requires setting "smtp\_tls\_wrappermode = yes", and "smtp\_tls\_security\_level = encrypt" (or stronger)  
> > smtp\_tls\_wrappermode = yes  
> > smtp\_tls\_security\_level = encrypt
> > 
> > With these setting postfix is able to connect to the external server, but internal connections fail:
> > 
> > Feb 5 13:34:56 ciphermail postfix/qmgr[6260]: 0D70040AA5: from=\<edifact(a)client.ag\>, size=601, nrcpt=1 (queue active)  
> > Feb 5 13:34:56 ciphermail postfix/smtp[6269]: SSL\_connect error to 127.0.0.1[127.0.0.1]:10025: -1  
> > Feb 5 13:34:56 ciphermail postfix/smtp[6269]: warning: TLS library problem: error:140770FC:SSL routines:SSL23\_GET\_SERVER\_HELLO:unknown protocol:s23\_clnt.c:794:  
> > Feb 5 13:34:56 ciphermail postfix/smtp[6269]: 0D70040AA5: to=\<edifact(a)web.de\>, relay=127.0.0.1[127.0.0.1]:10025, delay=0.14, delays=0.12/0.01/0/0, dsn=4.7.5, status=deferred (Cannot start TLS: handshake failure)
> > 
> > This is the current main.cf
> > 
> > djigzo\_myhostname = ciphermail.client.ag  
> > djigzo\_mydestination = client.ag  
> > djigzo\_mynetworks = 127.0.0.1/32  
> > djigzo\_relayhost = smtp.mailbox.org  
> > djigzo\_relayhost\_mx\_lookup =  
> > djigzo\_relayhost\_port = 465  
> > djigzo\_relay\_domains =  
> > djigzo\_before\_filter\_message\_size\_limit = 102400000  
> > djigzo\_after\_filter\_message\_size\_limit = 102400000  
> > djigzo\_mailbox\_size\_limit = 102400000  
> > djigzo\_smtp\_helo\_name =  
> > djigzo\_relay\_transport\_host = 127.0.0.1  
> > djigzo\_relay\_transport\_host\_mx\_lookup =  
> > djigzo\_relay\_transport\_host\_port = 25  
> > djigzo\_reject\_unverified\_recipient =  
> > djigzo\_unverified\_recipient\_reject\_code = 450  
> > djigzo\_parent\_domain\_matches\_subdomains =  
> > djigzo\_rbl\_clients =  
> > myhostname = ${djigzo\_myhostname}  
> > mydestination = ciphermail, $myhostname, ubuntu-2gb-nbg1-dc3-1, localhost.localdomain, localhost, ${djigzo\_mydestination}  
> > mynetworks = 127.0.0.0/8, ${djigzo\_mynetworks}  
> > relay\_domains = ${djigzo\_relay\_domains}  
> > parent\_domain\_matches\_subdomains = ${djigzo\_parent\_domain\_matches\_subdomains}  
> > smtp\_helo\_name = ${djigzo\_smtp\_helo\_name?$djigzo\_smtp\_helo\_name}${djigzo\_smtp\_helo\_name:${myhostname}}  
> > relay\_transport = relay${djigzo\_relay\_transport\_host?:${djigzo\_relay\_transport\_host\_mx\_lookup:[}${djigzo\_relay\_transport\_host}${djigzo\_relay\_transport\_host\_mx\_lookup:]}:${djigzo\_relay\_transport\_host\_port}}  
> > relayhost = ${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?[}}${djigzo\_relayhost}${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?]}}${djigzo\_relayhost?:${djigzo\_relayhost\_port}}  
> > smtpd\_recipient\_restrictions = permit\_mynetworks permit\_sasl\_authenticated reject\_unauth\_destination reject\_invalid\_hostname reject\_unknown\_sender\_domain reject\_unknown\_recipient\_domain  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_rbl\_clients}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_reject\_unverified\_recipient? reject\_unverified\_recipient}  
> > smtpd\_discard\_ehlo\_keywords = silent-discard VRFY ETRN DSN  
> > unverified\_recipient\_reject\_code = ${djigzo\_unverified\_recipient\_reject\_code}  
> > compatibility\_level=2  
> > smtpd\_banner = $myhostname ESMTP $mail\_name  
> > biff = no  
> > append\_dot\_mydomain = no  
> > readme\_directory = no  
> > smtpd\_relay\_restrictions = permit\_mynetworks permit\_sasl\_authenticated defer\_unauth\_destination  
> > mydomain = client.ag  
> > alias\_maps = hash:/etc/aliases  
> > alias\_database = hash:/etc/aliases  
> > mailbox\_transport = cyrus  
> > content\_filter = djigzo:[127.0.0.1]:10025  
> > recipient\_delimiter = +  
> > mailbox\_size\_limit = ${djigzo\_mailbox\_size\_limit}  
> > message\_size\_limit = ${djigzo\_after\_filter\_message\_size\_limit}  
> > inet\_interfaces = all  
> > inet\_protocols = ipv4  
> > myorigin = client.ag  
> > smtpd\_sasl\_path = smtpd  
> > smtpd\_sasl\_auth\_enable = yes  
> > broken\_sasl\_auth\_clients = yes  
> > smtpd\_sasl\_security\_options = noanonymous  
> > smtp\_sasl\_auth\_enable = yes  
> > smtp\_sasl\_password\_maps = hash:/etc/postfix/saslpasswd  
> > smtp\_sasl\_security\_options =  
> > sender\_canonical\_maps = hash:/etc/postfix/sender\_canonical
> > 
> > Which parameters do we have to change, to achieve a communication in both directions?
> 
> --  
> CipherMail email encryption
> 
> Email encryption with support for S/MIME, OpenPGP, PDF encryption and  
> secure webmail pull.
> 
> > **[CipherMail email encryption and digital signatures](https://www.ciphermail.com)**
> >
> > Easy to use server-side email encryption for automatic encryption and digital signing of email.
> 
> Twitter: [http://twitter.com/CipherMail](http://twitter.com/CipherMail)
