Enforced TLS issue after Postfix upgrade

2010-11-29 Thread Mueller, Martin (Messaging)
Hello,

After upgrading from 2.5.x to 2.7.1 mail started queuing up to one particular 
domain (TLS security level: verify) with Server certificate not verified. 
Systems still on 2.5.x versions of Postfix transmit messages to that domain via 
enforced TLS just fine. Based on some testing with different version it seems 
that the change in behavior started with 2.6.0.

The ST part of the CN contains an encoded string sequence of \xC3\xBC that  
represents the German u Umlaut. 
We  have tons of domains setup for enforced TLS and this is the only one that 
is causing trouble. Warning messages in the log file
are also tied to asn1 encoding and eventually CN appears with no value in the 
log. Which seems to suggest that the asn 1 encoded
character is what causes the trouble.

Some log information below. 

Regards,

Martin


Nov 29 22:14:23 server postfix/smtp[6740]: initializing the client-side TLS 
engine
Nov 29 22:14:24 server postfix/smtp[6740]: setting up TLS connection to 
mx2.mlp-ag.com[195.170.185.78]:25
Nov 29 22:14:24 server postfix/smtp[6740]: mx2.mlp-ag.com[195.170.185.78]:25: 
TLS cipher list ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL
Nov 29 22:14:24 server postfix/smtp[6740]: looking for session 
smtp:195.170.185.78:25:mx2.mlp-ag.comp=1c=ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL
 in smtp cache
Nov 29 22:14:24 server postfix/smtp[6740]: mx2.mlp-ag.com[195.170.185.78]:25: 
certificate verification depth=3 verify=1 subject=/C=US/O=VeriSign, 
Inc./OU=Class 3 Public Primary Certification Authority
Nov 29 22:14:24 server postfix/smtp[6740]: mx2.mlp-ag.com[195.170.185.78]:25: 
certificate verification depth=2 verify=1 subject=/C=US/O=VeriSign, 
Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use 
only/CN=VeriSign Class 3 Public Primary Certification Authority - G5
Nov 29 22:14:24 server postfix/smtp[6740]: mx2.mlp-ag.com[195.170.185.78]:25: 
certificate verification depth=1 verify=1 subject=/C=US/O=VeriSign, 
Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa 
(c)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA
Nov 29 22:14:24 server postfix/smtp[6740]: mx2.mlp-ag.com[195.170.185.78]:25: 
certificate verification depth=0 verify=1 
subject=/1.3.6.1.4.1.311.60.2.1.3=DE/1.3.6.1.4.1.311.60.2.1.1=Mannheim/2.5.4.15=V1.0,
 Clause 5.(b)/serialNumber=HRB 
335755/C=DE/2.5.4.17=69168/ST=Baden-W\xC3\xBCrttemberg/L=Wiesloch/2.5.4.9=Alte 
Heerstrasse 40/O=MLP Finanzdienstleistungen Aktiengesellschaft
Nov 29 22:14:24 server postfix/smtp[6740]: SSL_connect:SSLv3 read finished A
Nov 29 22:14:24 server postfix/smtp[6740]: save session 
smtp:195.170.185.78:25:mx2.mlp-ag.comp=1c=ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL
 to smtp cache
Nov 29 22:14:24 server postfix/smtp[6740]: warning: tls_text_name: 
mx2.mlp-ag.com[195.170.185.78]:25: error decoding peer subject CN of ASN.1 
type=12
Nov 29 22:14:24 server postfix/smtp[6740]: warning: TLS library problem: 
6740:error:0D07A0A0:asn1 encoding routines:ASN1_mbstring_copy:unknown 
format:a_mbstr.c:142:
Nov 29 22:14:24 server postfix/smtp[6740]: mx2.mlp-ag.com[195.170.185.78]:25: 
Trusted subject_CN=, issuer_CN=VeriSign Class 3 Extended Validation SSL SGC CA
Nov 29 22:14:24 server postfix/smtp[6740]: Trusted TLS connection established 
to mx2.mlp-ag.com[195.170.185.78]:25: TLSv1 with cipher DHE-RSA-AES256-SHA 
(256/256 bits)
Nov 29 22:14:24 server postfix/smtp[6740]: 193A714002: Server certificate not 
verified
Nov 29 22:14:25 server postfix/smtp[6740]: setting up TLS connection to 
mx1.mlp-ag.com[195.170.185.77]:25
Nov 29 22:14:25 server postfix/smtp[6740]: mx1.mlp-ag.com[195.170.185.77]:25: 
TLS cipher list ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL
Nov 29 22:14:25 server postfix/smtp[6740]: looking for session 
smtp:195.170.185.77:25:mx1.mlp-ag.comp=1c=ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL
 in smtp cache
Nov 29 22:14:25 server postfix/smtp[6740]: SSL_connect:before/connect 
initialization
Nov 29 22:14:25 server postfix/smtp[6740]: mx1.mlp-ag.com[195.170.185.77]:25: 
certificate verification depth=3 verify=1 subject=/C=US/O=VeriSign, 
Inc./OU=Class 3 Public Primary Certification Authority
Nov 29 22:14:25 server postfix/smtp[6740]: mx1.mlp-ag.com[195.170.185.77]:25: 
certificate verification depth=2 verify=1 subject=/C=US/O=VeriSign, 
Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use 
only/CN=VeriSign Class 3 Public Primary Certification Authority - G5
Nov 29 22:14:25 server postfix/smtp[6740]: mx1.mlp-ag.com[195.170.185.77]:25: 
certificate verification depth=1 verify=1 subject=/C=US/O=VeriSign, 
Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa 
(c)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA
Nov 29 22:14:25 server postfix/smtp[6740]: mx1.mlp-ag.com[195.170.185.77]:25: 
certificate verification depth=0 verify=1 
subject=/1.3.6.1.4.1.311.60.2.1.3=DE/1.3.6.1.4.1.311.60.2.1.1=Mannheim/2.5.4.15=V1.0,
 Clause 5.(b)/serialNumber=HRB 

Re: Enforced TLS issue after Postfix upgrade

2010-11-29 Thread Victor Duchovni
On Tue, Nov 30, 2010 at 02:44:31AM +, Mueller, Martin (Messaging) wrote:

 After upgrading from 2.5.x to 2.7.1 mail started queuing up to one
 particular domain (TLS security level: verify) with Server certificate
 not verified.

Postfix TLS support has not changed noticeably since 2.5.

 Systems still on 2.5.x versions of Postfix transmit messages to that
 domain via enforced TLS just fine. Based on some testing with different
 version it seems that the change in behavior started with 2.6.0.

What's new in 2.6/2.7 is that finally and with good reason SSLv2 and
its associated ciphers are disabled by default.

http://www.postfix.org/postconf.5.html#smtp_tls_protocols

It is also likely that are you are using a more recent version of OpenSSL,
this can be more significant than any minor changes in Postfix.

 The ST part of the CN contains an encoded string sequence of \xC3\xBC
 that  represents the German u Umlaut.

The ST as you say, is not part of the CN it is part of the
Distinguished Name or DN. Parts of the DN that are not the CN do
not matter for peer verification.

 We  have tons of domains setup for enforced TLS and this is the only one that 
 is causing trouble. Warning messages in the log file
 are also tied to asn1 encoding and eventually CN appears with no value in the 
 log. Which seems to suggest that the asn 1 encoded
 character is what causes the trouble.

This is almost certainly a Red Herring.

 initializing the client-side TLS engine
 setting up TLS connection to mx2.mlp-ag.com[195.170.185.78]:25
 mx2.mlp-ag.com[195.170.185.78]:25: TLS cipher list 
 ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL

Your TLS log level is a bit too verbose.

 Nov 29 22:14:24 server postfix/smtp[6740]: warning: TLS library problem: 
 6740:error:0D07A0A0:asn1 encoding routines:ASN1_mbstring_copy:unknown 
 format:a_mbstr.c:142:

Harmless noise unless you have peername verification turned on. What is
the configured TLS security level?

 Nov 29 22:14:24 server postfix/smtp[6740]: Trusted TLS connection established 
 to mx2.mlp-ag.com[195.170.185.78]:25: TLSv1 with cipher DHE-RSA-AES256-SHA 
 (256/256 bits)

The TLS handshake completes.

 Nov 29 22:14:24 server postfix/smtp[6740]: 193A714002: Server certificate not 
 verified

But you appear to have peername verification turned on. What is your
tls security level for this destination?

When testing with Postfix 2.7 compiled against OpenSSL 1.0.0a and also
1.0.0b with two patches from the upcoming 1.0.0c (due any day now)
everything is normal. Your OpenSSL is perhaps less fortuitously selected
than mine.

smtp-finger: Connected to mx2.mlp-ag.com[195.170.185.78]:25
smtp-finger:  220 mx2.mlp-ag.com ESMTP
smtp-finger:  EHLO amnesiac.example.com
smtp-finger:  250-mx2.mlp-ag.com
smtp-finger:  250-8BITMIME
smtp-finger:  250-SIZE 104857600
smtp-finger:  250 STARTTLS
smtp-finger:  STARTTLS
smtp-finger:  220 Go ahead with TLS
smtp-finger: mx2.mlp-ag.com[195.170.185.78]:25 Matched CommonName mx2.mlp-ag.com
smtp-finger: mx2.mlp-ag.com[195.170.185.78]:25: Matched 
subject_CN=mx2.mlp-ag.com, issuer_CN=VeriSign Class 3 Extended Validation SSL 
SGC CA
smtp-finger: mx2.mlp-ag.com[195.170.185.78]:25 sha1 fingerprint 
90:9A:37:16:7B:DB:5E:D4:0D:72:2F:E4:AA:38:4C:5C:9A:12:59:21
smtp-finger: Verified TLS connection established to 
mx2.mlp-ag.com[195.170.185.78]:25: TLSv1 with cipher DHE-RSA-AES256-SHA 
(256/256 bits)
---
Certificate chain
 0 
s:/1.3.6.1.4.1.311.60.2.1.3=DE/1.3.6.1.4.1.311.60.2.1.1=Mannheim/businessCategory=V1.0,
 Clause 5.(b)/serialNumber=HRB 
335755/C=DE/postalCode=69168/ST=Baden-W\xC3\xBCrttemberg/L=Wiesloch/street=Alte 
Heerstrasse 40
   i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at 
https://www.verisign.com/rpa (c)06/CN=VeriSign Class 3 Extended Validation SSL 
SGC CA
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
5c:15:d9:5e:08:43:61:e7:6e:40:76:e5:a3:cd:7b:bc
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of 
use at https://www.verisign.com/rpa (c)06, CN=VeriSign Class 3 Extended 
Validation SSL SGC CA
Validity
Not Before: Jul  1 00:00:00 2010 GMT
Not After : Jul  1 23:59:59 2011 GMT
Subject: 
1.3.6.1.4.1.311.60.2.1.3=DE/1.3.6.1.4.1.311.60.2.1.1=Mannheim/businessCategory=V1.0,
 Clause 5.(b)/serialNumber=HRB 335755, C=DE/postalCode=69168, 
ST=Baden-W\xC3\xBCrttemberg, L=Wiesloch/street=Alte Heerstrasse 40, O=MLP 
Finanzdienstleistungen Aktiengesellschaft, OU=e-Services, CN=mx2.mlp-ag.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:ba:9e:2d:b9:ea:23:90:d5:a1:28:71:d3:cf:a8:
e5:4b:d0:da:2a:00:c4:21:40:8d:77:43:b8:df:73:
49:f9:d2:e8:ae:85:43:74:e1:aa:e2:53:8c:4b:54:
41:0f:b7:62:85:8b:3d:ad:e6:5c:ca:f7:f8:af:4d:

Re: Enforced TLS issue after Postfix upgrade

2010-11-29 Thread Victor Duchovni
On Tue, Nov 30, 2010 at 12:56:08AM -0500, Victor Duchovni wrote:

 When testing with Postfix 2.7 compiled against OpenSSL 1.0.0a and also
 1.0.0b with two patches from the upcoming 1.0.0c (due any day now)
 everything is normal. Your OpenSSL is perhaps less fortuitously selected
 than mine.

I get the same (successfully decoded CN) results with 0.9.8p and
Postfix 2.5. I don't have a build of Postfix 2.7 with OpenSSL 0.9.8.
What combination are you using? It sounds like your OpenSSL has a problem
parsing the CN encoding, this happens very far away from Postfix code,
entirely within OpenSSL.

-- 
Viktor.