[Home]

Summary:ASTERISK-17727: [patch] TLS doesn't get all certificate chain
Reporter:LN (luke1980)Labels:
Date Opened:2011-04-20 11:18:21Date Closed:2014-02-04 12:00:01.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/TCP-TLS
Versions:1.8.1 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) documente_certificate_chain.patch
( 1) use_certificate_chain.patch
Description:Dear All, dear Digium,

I use TLS on asterisk 1.8.1 with a cert file of trustwave.com CA root.

I expected to load the certificate chain in the "tlscafile" (define in sip.conf) and the certificate released from the CA root in the "tlscertfile" (define in sip.conf).

I see that the certificate chain is composed with the intermediate certificate of TrustWave CA (SecureTrust) and the root certificate of Entrust CA.

So I copy the intermediate certificate of TrustWave CA in the tlscafile and append to that the root certificate of Entrust CA.

Instead, I copy the certificate released form the CA in the tlscertfile.

But after that, seems that asterisk read only the first certificate of the chain in the file tlscafile and doesn't read both certificate (intermediate cert of TrustWave and root cert of Entrust). So the general chain of the certificate (CA, intermediate cert and root cert) results UNTRUSTED.

I think that this a bug.







tlscafile
tlscertfile
Comments:By: David Woolley (davidw) 2011-04-21 05:07:06

I would be surprised if Asterisk did anything that frustrated normal OpenSSL behaviour.

By: Leif Madsen (lmadsen) 2011-04-26 08:26:20

Can you provide a patch here? Unless multiple people run into this issue, the priority level is very low.

By: Stefan Tichy (st) 2011-04-26 09:58:34

The patch is very simple, but many phones cannot handle certificate chains

By: Stephane Chazelas (stephane.chazelas) 2011-09-21 05:47:07.990-0500

Hi,

If one wants to have his certificate signed by a real certificate authority, the situation will generally be that the server certificate will be signed by an intermediate CA while the clients will only have the root CA certificate installed.

As asterisk can't send the intermediate CA certificates, that means that SIP-TLS won't work unless either the clients don't verify the server certificate (which is as good/bad as not using TLS at all), or every client are manually configured to add the first intermediate CA certificate in their list of trusted certificate which defeats the purpose of using a real certificate authority as one might as well use a self signed one in that case.

I can understand that the priority for that bug be low as I suspect hardly anybody uses asterisk's SIP-TLS, but IMO, the severity should be at least major as it makes SIP-TLS non-functional in enterprise deployments. And the patch is very simple and has no downside (if you have phones that don't support chains, just don't put a chain in your certfile).


By: Frederik Kriewitz (freddy) 2011-10-06 11:46:12.463-0500

During our upgrade to 1.8 I intended to implement SSL with real SSL certificates too.
I ran into the same problem. Please apply the attached patch.
From my experience with openssl I can confirm that it won't break anything. Without the patch it's only possible to use self-signed certificates.

By: Daniel Pocock (daniel.pocock) 2012-01-29 12:24:49.947-0600


I fully support this patch:

- makes Asterisk consistent with the new TLS module in Kamailio, and many other apps
- using the method SSL_CTX_use_certificate_chain_file() from OpenSSL is the preferred method of loading a cert, according to the official OpenSSL docs
http://www.openssl.org/docs/ssl/SSL_CTX_use_certificate.html

- this will not break anything
- it adds significant benefit, because TLS is becoming much more common in the fight against SIPspam
- it adds significant benefit, because many low cost and free CAs (such as Startssl.com and Cacert.org) use intermediate certs.
- The Thawte 123 low cost certs are also signed with an intermediate cert, my Polycom phone accepts these certs on the HTTPS provisioning, so I suspect they are also good for SIPS


By: Matthias Nagl (mnagl) 2012-03-12 07:40:47.436-0500

I also support this patch as it seems to be necessary to support StartSSL (and many other) certificates and it works and is still necessary for Asterisk 10.1.3.

By: Guillaume Martres (Smarter) 2014-01-20 12:50:07.557-0600

Any news on this? This still seems to be a problem with Asterisk 11.7.0 and a StartSSL certificate.

By: Guillaume Martres (Smarter) 2014-01-21 16:49:33.432-0600

While discussing this on IRC, concerns were raised concerning support of DER files since SSL_CTX_use_certificate_chain_file do not support them, but Asterisk currently pass SSL_FILETYPE_PEM to SSL_CTX_use_certificate_file so this doesn't actually break anything.
It's even recommended by the OpenSSL documentation: "SSL_CTX_use_certificate_chain_file() should be used instead of the SSL_CTX_use_certificate_file() function in order to allow the use of complete certificate chains even when no trusted CA storage is used or when the CA issuing the certificate shall not be added to the trusted CA storage. " https://www.openssl.org/docs/ssl/SSL_CTX_use_certificate.html

By: Guillaume Martres (Smarter) 2014-01-22 10:05:49.631-0600

Add documentation on the certificate chain.