Implement SSL_CONF_cmd
Certificate
and PrivateKey
commands
#32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch follows #29, #31 extending the existing
SSL_CONF_xxx
API to support the "Certificate" and "PrivateKey" sub-commands. Seeman 3 SSL_CONF_cmd
for more information.We diverge slightly from the upstream here by re-using the existing
SSL_CTX_use_certificate_chain_file
andSSL_CTX_use_PrivateKey_file
logic. In the case ofSSL_CTX_use_certificate_chain_file
this means pulling out ause_cert_chain_file
helper with the existing logic so it can be reused. Taking this approach requires the minimum amount of fuss to support these configuration commands, but means we error earlier in the case of the cert file/private key being bogus. This seems better to me than putting in more extra design work just to delay erroring! Relatedly, we don't have all the pieces needed to support setting a certificate chain by PEM input path for aSSL
, just aSSL_CTX
, so we skip implementingCertificate
afterSSL_CONF_CTX_set_ssl
- in practice Nginx only usesSSL_CONF_CTX_set_ssl_ctx
so we can punt here for the time being.An integration test using Nginx's
ssl_conf_command
directive to override the normalssl_certificate
andssl_certificate_key
directives using theCertificate
andPrivateKey
commands demonstrates the end-to-end implementation working w/ Nginx 1.24+.Updates #22