Bug 24030 - Missing private key in SSLProxyMachineCertificateFile causes SEGV
Summary: Missing private key in SSLProxyMachineCertificateFile causes SEGV
Status: CLOSED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_ssl (show other bugs)
Version: 2.0.47
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
: 31633 31856 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-23 06:30 UTC by kris.verbeeck
Modified: 2004-11-16 19:05 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kris.verbeeck 2003-10-23 06:30:28 UTC
When firing a request, the reverse proxy child process segfaults.
The segfault occurs in the ssl_callback_proxy_cert() function
(ssl_engine_kernel.c) when calling the modssl_set_cert_info() macro.
This macro is defined as follows:

   #define modssl_set_cert_info(info, cert, pkey) \
       *cert = info->x509; \
       X509_reference_inc(*cert); \
       *pkey = info->x_pkey->dec_pkey; \
       EVP_PKEY_reference_inc(*pkey)

When tracing trough the code with gdb the following values are
present in the local variables:

   (gdb) p info
   $4 = (struct X509_info_st *) 0x8236688
   (gdb) p cert
   No symbol "cert" in current context.
   (gdb) p pkey
   $5 = (struct evp_pkey_st **) 0xbffff26c
   (gdb) p *info
   $6 = {x509 = 0x8236bf0, crl = 0x0, x_pkey = 0x0, enc_cipher = {cipher = 0x0,
       iv = "ú\024/KJh\207§"}, enc_len = 0, enc_data = 0x0, references = 1}
   (gdb) c
   Continuing.
   Program received signal SIGSEGV, Segmentation fault.
   0x08095b9d in ssl_callback_proxy_cert (ssl=0x0, x509=0xbffff268,
       pkey=0xbffff26c) at ssl_engine_kernel.c:1592
   1592                    modssl_set_cert_info(info, x509, pkey);

The problem is that the x_pkey field in the info structure is NULL
(the third line in the macro tries to access a field in this x_pkey
structure).

Mod_proxy/mod_ssl should ensure that there is a private key for every
certificate in SSLProxyMachineCertificateFile (and vice versa).

(See also the following thread:
http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=106629032008685&w=2)

(Related to bug 24029)
Comment 1 Joe Orton 2003-11-25 21:16:36 UTC
Thanks very much for tracking this down: with HEAD, the server will fail to
start up if any configured client cert is missing a cert or private key.  This
will be proposed for backport:

http://cvs.apache.org/viewcvs/httpd-2.0/modules/ssl/ssl_engine_init.c.diff?r1=1.118&r2=1.119
Comment 2 Joe Orton 2004-10-11 15:56:47 UTC
*** Bug 31633 has been marked as a duplicate of this bug. ***
Comment 3 Joe Orton 2004-10-24 12:56:12 UTC
*** Bug 31856 has been marked as a duplicate of this bug. ***