Skip to content

Commit eeb1f48

Browse files
committed
feat(server): accept combined certificate files
Openssl::with_cert_and_key is often useless in its current form: in most setups, one need to provide the intermediate certificate chain to Openssl. One way would be to change with_cert_and_key to allow passing a third file containing the authority chain. Fortunately, thers is another option: Openssl accepts combined certificates (your certs, then whatever certs you need to link it to the widely distributed ones). This is not exotic, both nginx and apache use this setup.
1 parent 3608382 commit eeb1f48

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ mod openssl {
710710
where C: AsRef<Path>, K: AsRef<Path> {
711711
let mut ctx = try!(SslContext::new(SslMethod::Sslv23));
712712
try!(ctx.set_cipher_list("DEFAULT"));
713-
try!(ctx.set_certificate_file(cert.as_ref(), X509FileType::PEM));
713+
try!(ctx.set_certificate_chain_file(cert.as_ref(), X509FileType::PEM));
714714
try!(ctx.set_private_key_file(key.as_ref(), X509FileType::PEM));
715715
ctx.set_verify(SSL_VERIFY_NONE, None);
716716
Ok(Openssl { context: Arc::new(ctx) })

0 commit comments

Comments
 (0)