Skip to content

Commit e46c9d4

Browse files
authored
fix MDStapleOthers inheritance (#400)
* fix regression in 77abeb3 the borked MDStapleOthers inheritance Add test case for verifying that stapling others is attempted.
1 parent c9a3db3 commit e46c9d4

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
v2.6.6
2+
----------------------------------------------------------------------------------------------------
13
* Fix a small memory leak when using OpenSSL's BIGNUMs. [Theo Buehler]
24
* Fix reuse of curl easy handles by resetting them. [Michael Kaufmann]
35

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515

1616
AC_PREREQ([2.69])
17-
AC_INIT([mod_md], [2.6.5], [[email protected]])
17+
AC_INIT([mod_md], [2.6.6], [[email protected]])
1818

1919
LT_PREREQ([2.2.6])
2020
LT_INIT()

src/md_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
* @macro
2828
* Version number of the md module as c string
2929
*/
30-
#define MOD_MD_VERSION "2.6.5-git"
30+
#define MOD_MD_VERSION "2.6.6-git"
3131

3232
/**
3333
* @macro
3434
* Numerical representation of the version number of the md module
3535
* release. This is a 24 bit number with 8 bits for major number, 8 bits
3636
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
3737
*/
38-
#define MOD_MD_VERSION_NUM 0x020605
38+
#define MOD_MD_VERSION_NUM 0x020606
3939

4040
#define MD_ACME_DEF_URL "https://acme-v02.api.letsencrypt.org/directory"
4141

src/mod_md_config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static void *md_config_merge(apr_pool_t *pool, void *basev, void *addv)
282282
nsc->profile = add->profile? add->profile : base->profile;
283283
nsc->profile_mandatory = (add->profile_mandatory != DEF_VAL)? add->profile_mandatory : base->profile_mandatory;
284284
nsc->stapling = (add->stapling != DEF_VAL)? add->stapling : base->stapling;
285+
nsc->staple_others = (add->staple_others != DEF_VAL)? add->staple_others : base->staple_others;
285286
nsc->ari_renewals = (add->ari_renewals != DEF_VAL)? add->ari_renewals : base->ari_renewals;
286287
nsc->dns01_cmd = (add->dns01_cmd)? add->dns01_cmd : base->dns01_cmd;
287288
nsc->current = NULL;

src/mod_md_ocsp.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,18 @@ int md_ocsp_prime_status(server_rec *s, apr_pool_t *p,
6161
apr_array_header_t *chain;
6262
apr_status_t rv = APR_ENOENT;
6363

64+
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, s, "ocsp prime status call for: %s",
65+
s->server_hostname);
6466
sc = md_config_get(s);
65-
if (!staple_here(sc)) goto cleanup;
67+
if (!staple_here(sc)) {
68+
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, s,
69+
"ocsp prime does not apply here: server=%s, sc=%d"
70+
"ocsp=%d, conf-ocsp=%d conf-others=%d",
71+
s->server_hostname, !!sc, sc? !!sc->mc->ocsp : 0,
72+
md_config_geti(sc, MD_CONFIG_STAPLING),
73+
md_config_geti(sc, MD_CONFIG_STAPLE_OTHERS));
74+
goto cleanup;
75+
}
6676

6777
md = ((sc->assigned && sc->assigned->nelts == 1)?
6878
APR_ARRAY_IDX(sc->assigned, 0, const md_t*) : NULL);

test/modules/md/test_801_stapling.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# test mod_md stapling support
22

33
import os
4+
import re
45
import time
56
from datetime import timedelta
67
import pytest
@@ -37,10 +38,11 @@ def _method_scope(self, env, request):
3738
yield
3839
env.apache_stop()
3940

40-
def configure_httpd(self, env, domains=None, add_lines="", ssl_stapling=False):
41+
def configure_httpd(self, env, domains=None, add_lines="", ssl_stapling=False,
42+
std_vhosts=True):
4143
if not isinstance(domains, list):
4244
domains = [domains] if domains else []
43-
conf = MDConf(env)
45+
conf = MDConf(env, std_vhosts=std_vhosts)
4446
conf.add("""
4547
<IfModule tls_module>
4648
LogLevel tls:trace4
@@ -423,3 +425,29 @@ def test_md_801_011(self, env):
423425
stat = env.await_ocsp_status(domain)
424426
assert stat['ocsp'] == "successful (0x0)"
425427
assert stat['verify'] == "0 (ok)"
428+
429+
# test MDStapleOthers setting
430+
def test_md_801_012(self, env):
431+
# turn stapling on, wait for it to appear in connections
432+
md = self.mdA
433+
conf = self.configure_httpd(env, std_vhosts=False)
434+
conf.add("MDStapling on")
435+
conf.add("MDStapleOthers on")
436+
conf.add("LogLevel md:debug")
437+
conf.start_vhost(md)
438+
conf.add_certificate(env.store_domain_file(md, 'pubcert.pem'),
439+
env.store_domain_file(md, 'privkey.pem'))
440+
conf.end_vhost()
441+
conf.install()
442+
env.httpd_error_log.clear_log()
443+
assert env.apache_restart() == 0, f'{env.apachectl_stderr}'
444+
try:
445+
stat = env.await_ocsp_status(md, timeout=1)
446+
except TimeoutError:
447+
pass
448+
if env.lacks_ocsp():
449+
assert env.httpd_error_log.scan_recent(
450+
pattern=re.compile(r'.*md\[other]: certificate with serial .* has no OCSP responder URL'))
451+
else:
452+
assert stat['ocsp'] == "successful (0x0)"
453+
assert stat['verify'] == "0 (ok)"

0 commit comments

Comments
 (0)