Re: [PATCH 55593] Add SSLServerInfoFile directive

2013-10-11 Thread Dr Stephen Henson
On 02/10/2013 08:35, Kaspar Brand wrote:
 
 An overhaul of ssl_engine_pphrase.c:ssl_pphrase_Handle() - and its use
 of the tVHostKeys and tPublicCert hashes - would probably be welcomed by
 quite a few devs, though (see e.g. https://svn.apache.org/r1069765).
 

Hmm.. I had a look at ssl_pphrase_Handle and agree with the comment ;-)

I'm considering how it might be revised with minimal chance of breakage while
permitting arbitrary numbers of certificates and keys.

At present the serialised versions of each key and certificate is indexed using
vhost:alg. How about instead having a single one indexed as vhost? This
could contain all keys and certificates in a single buffer. Keys would be stored
in PKCS#8 format to avoid algorithm dependencies.

The auto increment feature of the i2d/d2i functions is especially designed to
support this.

Steve.
-- 
Dr Stephen Henson. OpenSSL Software Foundation, Inc.
1829 Mount Ephraim Road
Adamstown, MD 21710
+1 877-673-6775
shen...@opensslfoundation.com


Re: [PATCH 55593] Add SSLServerInfoFile directive

2013-10-11 Thread Dr Stephen Henson
On 11/10/2013 05:14, Kaspar Brand wrote:
 On 09.10.2013 15:52, Dr Stephen Henson wrote:
 It's tempting to just add a directive but after some thought I think 
 expanding
 Apache SSL_CONF handling is the way to go. This would add some future 
 proofing
 so we don't have to go through this all again in future.
 
 Yes, please. Let's not perpetuate the pattern of adding another
 directive to mod_ssl whenever a new OpenSSL feature needs to be exposed.
 
 As an interim step, and sort of a proof of concept, it might be
 worthwile to see if adding equivalents of SSLCertificateFile and
 SSLCertificateKeyFile to SSLOpenSSLConfCmd (in ssl/ssl_conf.c, at the
 OpenSSL end) would allow support for per-cert options. The concept of
 collecting the options in ssl_cmd_SSLOpenSSLConfCmd and replying them at
 the appropriate place in ssl_engine_init.c would remain, and you would
 use something like
 
 VirtualHost ...
   OpenSSLConfCmd KeyFile foo.key
   OpenSSLConfCmd CertificateFile foo.crt
   OpenSSLConfCmd ServerInfoFile foo.pem
   OpenSSLConfCmd KeyFile bar.key
   OpenSSLConfCmd CertificateFile bar.crt
   OpenSSLConfCmd ServerInfoFile bar.pem
 /VirtualHost
 
 to configure multiple cert and current-cert settings in turn (and not
 worry about the case of encrypted private keys, for the time being).
 KeyFile would result in calling SSL_CTX_use_PrivateKey_file(), and
 CertificateFile in SSL_CTX_use_certificate_chain_file().
 

I had considered some equivalents of CertificateFile for the SSL_CONF API and
definitely intend that for a future version of SSL_CONF.

The idea of being able to have OpenSSL handle the often complex issue of
certificate and key configuration properly and releave the burden from
applications is rather compelling.

However I felt it needed rather more thought as it's a complex issue. I'd like
to handle all sorts of things like HSM keys, PKCS#12 files etc etc. I also have
to mention that I wasn't at all sure this would work with Apache's rather
curious configuration needs.

As an experimental feature to test the current-cert handling it would be easy
enough though.

[BTW: also on the list for SSL_CONF is certificate verification: but that's
considerably harder]

IMHO though there needs to be a way to be able to tie a directive to a
certificate in mod_ssl anyway though. I'm surprised no one has needed to do that
before.

 ssl_engine_init.c:ssl_init_server_ctx() is most likely the appropriate
 place for inserting this (i.e., it's perhaps best to move the current
 SSL_CONF_CMD block from the end of ssl_init_ctx_protocol() to somewhere
 in ssl_init_server_ctx(), maybe some tweaks are needed for
 ssl_init_server_certs(), too). What I would try to avoid right now is
 fiddling with the tPublicCert, tVHostKey and tPrivateKey hashes (and the
 ssl_asn1_table_* friends).


Well moving the SSL_CONF_CMD block does have some consequences. I placed it at
(what I think is) the last possible point for a reason: so the SSL_CONF could
reset just about anything set by Apache.

I think at least some twiddling with ssl_pphrase_Handle() would be needed
because Apache will (I think) choke if you have no certificates configured.

It might be an idea to support certificateless servers anyway as someone might
want one with anon-DH or PSK.. though I don't think PSK is currently supported:
yes even as I typed that I wondered if that could be fixed through SSL_CONF.

Steve.
-- 
Dr Stephen Henson. OpenSSL Software Foundation, Inc.
1829 Mount Ephraim Road
Adamstown, MD 21710
+1 877-673-6775
shen...@opensslfoundation.com


Re: uds support

2013-10-11 Thread Jim Jagielski

On Aug 23, 2013, at 3:50 PM, Jim Jagielski j...@jagunet.com wrote:

 
 On Aug 23, 2013, at 3:37 PM, Tim Bannister is...@jellybaby.net wrote:
 
 On 23 Aug 2013, at 15:05 (UTC-0400), Jim Jagielski wrote:
 
 I'm scrapping some of the work I've been doing, simply because, from what I 
 can see, using the current method of specifying it creates problems.
 
 Instead, I'm looking into something like:
 
 http://localhost/var/run/server.sock|/foo/bar
 
 For ease of parsing and clearly breaking out what needs to be encoded, etc.
 
 
 My different suggestion is unixsocket+http:/var/run/server.sock://foo/bar
 
 
 I've also looked at (and am hoping it works out)
 
   sock://var/run/server.sock|http://localhost/foo/bar
 
 The reason I like using '|' is it's quite Perlish :)
 The other advantage is that it keep both sides completely
 separate and self-contained.
 

Committed in r1531340 the above is implemented... kinda.
I instead went with

http://localhost/foo/bar|sock:/var/run.s.sock

which worked out just a bit cleaner...