]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
tcptls.c: Made TLS handle a certificate chain file.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 4 Feb 2014 17:50:04 +0000 (17:50 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 4 Feb 2014 17:50:04 +0000 (17:50 +0000)
Thanks to Guillaume Martres for doing the necessary research to validate
the change.

(closes issue ASTERISK-17727)
Reported by: LN
Patches:
      use_certificate_chain.patch (license #5864) patch uploaded by st
      documente_certificate_chain.patch (license #6576) patch uploaded by Guillaume Martres

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@407272 65c4cc65-6c06-0410-ace0-fbb531ad65f3

configs/sip.conf.sample
main/tcptls.c

index e977e234fc4cdc7a49e01c98c4b25b265835bab6..cd12029bdc561f2325724578e8f8a533d53784ea 100644 (file)
@@ -474,8 +474,10 @@ srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
                       ; Set to yes add Reason header and use Reason header if it is available.
 ;
 ;------------------------ TLS settings ------------------------------------------------------------
-;tlscertfile=</path/to/certificate.pem> ; Certificate file (*.pem format only) to use for TLS connections
-                                        ; default is to look for "asterisk.pem" in current directory
+;tlscertfile=</path/to/certificate.pem> ; Certificate chain (*.pem format only) to use for TLS connections
+                                        ; The certificates must be sorted starting with the subject's certificate
+                                        ; and followed by intermediate CA certificates if applicable.
+                                        ; Default is to look for "asterisk.pem" in current directory
 
 ;tlsprivatekey=</path/to/private.pem> ; Private key file (*.pem format only) for TLS connections.
                                       ; If no tlsprivatekey is specified, tlscertfile is searched for
index e6feec8133665a1beaea932c46b5c556b412e264..47041fea860bfbd6540fcb8d7750c7e3f4703b71 100644 (file)
@@ -384,7 +384,7 @@ static int __ssl_setup(struct ast_tls_config *cfg, int client)
 
        if (!ast_strlen_zero(cfg->certfile)) {
                char *tmpprivate = ast_strlen_zero(cfg->pvtfile) ? cfg->certfile : cfg->pvtfile;
-               if (SSL_CTX_use_certificate_file(cfg->ssl_ctx, cfg->certfile, SSL_FILETYPE_PEM) == 0) {
+               if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {
                        if (!client) {
                                /* Clients don't need a certificate, but if its setup we can use it */
                                ast_verb(0, "SSL error loading cert file. <%s>", cfg->certfile);