33#include <openssl/ui.h>
34#if MODSSL_HAVE_OPENSSL_STORE
35#include <openssl/store.h>
52static const char *
key_types[] = {
"RSA",
"DSA",
"ECC"};
102 const char *
id,
int i)
116 return (
char *)keyptr;
125#define BUILTIN_DIALOG_BACKOFF 2
126#define BUILTIN_DIALOG_RETRIES 5
143 const char *pkey_file,
159 "Init: No private key specified for %s", key_id);
165 "Init: Can't open server private key file %s", pkey_file);
204 "Reusing existing private key from %s on restart",
211 "Attempting to load encrypted (?) private key %s", key_id);
259 apr_file_printf(writetty,
"Apache:mod_ssl:Error: Pass phrase incorrect "
260 "(%d more retr%s permitted).\n",
261 (BUILTIN_DIALOG_RETRIES-nPassPhraseRetry),
262 (BUILTIN_DIALOG_RETRIES-nPassPhraseRetry) == 1 ?
"y" :
"ies");
264 if (nPassPhraseRetry > BUILTIN_DIALOG_BACKOFF)
265 apr_sleep((nPassPhraseRetry-BUILTIN_DIALOG_BACKOFF)
266 * 5 * APR_USEC_PER_SEC);
271 ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(02577)
272 "Init: SSLPassPhraseDialog builtin is not "
273 "supported on Win32 (key file "
274 "%s)", ppcb_arg.pkey_file);
283 if (ppcb_arg.nPassPhraseDialogCur && pkey_mtime &&
284 !isatty(fileno(stdout)))
286 ap_log_error(APLOG_MARK, APLOG_ERR, 0,
288 "Init: Unable to read pass phrase "
289 "[Hint: key introduced or changed "
291 ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
294 ap_log_error(APLOG_MARK, APLOG_ERR, 0,
295 s, APLOGNO(02579)
"Init: Private key not found");
296 ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
305 "Init: Pass phrase incorrect for key %s",
319 "Init: Unable to read server private key from file %s",
328 if (
ppcb_arg.nPassPhraseDialogCur == 0) {
330 "unencrypted %s private key - pass phrase not "
337 "encrypted %s private key - pass phrase "
338 "requested", key_id);
343 "encrypted %s private key - pass phrase"
361 if (
ppcb_arg.nPassPhraseDialogCur != 0) {
374 if ((
ppcb_arg.nPassPhraseDialog > 0) &&
378 "OK: Pass Phrase Dialog successful.\n");
485 "Init: Creating pass phrase dialog pipe child "
492 "Init: Failed to create pass phrase pipe '%s'",
501 "Init: Requesting pass phrase via piped dialog");
518 "Init: Requesting pass phrase via builtin terminal "
529 if (
ppcb_arg->nPassPhraseDialog == 1) {
535 if (
ppcb_arg->bPassPhraseDialogOnce) {
546 prompt =
"Enter pass phrase:";
580 "Init: Requesting pass phrase from dialog filter "
581 "program (%s)",
cmd);
614#if MODSSL_HAVE_ENGINE_API || MODSSL_HAVE_OPENSSL_STORE
625 ppcb->nPassPhraseDialog++;
626 ppcb->nPassPhraseDialogCur++;
637 "Init: Creating pass phrase dialog pipe child "
644 "Init: Failed to create pass phrase pipe '%s'",
650 "Init: Requesting pass phrase via piped dialog");
655 "Init: Failed to create pass phrase pipe '%s'",
668 "Init: Requesting pass phrase via builtin terminal "
679 if (
ppcb->nPassPhraseDialog == 1) {
683 "A pass phrase is required to access the private key.\n");
685 if (
ppcb->bPassPhraseDialogOnce) {
708 prompt =
"Enter pass phrase:";
737 "empty (needs to be at least 1 character).\n");
754 "Init: Requesting pass phrase from dialog filter "
755 "program (%s)",
cmd);
832#if MODSSL_HAVE_ENGINE_API
850 const char *
c, *scheme;
865 "Init: Unrecognized private key identifier `%s'",
873 "Init: Failed to load engine for private key %s",
881 "Init: Failed to initialize engine %s for private key %s",
888 "Init: Initialized engine %s for private key %s",
903 "Init: Unable to get the certificate");
914 "Init: Unable to get the private key");
931#if MODSSL_HAVE_OPENSSL_STORE
951 "Init: OSSL_STORE_open failed for PKCS#11 URI `%s'",
988 "Init: OSSL_STORE_INFO_PKEY lookup failed for private key identifier `%s'",
997 "Init: OSSL_STORE_INFO_PKEY lookup failed for private key identifier `%s'",
1006 "Init: OSSL_STORE_INFO_CERT lookup failed for certificate identifier `%s'",
1015 "Init: OSSL_STORE_INFO_CERT lookup failed for certificate identifier `%s'",
1028 const char *certid,
const char *
keyid,
1031#if MODSSL_HAVE_ENGINE_API
1037 if (
mc->szCryptoDevice)
1042#if MODSSL_HAVE_OPENSSL_STORE
1047 "Init: no method for loading keypair for %s (%s | %s)",
const char apr_size_t len
#define AP_SERVER_BASEVERSION
static apr_pool_t * pconf
const unsigned char * buf
apr_pool_t const char * params
apr_status_t ssl_die(server_rec *s)
char * ssl_util_readfilter(server_rec *, apr_pool_t *, const char *, const char *const *)
apr_status_t modssl_load_engine_keypair(server_rec *s, apr_pool_t *pconf, apr_pool_t *ptemp, const char *vhostid, const char *certid, const char *keyid, X509 **pubkey, EVP_PKEY **privkey)
apr_status_t ssl_load_encrypted_pkey(server_rec *s, apr_pool_t *p, int idx, const char *pkey_file, apr_array_header_t **pphrases)
ssl_asn1_t * ssl_asn1_table_set(apr_hash_t *table, const char *key, EVP_PKEY *pkey)
void ssl_log_ssl_error(const char *file, int line, int level, server_rec *s)
ssl_asn1_t * ssl_asn1_table_get(apr_hash_t *table, const char *key)
EVP_PKEY * modssl_read_privatekey(const char *filename, pem_password_cb *cb, void *s)
#define ap_strrchr_c(s, c)
#define ap_strchr_c(s, c)
const char int apr_pool_t * pool
apr_array_header_t ** result
#define APR_HASH_KEY_STRING
apr_vformatter_buff_t * c
#define apr_pcalloc(p, size)
const apr_array_header_t * arr
const char const char *const * args
static const char * asn1_table_vhost_key(SSLModConfigRec *mc, apr_pool_t *p, const char *id, int i)
int ssl_pphrase_Handle_CB(char *, int, int, void *)
static apr_status_t exists_and_readable(const char *fname, apr_pool_t *pool, apr_time_t *mtime)
static apr_status_t ssl_pipe_child_create(apr_pool_t *p, const char *progname)
static char * pphrase_array_get(apr_array_header_t *arr, int idx)
static int pipe_get_passwd_cb(char *buf, int length, char *prompt, int verify)
static const char * key_types[]
static apr_file_t * readtty
static apr_file_t * writetty
#define BUILTIN_DIALOG_RETRIES
Internal interfaces private to mod_ssl.
ssl_pphrase_t pphrase_dialog_type
const char * pphrase_dialog_path
unsigned int bPassPhraseDialogOnce
apr_array_header_t * aPassPhrase
A structure to store information for each virtual server.