diff options
author | Joe Orton <jorton@apache.org> | 2004-11-10 16:21:44 +0100 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2004-11-10 16:21:44 +0100 |
commit | 6e5cdad44510fcb63a30782682739f4a17b7bf0f (patch) | |
tree | c1f83c4a4ffe75f7b2b0a0c058a7bc6d675cf9b7 /modules | |
parent | * modules/ssl/config.m4: Use libtool's -export-symbols-regex flag to (diff) | |
download | apache2-6e5cdad44510fcb63a30782682739f4a17b7bf0f.tar.xz apache2-6e5cdad44510fcb63a30782682739f4a17b7bf0f.zip |
Add -t -DDUMP_CERTS option to mod_ssl which dumps the filenames of all
configured SSL certificates to stdout, useful for cron-ing through a
"do I need to renew any of my certificates this week" tool:
* modules/ssl/ssl_engine_config.c (ssl_hook_ConfigTest): New function.
* modules/ssl/mod_ssl.c (ssl_register_hooks): ...register it as a
test_config hook.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105741 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ssl/mod_ssl.c | 1 | ||||
-rw-r--r-- | modules/ssl/ssl_engine_config.c | 25 | ||||
-rw-r--r-- | modules/ssl/ssl_private.h | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index 5e21a3bc1b..f676f06e40 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -474,6 +474,7 @@ static void ssl_register_hooks(apr_pool_t *p) ssl_io_filter_register(p); ap_hook_pre_connection(ssl_hook_pre_connection,NULL,NULL, APR_HOOK_MIDDLE); + ap_hook_test_config (ssl_hook_ConfigTest, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_post_config (ssl_init_Module, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_http_method (ssl_hook_http_method, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_default_port (ssl_hook_default_port, NULL,NULL, APR_HOOK_MIDDLE); diff --git a/modules/ssl/ssl_engine_config.c b/modules/ssl/ssl_engine_config.c index bd92b6a202..d9cc5b8a1e 100644 --- a/modules/ssl/ssl_engine_config.c +++ b/modules/ssl/ssl_engine_config.c @@ -1380,3 +1380,28 @@ const char *ssl_cmd_SSLUserName(cmd_parms *cmd, void *dcfg, dc->szUserName = arg; return NULL; } + +void ssl_hook_ConfigTest(apr_pool_t *pconf, server_rec *s) +{ + if (!ap_exists_config_define("DUMP_CERTS")) { + return; + } + + /* Dump the filenames of all configured server certificates to + * stdout. */ + while (s) { + SSLSrvConfigRec *sc = mySrvConfig(s); + + if (sc && sc->server && sc->server->pks) { + modssl_pk_server_t *const pks = sc->server->pks; + int i; + + for (i = 0; (i < SSL_AIDX_MAX) && pks->cert_files[i]; i++) { + printf("%s\n", pks->cert_files[i]); + } + } + + s = s->next; + } + +} diff --git a/modules/ssl/ssl_private.h b/modules/ssl/ssl_private.h index e044f3a80f..4f834948ba 100644 --- a/modules/ssl/ssl_private.h +++ b/modules/ssl/ssl_private.h @@ -530,6 +530,7 @@ int ssl_hook_Access(request_rec *); int ssl_hook_Fixup(request_rec *); int ssl_hook_ReadReq(request_rec *); int ssl_hook_Upgrade(request_rec *); +void ssl_hook_ConfigTest(apr_pool_t *pconf, server_rec *s); /* OpenSSL callbacks */ RSA *ssl_callback_TmpRSA(SSL *, int, int); |