Merge ~sergiodj/ubuntu/+source/apache2:openssl-3-support into ubuntu/+source/apache2:ubuntu/devel
- Git
- lp:~sergiodj/ubuntu/+source/apache2
- openssl-3-support
- Merge into ubuntu/devel
Status: | Merged |
---|---|
Merge reported by: | Sergio Durigan Junior |
Merged at revision: | 7564cdd51e8656e7c8559291298c94e758bbc4f3 |
Proposed branch: | ~sergiodj/ubuntu/+source/apache2:openssl-3-support |
Merge into: | ubuntu/+source/apache2:ubuntu/devel |
Diff against target: |
976 lines (+900/-0) 12 files modified
debian/changelog (+8/-0) debian/patches/series (+10/-0) debian/patches/support-openssl3-001.patch (+88/-0) debian/patches/support-openssl3-002.patch (+345/-0) debian/patches/support-openssl3-003.patch (+48/-0) debian/patches/support-openssl3-004.patch (+56/-0) debian/patches/support-openssl3-005.patch (+121/-0) debian/patches/support-openssl3-006.patch (+33/-0) debian/patches/support-openssl3-007.patch (+72/-0) debian/patches/support-openssl3-008.patch (+29/-0) debian/patches/support-openssl3-009.patch (+36/-0) debian/patches/support-openssl3-010.patch (+54/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bryce Harrington (community) | Approve | ||
Canonical Server packageset reviewers | Pending | ||
Review via email: mp+412548@code.launchpad.net |
Commit message
Description of the change
This MP is an attempt to fix apache2's mod-ssl's failures that happen when one starts apache2 with OpenSSL 3 installed.
As I said during our standup a few times, these patches are part of an upstream PR that is still open, so I was monitoring the situation to see what upstream would decide. There is a possible regression/
===
With r1890067 (9eb262f) enabling the OpenSSL auto-DH-parameter selection overrides user-supplied DH parameters which are now ignored. This is not necessary for OpenSSL 1.1 (which that patch affects) and is only removing a "deprecated" function so not strictly necessary for 3.0 either. Need to ponder this one.
===
There was also a problem with one of the functions exported by OpenSSL 3's and used by mod_ssl, which has been reported and fixed by OpenSSL upstream:
https:/
I checked and the fix is present in our copy of OpenSSL, so we're fine in this regard.
Either way, I think it should be safe enough for us to backport the patches from the upstream PR so that we have an apache2 that builds and works fine with mod_ssl + OpenSSL 3. I'm also subscribed to the PR, so if there are any changes there it should be pretty quick to bring them to Ubuntu.
For this change, I created a bileto ticket here:
https:/
with a corresponding PPA here:
https:/
autopkgtest is back to normal:
autopkgtest [17:08:19]: @@@@@@@
run-test-suite PASS
duplicate-
htcacheclean PASS
default-mods PASS
ssl-passphrase PASS
check-http2 PASS
chroot PASS
It's important to mention that bileto also ran autopkgtest against apache2 and its dependencies; you will see a bunch of results here:
https:/
The problem is that -proposed wasn't enabled when running the tests, which means that they will be listed as failures. I didn't know how to retrigger them automatically with '&all-proposed=1', so I didn't.
All in all, I think the pros outweigh the cons here and I believe it's worth backporting these patches in order to unblock OpenSSL 3, squid and possibly other dependencies in -proposed.
Bryce Harrington (bryce) wrote : | # |
(Sorry, seems Launchpad auto-added me to the canonical-server slot; if possible please re-add that as I seem to not be able to do that.)
Sergio Durigan Junior (sergiodj) wrote : | # |
On Tuesday, November 30 2021, Bryce Harrington wrote:
> Thanks for tackling this, looks like you've researched the situation
> quite thoroughly. I've verified the builds all look good in the PPA,
> and it builds fine for me locally as well. The autopkgtest failures
> (https:/
> I can believe that it just needs -proposed enabled.
Thanks for the review, Bryce.
Yeah, the autopkgtest failures are happening because they're not running
against -proposed, which triggers a failure when trying to install
openssl3 into the testbed. I'm not expecting these tests to fail when
we run them with the right openssl trigger.
> I am planning on tackling the merge for apache2 at some point here, so
> it would be great to get this MP landed, and thus agree the pros
> outweigh the cons. When I do get to the merge, that will be an
> additional checkpoint where we can see where things sit upstream and
> to make any necessary corrections, and in the immediate term this will
> help with the openssl 3.0 transition.
Yeah. I don't know when upstream plans to merge that PR, nor when they
intend to release a new 2.4.x version with the fix included, so I'm not
expecting us to be able to get this change through upstream and drop the
delta. We may need to revisit these patches when we merge apache2 and
check if upstream has fixed/changed something in them; I will leave a
message in the apache2 merge bug as a reminder.
Uploaded:
$ dput apache2_
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/
Checking signature on .dsc
gpg: /home/sergio/
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading apache2_
Uploading apache2_
Uploading apache2_
Uploading apache2_
Successfully uploaded packages.
Thanks,
--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14
Preview Diff
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 0dbb7c5..1aefacb 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,11 @@ | |||
6 | 1 | apache2 (2.4.48-3.1ubuntu4) jammy; urgency=medium | ||
7 | 2 | |||
8 | 3 | * d/p/support-openssl3-*.patch: Backport various patches from | ||
9 | 4 | https://github.com/apache/httpd/pull/258 in order to fix mod_ssl's | ||
10 | 5 | failure to load when using OpenSSL 3. (LP: #1951476) | ||
11 | 6 | |||
12 | 7 | -- Sergio Durigan Junior <sergio.durigan@canonical.com> Fri, 26 Nov 2021 16:07:56 -0500 | ||
13 | 8 | |||
14 | 1 | apache2 (2.4.48-3.1ubuntu3) impish; urgency=medium | 9 | apache2 (2.4.48-3.1ubuntu3) impish; urgency=medium |
15 | 2 | 10 | ||
16 | 3 | * SECURITY REGRESSION: Issues in UDS URIs (LP: #1945311) | 11 | * SECURITY REGRESSION: Issues in UDS URIs (LP: #1945311) |
17 | diff --git a/debian/patches/series b/debian/patches/series | |||
18 | index 149e28d..0b07ccb 100644 | |||
19 | --- a/debian/patches/series | |||
20 | +++ b/debian/patches/series | |||
21 | @@ -19,3 +19,13 @@ CVE-2021-40438.patch | |||
22 | 19 | CVE-2021-33193.patch | 19 | CVE-2021-33193.patch |
23 | 20 | CVE-2021-40438-2.patch | 20 | CVE-2021-40438-2.patch |
24 | 21 | CVE-2021-40438-3.patch | 21 | CVE-2021-40438-3.patch |
25 | 22 | support-openssl3-001.patch | ||
26 | 23 | support-openssl3-002.patch | ||
27 | 24 | support-openssl3-003.patch | ||
28 | 25 | support-openssl3-004.patch | ||
29 | 26 | support-openssl3-005.patch | ||
30 | 27 | support-openssl3-006.patch | ||
31 | 28 | support-openssl3-007.patch | ||
32 | 29 | support-openssl3-008.patch | ||
33 | 30 | support-openssl3-009.patch | ||
34 | 31 | support-openssl3-010.patch | ||
35 | diff --git a/debian/patches/support-openssl3-001.patch b/debian/patches/support-openssl3-001.patch | |||
36 | 22 | new file mode 100644 | 32 | new file mode 100644 |
37 | index 0000000..d7d386d | |||
38 | --- /dev/null | |||
39 | +++ b/debian/patches/support-openssl3-001.patch | |||
40 | @@ -0,0 +1,88 @@ | |||
41 | 1 | From: Joe Orton <jorton@redhat.com> | ||
42 | 2 | Date: Mon, 26 Jul 2021 12:23:24 +0100 | ||
43 | 3 | Subject: add some log messages and AP_DEBUG_ASSERTs for functions that should | ||
44 | 4 | never be called | ||
45 | 5 | |||
46 | 6 | Submitted by: sf | ||
47 | 7 | |||
48 | 8 | |||
49 | 9 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
50 | 10 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
51 | 11 | --- | ||
52 | 12 | modules/ssl/ssl_engine_io.c | 28 ++++++++++++++++++++++++++++ | ||
53 | 13 | 1 file changed, 28 insertions(+) | ||
54 | 14 | |||
55 | 15 | diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c | ||
56 | 16 | index cabf753..ed9db54 100644 | ||
57 | 17 | --- a/modules/ssl/ssl_engine_io.c | ||
58 | 18 | +++ b/modules/ssl/ssl_engine_io.c | ||
59 | 19 | @@ -194,6 +194,10 @@ static int bio_filter_destroy(BIO *bio) | ||
60 | 20 | static int bio_filter_out_read(BIO *bio, char *out, int outl) | ||
61 | 21 | { | ||
62 | 22 | /* this is never called */ | ||
63 | 23 | + bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr); | ||
64 | 24 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, outctx->c, | ||
65 | 25 | + "BUG: %s() should not be called", "bio_filter_out_read"); | ||
66 | 26 | + AP_DEBUG_ASSERT(0); | ||
67 | 27 | return -1; | ||
68 | 28 | } | ||
69 | 29 | |||
70 | 30 | @@ -293,12 +297,20 @@ static long bio_filter_out_ctrl(BIO *bio, int cmd, long num, void *ptr) | ||
71 | 31 | static int bio_filter_out_gets(BIO *bio, char *buf, int size) | ||
72 | 32 | { | ||
73 | 33 | /* this is never called */ | ||
74 | 34 | + bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr); | ||
75 | 35 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, outctx->c, | ||
76 | 36 | + "BUG: %s() should not be called", "bio_filter_out_gets"); | ||
77 | 37 | + AP_DEBUG_ASSERT(0); | ||
78 | 38 | return -1; | ||
79 | 39 | } | ||
80 | 40 | |||
81 | 41 | static int bio_filter_out_puts(BIO *bio, const char *str) | ||
82 | 42 | { | ||
83 | 43 | /* this is never called */ | ||
84 | 44 | + bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr); | ||
85 | 45 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, outctx->c, | ||
86 | 46 | + "BUG: %s() should not be called", "bio_filter_out_puts"); | ||
87 | 47 | + AP_DEBUG_ASSERT(0); | ||
88 | 48 | return -1; | ||
89 | 49 | } | ||
90 | 50 | |||
91 | 51 | @@ -533,21 +545,37 @@ static int bio_filter_in_read(BIO *bio, char *in, int inlen) | ||
92 | 52 | |||
93 | 53 | static int bio_filter_in_write(BIO *bio, const char *in, int inl) | ||
94 | 54 | { | ||
95 | 55 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
96 | 56 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
97 | 57 | + "BUG: %s() should not be called", "bio_filter_in_write"); | ||
98 | 58 | + AP_DEBUG_ASSERT(0); | ||
99 | 59 | return -1; | ||
100 | 60 | } | ||
101 | 61 | |||
102 | 62 | static int bio_filter_in_puts(BIO *bio, const char *str) | ||
103 | 63 | { | ||
104 | 64 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
105 | 65 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
106 | 66 | + "BUG: %s() should not be called", "bio_filter_in_puts"); | ||
107 | 67 | + AP_DEBUG_ASSERT(0); | ||
108 | 68 | return -1; | ||
109 | 69 | } | ||
110 | 70 | |||
111 | 71 | static int bio_filter_in_gets(BIO *bio, char *buf, int size) | ||
112 | 72 | { | ||
113 | 73 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
114 | 74 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
115 | 75 | + "BUG: %s() should not be called", "bio_filter_in_gets"); | ||
116 | 76 | + AP_DEBUG_ASSERT(0); | ||
117 | 77 | return -1; | ||
118 | 78 | } | ||
119 | 79 | |||
120 | 80 | static long bio_filter_in_ctrl(BIO *bio, int cmd, long num, void *ptr) | ||
121 | 81 | { | ||
122 | 82 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
123 | 83 | + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
124 | 84 | + "BUG: %s() should not be called", "bio_filter_in_ctrl"); | ||
125 | 85 | + AP_DEBUG_ASSERT(0); | ||
126 | 86 | return -1; | ||
127 | 87 | } | ||
128 | 88 | |||
129 | diff --git a/debian/patches/support-openssl3-002.patch b/debian/patches/support-openssl3-002.patch | |||
130 | 0 | new file mode 100644 | 89 | new file mode 100644 |
131 | index 0000000..3a56106 | |||
132 | --- /dev/null | |||
133 | +++ b/debian/patches/support-openssl3-002.patch | |||
134 | @@ -0,0 +1,345 @@ | |||
135 | 1 | From: Joe Orton <jorton@redhat.com> | ||
136 | 2 | Date: Mon, 26 Jul 2021 12:24:24 +0100 | ||
137 | 3 | Subject: mod_ssl: add compatibility with OpenSSL 3.0.0 | ||
138 | 4 | |||
139 | 5 | Wrappers around deprecated API: | ||
140 | 6 | * X509_STORE_load_locations() => modssl_X509_STORE_load_locations(), | ||
141 | 7 | * CTX_load_verify_locations() => modssl_CTX_load_verify_locations(), | ||
142 | 8 | * ERR_peek_error_line_data() => modssl_ERR_peek_error_data(), | ||
143 | 9 | * DH_bits(dh) => BN_num_bits(DH_get0_p(dh)). | ||
144 | 10 | |||
145 | 11 | Provide a compatible version of ssl_callback_SessionTicket() which does not | ||
146 | 12 | use the deprecated HMAC_CTX and HMAC_Init_ex(), replaced by EVP_MAC_CTX and | ||
147 | 13 | EVP_MAC_CTX_set_params() respectively. This requires adapting struct | ||
148 | 14 | modssl_ticket_key_t to replace hmac_secret[] with OSSL_PARAM mac_params[], | ||
149 | 15 | created once at load time still. | ||
150 | 16 | The callback is registered by SSL_CTX_set_tlsext_ticket_key_evp_cb() instead | ||
151 | 17 | of SSL_CTX_set_tlsext_ticket_key_cb(). | ||
152 | 18 | |||
153 | 19 | Since BIO_eof() may now be called openssl-3 state machine, the never-called | ||
154 | 20 | assertion in bio_filter_in_ctrl() does not hold anymore, and we have to | ||
155 | 21 | handle BIO_CTRL_EOF. For any other cmd, we continue to AP_DEBUG_ASSERT(0) and | ||
156 | 22 | log an error, yet the return value is changed from -1 to 0 which is the usual | ||
157 | 23 | unhandled value. | ||
158 | 24 | |||
159 | 25 | Note that OpenSSL 3.0.0 is still in alpha stage as of now, the API shouldn't | ||
160 | 26 | change though, neither breakage to 1.x.x API. | ||
161 | 27 | |||
162 | 28 | Submitted by: ylavic | ||
163 | 29 | |||
164 | 30 | |||
165 | 31 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
166 | 32 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
167 | 33 | --- | ||
168 | 34 | modules/ssl/ssl_engine_init.c | 76 ++++++++++++++++++++++++++++++++--------- | ||
169 | 35 | modules/ssl/ssl_engine_io.c | 17 ++++++--- | ||
170 | 36 | modules/ssl/ssl_engine_kernel.c | 22 ++++++++++-- | ||
171 | 37 | modules/ssl/ssl_engine_log.c | 12 ++++++- | ||
172 | 38 | modules/ssl/ssl_private.h | 19 +++++++++-- | ||
173 | 39 | 5 files changed, 120 insertions(+), 26 deletions(-) | ||
174 | 40 | |||
175 | 41 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
176 | 42 | index 4da24ed..eb41e7f 100644 | ||
177 | 43 | --- a/modules/ssl/ssl_engine_init.c | ||
178 | 44 | +++ b/modules/ssl/ssl_engine_init.c | ||
179 | 45 | @@ -843,6 +843,23 @@ static void ssl_init_ctx_callbacks(server_rec *s, | ||
180 | 46 | #endif | ||
181 | 47 | } | ||
182 | 48 | |||
183 | 49 | +static APR_INLINE | ||
184 | 50 | +int modssl_CTX_load_verify_locations(SSL_CTX *ctx, | ||
185 | 51 | + const char *file, | ||
186 | 52 | + const char *path) | ||
187 | 53 | +{ | ||
188 | 54 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
189 | 55 | + if (!SSL_CTX_load_verify_locations(ctx, file, path)) | ||
190 | 56 | + return 0; | ||
191 | 57 | +#else | ||
192 | 58 | + if (file && !SSL_CTX_load_verify_file(ctx, file)) | ||
193 | 59 | + return 0; | ||
194 | 60 | + if (path && !SSL_CTX_load_verify_dir(ctx, path)) | ||
195 | 61 | + return 0; | ||
196 | 62 | +#endif | ||
197 | 63 | + return 1; | ||
198 | 64 | +} | ||
199 | 65 | + | ||
200 | 66 | static apr_status_t ssl_init_ctx_verify(server_rec *s, | ||
201 | 67 | apr_pool_t *p, | ||
202 | 68 | apr_pool_t *ptemp, | ||
203 | 69 | @@ -883,10 +900,8 @@ static apr_status_t ssl_init_ctx_verify(server_rec *s, | ||
204 | 70 | ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, s, | ||
205 | 71 | "Configuring client authentication"); | ||
206 | 72 | |||
207 | 73 | - if (!SSL_CTX_load_verify_locations(ctx, | ||
208 | 74 | - mctx->auth.ca_cert_file, | ||
209 | 75 | - mctx->auth.ca_cert_path)) | ||
210 | 76 | - { | ||
211 | 77 | + if (!modssl_CTX_load_verify_locations(ctx, mctx->auth.ca_cert_file, | ||
212 | 78 | + mctx->auth.ca_cert_path)) { | ||
213 | 79 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01895) | ||
214 | 80 | "Unable to configure verify locations " | ||
215 | 81 | "for client authentication"); | ||
216 | 82 | @@ -971,6 +986,23 @@ static apr_status_t ssl_init_ctx_cipher_suite(server_rec *s, | ||
217 | 83 | return APR_SUCCESS; | ||
218 | 84 | } | ||
219 | 85 | |||
220 | 86 | +static APR_INLINE | ||
221 | 87 | +int modssl_X509_STORE_load_locations(X509_STORE *store, | ||
222 | 88 | + const char *file, | ||
223 | 89 | + const char *path) | ||
224 | 90 | +{ | ||
225 | 91 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
226 | 92 | + if (!X509_STORE_load_locations(store, file, path)) | ||
227 | 93 | + return 0; | ||
228 | 94 | +#else | ||
229 | 95 | + if (file && !X509_STORE_load_file(store, file)) | ||
230 | 96 | + return 0; | ||
231 | 97 | + if (path && !X509_STORE_load_path(store, path)) | ||
232 | 98 | + return 0; | ||
233 | 99 | +#endif | ||
234 | 100 | + return 1; | ||
235 | 101 | +} | ||
236 | 102 | + | ||
237 | 103 | static apr_status_t ssl_init_ctx_crl(server_rec *s, | ||
238 | 104 | apr_pool_t *p, | ||
239 | 105 | apr_pool_t *ptemp, | ||
240 | 106 | @@ -1009,8 +1041,8 @@ static apr_status_t ssl_init_ctx_crl(server_rec *s, | ||
241 | 107 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01900) | ||
242 | 108 | "Configuring certificate revocation facility"); | ||
243 | 109 | |||
244 | 110 | - if (!store || !X509_STORE_load_locations(store, mctx->crl_file, | ||
245 | 111 | - mctx->crl_path)) { | ||
246 | 112 | + if (!store || modssl_X509_STORE_load_locations(store, mctx->crl_file, | ||
247 | 113 | + mctx->crl_path)) { | ||
248 | 114 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01901) | ||
249 | 115 | "Host %s: unable to configure X.509 CRL storage " | ||
250 | 116 | "for certificate revocation", mctx->sc->vhost_id); | ||
251 | 117 | @@ -1249,7 +1281,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s, | ||
252 | 118 | const char *vhost_id = mctx->sc->vhost_id, *key_id, *certfile, *keyfile; | ||
253 | 119 | int i; | ||
254 | 120 | X509 *cert; | ||
255 | 121 | - DH *dhparams; | ||
256 | 122 | + DH *dh; | ||
257 | 123 | #ifdef HAVE_ECC | ||
258 | 124 | EC_GROUP *ecparams = NULL; | ||
259 | 125 | int nid; | ||
260 | 126 | @@ -1434,12 +1466,12 @@ static apr_status_t ssl_init_server_certs(server_rec *s, | ||
261 | 127 | */ | ||
262 | 128 | certfile = APR_ARRAY_IDX(mctx->pks->cert_files, 0, const char *); | ||
263 | 129 | if (certfile && !modssl_is_engine_id(certfile) | ||
264 | 130 | - && (dhparams = ssl_dh_GetParamFromFile(certfile))) { | ||
265 | 131 | - SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dhparams); | ||
266 | 132 | + && (dh = ssl_dh_GetParamFromFile(certfile))) { | ||
267 | 133 | + SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dh); | ||
268 | 134 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02540) | ||
269 | 135 | "Custom DH parameters (%d bits) for %s loaded from %s", | ||
270 | 136 | - DH_bits(dhparams), vhost_id, certfile); | ||
271 | 137 | - DH_free(dhparams); | ||
272 | 138 | + BN_num_bits(DH_get0_p(dh)), vhost_id, certfile); | ||
273 | 139 | + DH_free(dh); | ||
274 | 140 | } | ||
275 | 141 | |||
276 | 142 | #ifdef HAVE_ECC | ||
277 | 143 | @@ -1490,6 +1522,7 @@ static apr_status_t ssl_init_ticket_key(server_rec *s, | ||
278 | 144 | char buf[TLSEXT_TICKET_KEY_LEN]; | ||
279 | 145 | char *path; | ||
280 | 146 | modssl_ticket_key_t *ticket_key = mctx->ticket_key; | ||
281 | 147 | + int res; | ||
282 | 148 | |||
283 | 149 | if (!ticket_key->file_path) { | ||
284 | 150 | return APR_SUCCESS; | ||
285 | 151 | @@ -1517,11 +1550,22 @@ static apr_status_t ssl_init_ticket_key(server_rec *s, | ||
286 | 152 | } | ||
287 | 153 | |||
288 | 154 | memcpy(ticket_key->key_name, buf, 16); | ||
289 | 155 | - memcpy(ticket_key->hmac_secret, buf + 16, 16); | ||
290 | 156 | memcpy(ticket_key->aes_key, buf + 32, 16); | ||
291 | 157 | - | ||
292 | 158 | - if (!SSL_CTX_set_tlsext_ticket_key_cb(mctx->ssl_ctx, | ||
293 | 159 | - ssl_callback_SessionTicket)) { | ||
294 | 160 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
295 | 161 | + memcpy(ticket_key->hmac_secret, buf + 16, 16); | ||
296 | 162 | + res = SSL_CTX_set_tlsext_ticket_key_cb(mctx->ssl_ctx, | ||
297 | 163 | + ssl_callback_SessionTicket); | ||
298 | 164 | +#else | ||
299 | 165 | + ticket_key->mac_params[0] = | ||
300 | 166 | + OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, buf + 16, 16); | ||
301 | 167 | + ticket_key->mac_params[1] = | ||
302 | 168 | + OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, "sha256", 0); | ||
303 | 169 | + ticket_key->mac_params[2] = | ||
304 | 170 | + OSSL_PARAM_construct_end(); | ||
305 | 171 | + res = SSL_CTX_set_tlsext_ticket_key_evp_cb(mctx->ssl_ctx, | ||
306 | 172 | + ssl_callback_SessionTicket); | ||
307 | 173 | +#endif | ||
308 | 174 | + if (!res) { | ||
309 | 175 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01913) | ||
310 | 176 | "Unable to initialize TLS session ticket key callback " | ||
311 | 177 | "(incompatible OpenSSL version?)"); | ||
312 | 178 | @@ -1652,7 +1696,7 @@ static apr_status_t ssl_init_proxy_certs(server_rec *s, | ||
313 | 179 | return ssl_die(s); | ||
314 | 180 | } | ||
315 | 181 | |||
316 | 182 | - X509_STORE_load_locations(store, pkp->ca_cert_file, NULL); | ||
317 | 183 | + modssl_X509_STORE_load_locations(store, pkp->ca_cert_file, NULL); | ||
318 | 184 | |||
319 | 185 | for (n = 0; n < ncerts; n++) { | ||
320 | 186 | int i; | ||
321 | 187 | diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c | ||
322 | 188 | index ed9db54..f7e5cfc 100644 | ||
323 | 189 | --- a/modules/ssl/ssl_engine_io.c | ||
324 | 190 | +++ b/modules/ssl/ssl_engine_io.c | ||
325 | 191 | @@ -572,11 +572,20 @@ static int bio_filter_in_gets(BIO *bio, char *buf, int size) | ||
326 | 192 | |||
327 | 193 | static long bio_filter_in_ctrl(BIO *bio, int cmd, long num, void *ptr) | ||
328 | 194 | { | ||
329 | 195 | - bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
330 | 196 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)BIO_get_data(bio); | ||
331 | 197 | + switch (cmd) { | ||
332 | 198 | +#ifdef BIO_CTRL_EOF | ||
333 | 199 | + case BIO_CTRL_EOF: | ||
334 | 200 | + return inctx->rc == APR_EOF; | ||
335 | 201 | +#endif | ||
336 | 202 | + default: | ||
337 | 203 | + break; | ||
338 | 204 | + } | ||
339 | 205 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
340 | 206 | - "BUG: %s() should not be called", "bio_filter_in_ctrl"); | ||
341 | 207 | + "BUG: bio_filter_in_ctrl() should not be called with cmd=%i", | ||
342 | 208 | + cmd); | ||
343 | 209 | AP_DEBUG_ASSERT(0); | ||
344 | 210 | - return -1; | ||
345 | 211 | + return 0; | ||
346 | 212 | } | ||
347 | 213 | |||
348 | 214 | #if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
349 | 215 | @@ -601,7 +610,7 @@ static BIO_METHOD bio_filter_in_method = { | ||
350 | 216 | bio_filter_in_read, | ||
351 | 217 | bio_filter_in_puts, /* puts is never called */ | ||
352 | 218 | bio_filter_in_gets, /* gets is never called */ | ||
353 | 219 | - bio_filter_in_ctrl, /* ctrl is never called */ | ||
354 | 220 | + bio_filter_in_ctrl, /* ctrl is called for EOF check */ | ||
355 | 221 | bio_filter_create, | ||
356 | 222 | bio_filter_destroy, | ||
357 | 223 | NULL | ||
358 | 224 | diff --git a/modules/ssl/ssl_engine_kernel.c b/modules/ssl/ssl_engine_kernel.c | ||
359 | 225 | index b99dcf1..f2d49ad 100644 | ||
360 | 226 | --- a/modules/ssl/ssl_engine_kernel.c | ||
361 | 227 | +++ b/modules/ssl/ssl_engine_kernel.c | ||
362 | 228 | @@ -2614,7 +2614,11 @@ int ssl_callback_SessionTicket(SSL *ssl, | ||
363 | 229 | unsigned char *keyname, | ||
364 | 230 | unsigned char *iv, | ||
365 | 231 | EVP_CIPHER_CTX *cipher_ctx, | ||
366 | 232 | - HMAC_CTX *hctx, | ||
367 | 233 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
368 | 234 | + HMAC_CTX *hmac_ctx, | ||
369 | 235 | +#else | ||
370 | 236 | + EVP_MAC_CTX *mac_ctx, | ||
371 | 237 | +#endif | ||
372 | 238 | int mode) | ||
373 | 239 | { | ||
374 | 240 | conn_rec *c = (conn_rec *)SSL_get_app_data(ssl); | ||
375 | 241 | @@ -2641,7 +2645,13 @@ int ssl_callback_SessionTicket(SSL *ssl, | ||
376 | 242 | } | ||
377 | 243 | EVP_EncryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL, | ||
378 | 244 | ticket_key->aes_key, iv); | ||
379 | 245 | - HMAC_Init_ex(hctx, ticket_key->hmac_secret, 16, tlsext_tick_md(), NULL); | ||
380 | 246 | + | ||
381 | 247 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
382 | 248 | + HMAC_Init_ex(hmac_ctx, ticket_key->hmac_secret, 16, | ||
383 | 249 | + tlsext_tick_md(), NULL); | ||
384 | 250 | +#else | ||
385 | 251 | + EVP_MAC_CTX_set_params(mac_ctx, ticket_key->mac_params); | ||
386 | 252 | +#endif | ||
387 | 253 | |||
388 | 254 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(02289) | ||
389 | 255 | "TLS session ticket key for %s successfully set, " | ||
390 | 256 | @@ -2662,7 +2672,13 @@ int ssl_callback_SessionTicket(SSL *ssl, | ||
391 | 257 | |||
392 | 258 | EVP_DecryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL, | ||
393 | 259 | ticket_key->aes_key, iv); | ||
394 | 260 | - HMAC_Init_ex(hctx, ticket_key->hmac_secret, 16, tlsext_tick_md(), NULL); | ||
395 | 261 | + | ||
396 | 262 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
397 | 263 | + HMAC_Init_ex(hmac_ctx, ticket_key->hmac_secret, 16, | ||
398 | 264 | + tlsext_tick_md(), NULL); | ||
399 | 265 | +#else | ||
400 | 266 | + EVP_MAC_CTX_set_params(mac_ctx, ticket_key->mac_params); | ||
401 | 267 | +#endif | ||
402 | 268 | |||
403 | 269 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(02290) | ||
404 | 270 | "TLS session ticket key for %s successfully set, " | ||
405 | 271 | diff --git a/modules/ssl/ssl_engine_log.c b/modules/ssl/ssl_engine_log.c | ||
406 | 272 | index 7dbbbdb..3b3ceac 100644 | ||
407 | 273 | --- a/modules/ssl/ssl_engine_log.c | ||
408 | 274 | +++ b/modules/ssl/ssl_engine_log.c | ||
409 | 275 | @@ -78,6 +78,16 @@ apr_status_t ssl_die(server_rec *s) | ||
410 | 276 | return APR_EGENERAL; | ||
411 | 277 | } | ||
412 | 278 | |||
413 | 279 | +static APR_INLINE | ||
414 | 280 | +unsigned long modssl_ERR_peek_error_data(const char **data, int *flags) | ||
415 | 281 | +{ | ||
416 | 282 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
417 | 283 | + return ERR_peek_error_line_data(NULL, NULL, data, flags); | ||
418 | 284 | +#else | ||
419 | 285 | + return ERR_peek_error_data(data, flags); | ||
420 | 286 | +#endif | ||
421 | 287 | +} | ||
422 | 288 | + | ||
423 | 289 | /* | ||
424 | 290 | * Prints the SSL library error information. | ||
425 | 291 | */ | ||
426 | 292 | @@ -87,7 +97,7 @@ void ssl_log_ssl_error(const char *file, int line, int level, server_rec *s) | ||
427 | 293 | const char *data; | ||
428 | 294 | int flags; | ||
429 | 295 | |||
430 | 296 | - while ((e = ERR_peek_error_line_data(NULL, NULL, &data, &flags))) { | ||
431 | 297 | + while ((e = modssl_ERR_peek_error_data(&data, &flags))) { | ||
432 | 298 | const char *annotation; | ||
433 | 299 | char err[256]; | ||
434 | 300 | |||
435 | 301 | diff --git a/modules/ssl/ssl_private.h b/modules/ssl/ssl_private.h | ||
436 | 302 | index a6fc751..71d658c 100644 | ||
437 | 303 | --- a/modules/ssl/ssl_private.h | ||
438 | 304 | +++ b/modules/ssl/ssl_private.h | ||
439 | 305 | @@ -89,6 +89,9 @@ | ||
440 | 306 | /* must be defined before including ssl.h */ | ||
441 | 307 | #define OPENSSL_NO_SSL_INTERN | ||
442 | 308 | #endif | ||
443 | 309 | +#if OPENSSL_VERSION_NUMBER >= 0x30000000 | ||
444 | 310 | +#include <openssl/core_names.h> | ||
445 | 311 | +#endif | ||
446 | 312 | #include <openssl/ssl.h> | ||
447 | 313 | #include <openssl/err.h> | ||
448 | 314 | #include <openssl/x509.h> | ||
449 | 315 | @@ -674,7 +677,11 @@ typedef struct { | ||
450 | 316 | typedef struct { | ||
451 | 317 | const char *file_path; | ||
452 | 318 | unsigned char key_name[16]; | ||
453 | 319 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
454 | 320 | unsigned char hmac_secret[16]; | ||
455 | 321 | +#else | ||
456 | 322 | + OSSL_PARAM mac_params[3]; | ||
457 | 323 | +#endif | ||
458 | 324 | unsigned char aes_key[16]; | ||
459 | 325 | } modssl_ticket_key_t; | ||
460 | 326 | #endif | ||
461 | 327 | @@ -938,8 +945,16 @@ int ssl_callback_ServerNameIndication(SSL *, int *, modssl_ctx_t *); | ||
462 | 328 | int ssl_callback_ClientHello(SSL *, int *, void *); | ||
463 | 329 | #endif | ||
464 | 330 | #ifdef HAVE_TLS_SESSION_TICKETS | ||
465 | 331 | -int ssl_callback_SessionTicket(SSL *, unsigned char *, unsigned char *, | ||
466 | 332 | - EVP_CIPHER_CTX *, HMAC_CTX *, int); | ||
467 | 333 | +int ssl_callback_SessionTicket(SSL *ssl, | ||
468 | 334 | + unsigned char *keyname, | ||
469 | 335 | + unsigned char *iv, | ||
470 | 336 | + EVP_CIPHER_CTX *cipher_ctx, | ||
471 | 337 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
472 | 338 | + HMAC_CTX *hmac_ctx, | ||
473 | 339 | +#else | ||
474 | 340 | + EVP_MAC_CTX *mac_ctx, | ||
475 | 341 | +#endif | ||
476 | 342 | + int mode); | ||
477 | 343 | #endif | ||
478 | 344 | |||
479 | 345 | #ifdef HAVE_TLS_ALPN | ||
480 | diff --git a/debian/patches/support-openssl3-003.patch b/debian/patches/support-openssl3-003.patch | |||
481 | 0 | new file mode 100644 | 346 | new file mode 100644 |
482 | index 0000000..06906a9 | |||
483 | --- /dev/null | |||
484 | +++ b/debian/patches/support-openssl3-003.patch | |||
485 | @@ -0,0 +1,48 @@ | |||
486 | 1 | From: Joe Orton <jorton@redhat.com> | ||
487 | 2 | Date: Mon, 26 Jul 2021 12:24:27 +0100 | ||
488 | 3 | Subject: mod_ssl: follow up to r1876934: wrap DH_bits() | ||
489 | 4 | |||
490 | 5 | DH_get0_p() seems to be undefined for some openssl versions, so it can't | ||
491 | 6 | be used to implement DH_bits() generically. | ||
492 | 7 | |||
493 | 8 | Add new a modssl_DH_bits() wrapper to call DH_bits() for openssl < 3, | ||
494 | 9 | and BN_num_bits(DH_get0_p(dh)) otherwise. | ||
495 | 10 | |||
496 | 11 | Submitted by: ylavic | ||
497 | 12 | |||
498 | 13 | |||
499 | 14 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
500 | 15 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
501 | 16 | --- | ||
502 | 17 | modules/ssl/ssl_engine_init.c | 11 ++++++++++- | ||
503 | 18 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
504 | 19 | |||
505 | 20 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
506 | 21 | index eb41e7f..a2da916 100644 | ||
507 | 22 | --- a/modules/ssl/ssl_engine_init.c | ||
508 | 23 | +++ b/modules/ssl/ssl_engine_init.c | ||
509 | 24 | @@ -1271,6 +1271,15 @@ static int ssl_no_passwd_prompt_cb(char *buf, int size, int rwflag, | ||
510 | 25 | return 0; | ||
511 | 26 | } | ||
512 | 27 | |||
513 | 28 | +static APR_INLINE int modssl_DH_bits(DH *dh) | ||
514 | 29 | +{ | ||
515 | 30 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
516 | 31 | + return DH_bits(dh); | ||
517 | 32 | +#else | ||
518 | 33 | + return BN_num_bits(DH_get0_p(dh)); | ||
519 | 34 | +#endif | ||
520 | 35 | +} | ||
521 | 36 | + | ||
522 | 37 | static apr_status_t ssl_init_server_certs(server_rec *s, | ||
523 | 38 | apr_pool_t *p, | ||
524 | 39 | apr_pool_t *ptemp, | ||
525 | 40 | @@ -1470,7 +1479,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s, | ||
526 | 41 | SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dh); | ||
527 | 42 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02540) | ||
528 | 43 | "Custom DH parameters (%d bits) for %s loaded from %s", | ||
529 | 44 | - BN_num_bits(DH_get0_p(dh)), vhost_id, certfile); | ||
530 | 45 | + modssl_DH_bits(dh), vhost_id, certfile); | ||
531 | 46 | DH_free(dh); | ||
532 | 47 | } | ||
533 | 48 | |||
534 | diff --git a/debian/patches/support-openssl3-004.patch b/debian/patches/support-openssl3-004.patch | |||
535 | 0 | new file mode 100644 | 49 | new file mode 100644 |
536 | index 0000000..5566eaf | |||
537 | --- /dev/null | |||
538 | +++ b/debian/patches/support-openssl3-004.patch | |||
539 | @@ -0,0 +1,56 @@ | |||
540 | 1 | From: Joe Orton <jorton@redhat.com> | ||
541 | 2 | Date: Mon, 26 Jul 2021 12:24:46 +0100 | ||
542 | 3 | Subject: * modules/ssl/ssl_engine_init.c (ssl_init_server_certs): Fix use of | ||
543 | 4 | encrypted private keys with OpenSSL 3.0. | ||
544 | 5 | |||
545 | 6 | * test/travis_run_linux.sh: For TEST_SSL, test loading encrypted | ||
546 | 7 | private keys. | ||
547 | 8 | |||
548 | 9 | Github: closes #{197} | ||
549 | 10 | |||
550 | 11 | Submitted by: jorton | ||
551 | 12 | |||
552 | 13 | |||
553 | 14 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
554 | 15 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
555 | 16 | --- | ||
556 | 17 | modules/ssl/ssl_engine_init.c | 19 +++++++++++++++++-- | ||
557 | 18 | 1 file changed, 17 insertions(+), 2 deletions(-) | ||
558 | 19 | |||
559 | 20 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
560 | 21 | index a2da916..2f3a120 100644 | ||
561 | 22 | --- a/modules/ssl/ssl_engine_init.c | ||
562 | 23 | +++ b/modules/ssl/ssl_engine_init.c | ||
563 | 24 | @@ -1280,6 +1280,22 @@ static APR_INLINE int modssl_DH_bits(DH *dh) | ||
564 | 25 | #endif | ||
565 | 26 | } | ||
566 | 27 | |||
567 | 28 | +/* SSL_CTX_use_PrivateKey_file() can fail either because the private | ||
568 | 29 | + * key was encrypted, or due to a mismatch between an already-loaded | ||
569 | 30 | + * cert and the key - a common misconfiguration - from calling | ||
570 | 31 | + * X509_check_private_key(). This macro is passed the last error code | ||
571 | 32 | + * off the OpenSSL stack and evaluates to true only for the first | ||
572 | 33 | + * case. With OpenSSL < 3 the second case is identifiable by the | ||
573 | 34 | + * function code, but function codes are not used from 3.0. */ | ||
574 | 35 | +#if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
575 | 36 | +#define CHECK_PRIVKEY_ERROR(ec) (ERR_GET_FUNC(ec) != X509_F_X509_CHECK_PRIVATE_KEY) | ||
576 | 37 | +#else | ||
577 | 38 | +#define CHECK_PRIVKEY_ERROR(ec) (ERR_GET_LIB != ERR_LIB_X509 \ | ||
578 | 39 | + || (ERR_GET_REASON(ec) != X509_R_KEY_TYPE_MISMATCH \ | ||
579 | 40 | + && ERR_GET_REASON(ec) != X509_R_KEY_VALUES_MISMATCH \ | ||
580 | 41 | + && ERR_GET_REASON(ec) != X509_R_UNKNOWN_KEY_TYPE)) | ||
581 | 42 | +#endif | ||
582 | 43 | + | ||
583 | 44 | static apr_status_t ssl_init_server_certs(server_rec *s, | ||
584 | 45 | apr_pool_t *p, | ||
585 | 46 | apr_pool_t *ptemp, | ||
586 | 47 | @@ -1385,8 +1401,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s, | ||
587 | 48 | } | ||
588 | 49 | else if ((SSL_CTX_use_PrivateKey_file(mctx->ssl_ctx, keyfile, | ||
589 | 50 | SSL_FILETYPE_PEM) < 1) | ||
590 | 51 | - && (ERR_GET_FUNC(ERR_peek_last_error()) | ||
591 | 52 | - != X509_F_X509_CHECK_PRIVATE_KEY)) { | ||
592 | 53 | + && CHECK_PRIVKEY_ERROR(ERR_peek_last_error())) { | ||
593 | 54 | ssl_asn1_t *asn1; | ||
594 | 55 | const unsigned char *ptr; | ||
595 | 56 | |||
596 | diff --git a/debian/patches/support-openssl3-005.patch b/debian/patches/support-openssl3-005.patch | |||
597 | 0 | new file mode 100644 | 57 | new file mode 100644 |
598 | index 0000000..5c6ebe8 | |||
599 | --- /dev/null | |||
600 | +++ b/debian/patches/support-openssl3-005.patch | |||
601 | @@ -0,0 +1,121 @@ | |||
602 | 1 | From: Joe Orton <jorton@redhat.com> | ||
603 | 2 | Date: Mon, 26 Jul 2021 12:25:36 +0100 | ||
604 | 3 | Subject: mod_ssl: Switch to using OpenSSL's automatic internal DH parameter | ||
605 | 4 | generation from OpenSSL 1.1.0 and later. The SSL_set_tmp_dh_callback() API | ||
606 | 5 | is deprecated from OpenSSL 3.0 onwards. Should not be a user-visible change | ||
607 | 6 | (except mod_ssl gets smaller). | ||
608 | 7 | |||
609 | 8 | * modules/ssl/ssl_private.h, | ||
610 | 9 | modules/ssl/ssl_engine_kernel.c, | ||
611 | 10 | modules/ssl/ssl_engine_init.c (ssl_init_ctx_callbacks): | ||
612 | 11 | Drop internal DH parameter generation and callback for OpenSSL 1.1+, | ||
613 | 12 | use SSL_CTX_set_dh_auto(, 1) instead. | ||
614 | 13 | |||
615 | 14 | Github: closes #188 | ||
616 | 15 | Reviewed by: rpluem | ||
617 | 16 | |||
618 | 17 | Submitted by: jorton | ||
619 | 18 | |||
620 | 19 | |||
621 | 20 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
622 | 21 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
623 | 22 | --- | ||
624 | 23 | modules/ssl/ssl_engine_init.c | 14 ++++++++++---- | ||
625 | 24 | modules/ssl/ssl_engine_kernel.c | 2 ++ | ||
626 | 25 | modules/ssl/ssl_private.h | 2 ++ | ||
627 | 26 | 3 files changed, 14 insertions(+), 4 deletions(-) | ||
628 | 27 | |||
629 | 28 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
630 | 29 | index 2f3a120..d0ef4ba 100644 | ||
631 | 30 | --- a/modules/ssl/ssl_engine_init.c | ||
632 | 31 | +++ b/modules/ssl/ssl_engine_init.c | ||
633 | 32 | @@ -91,7 +91,6 @@ static int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) | ||
634 | 33 | |||
635 | 34 | return 1; | ||
636 | 35 | } | ||
637 | 36 | -#endif | ||
638 | 37 | |||
639 | 38 | /* | ||
640 | 39 | * Grab well-defined DH parameters from OpenSSL, see the BN_get_rfc* | ||
641 | 40 | @@ -171,6 +170,7 @@ DH *modssl_get_dh_params(unsigned keylen) | ||
642 | 41 | |||
643 | 42 | return NULL; /* impossible to reach. */ | ||
644 | 43 | } | ||
645 | 44 | +#endif | ||
646 | 45 | |||
647 | 46 | static void ssl_add_version_components(apr_pool_t *ptemp, apr_pool_t *pconf, | ||
648 | 47 | server_rec *s) | ||
649 | 48 | @@ -440,8 +440,9 @@ apr_status_t ssl_init_Module(apr_pool_t *p, apr_pool_t *plog, | ||
650 | 49 | |||
651 | 50 | modssl_init_app_data2_idx(); /* for modssl_get_app_data2() at request time */ | ||
652 | 51 | |||
653 | 52 | +#if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
654 | 53 | init_dh_params(); | ||
655 | 54 | -#if !MODSSL_USE_OPENSSL_PRE_1_1_API | ||
656 | 55 | +#else | ||
657 | 56 | init_bio_methods(); | ||
658 | 57 | #endif | ||
659 | 58 | |||
660 | 59 | @@ -834,7 +835,11 @@ static void ssl_init_ctx_callbacks(server_rec *s, | ||
661 | 60 | { | ||
662 | 61 | SSL_CTX *ctx = mctx->ssl_ctx; | ||
663 | 62 | |||
664 | 63 | +#if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
665 | 64 | SSL_CTX_set_tmp_dh_callback(ctx, ssl_callback_TmpDH); | ||
666 | 65 | +#else | ||
667 | 66 | + SSL_CTX_set_dh_auto(ctx, 1); | ||
668 | 67 | +#endif | ||
669 | 68 | |||
670 | 69 | SSL_CTX_set_info_callback(ctx, ssl_callback_Info); | ||
671 | 70 | |||
672 | 71 | @@ -2317,10 +2322,11 @@ apr_status_t ssl_init_ModuleKill(void *data) | ||
673 | 72 | |||
674 | 73 | } | ||
675 | 74 | |||
676 | 75 | -#if !MODSSL_USE_OPENSSL_PRE_1_1_API | ||
677 | 76 | +#if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
678 | 77 | + free_dh_params(); | ||
679 | 78 | +#else | ||
680 | 79 | free_bio_methods(); | ||
681 | 80 | #endif | ||
682 | 81 | - free_dh_params(); | ||
683 | 82 | |||
684 | 83 | return APR_SUCCESS; | ||
685 | 84 | } | ||
686 | 85 | diff --git a/modules/ssl/ssl_engine_kernel.c b/modules/ssl/ssl_engine_kernel.c | ||
687 | 86 | index f2d49ad..aced92d 100644 | ||
688 | 87 | --- a/modules/ssl/ssl_engine_kernel.c | ||
689 | 88 | +++ b/modules/ssl/ssl_engine_kernel.c | ||
690 | 89 | @@ -1685,6 +1685,7 @@ const authz_provider ssl_authz_provider_verify_client = | ||
691 | 90 | ** _________________________________________________________________ | ||
692 | 91 | */ | ||
693 | 92 | |||
694 | 93 | +#if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
695 | 94 | /* | ||
696 | 95 | * Hand out standard DH parameters, based on the authentication strength | ||
697 | 96 | */ | ||
698 | 97 | @@ -1730,6 +1731,7 @@ DH *ssl_callback_TmpDH(SSL *ssl, int export, int keylen) | ||
699 | 98 | |||
700 | 99 | return modssl_get_dh_params(keylen); | ||
701 | 100 | } | ||
702 | 101 | +#endif | ||
703 | 102 | |||
704 | 103 | /* | ||
705 | 104 | * This OpenSSL callback function is called when OpenSSL | ||
706 | 105 | diff --git a/modules/ssl/ssl_private.h b/modules/ssl/ssl_private.h | ||
707 | 106 | index 71d658c..b74d956 100644 | ||
708 | 107 | --- a/modules/ssl/ssl_private.h | ||
709 | 108 | +++ b/modules/ssl/ssl_private.h | ||
710 | 109 | @@ -1127,10 +1127,12 @@ void ssl_init_ocsp_certificates(server_rec *s, modssl_ctx_t *mctx); | ||
711 | 110 | |||
712 | 111 | #endif | ||
713 | 112 | |||
714 | 113 | +#if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
715 | 114 | /* Retrieve DH parameters for given key length. Return value should | ||
716 | 115 | * be treated as unmutable, since it is stored in process-global | ||
717 | 116 | * memory. */ | ||
718 | 117 | DH *modssl_get_dh_params(unsigned keylen); | ||
719 | 118 | +#endif | ||
720 | 119 | |||
721 | 120 | /* Returns non-zero if the request was made over SSL/TLS. If sslconn | ||
722 | 121 | * is non-NULL and the request is using SSL/TLS, sets *sslconn to the | ||
723 | diff --git a/debian/patches/support-openssl3-006.patch b/debian/patches/support-openssl3-006.patch | |||
724 | 0 | new file mode 100644 | 122 | new file mode 100644 |
725 | index 0000000..33e0c1f | |||
726 | --- /dev/null | |||
727 | +++ b/debian/patches/support-openssl3-006.patch | |||
728 | @@ -0,0 +1,33 @@ | |||
729 | 1 | From: Joe Orton <jorton@redhat.com> | ||
730 | 2 | Date: Mon, 26 Jul 2021 12:29:32 +0100 | ||
731 | 3 | Subject: fix build with LibreSSL [Yann Ylavic] Github issue #188 | ||
732 | 4 | |||
733 | 5 | Submitted by: gbechis | ||
734 | 6 | |||
735 | 7 | |||
736 | 8 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
737 | 9 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
738 | 10 | --- | ||
739 | 11 | modules/ssl/ssl_private.h | 5 ++--- | ||
740 | 12 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
741 | 13 | |||
742 | 14 | diff --git a/modules/ssl/ssl_private.h b/modules/ssl/ssl_private.h | ||
743 | 15 | index b74d956..b091c58 100644 | ||
744 | 16 | --- a/modules/ssl/ssl_private.h | ||
745 | 17 | +++ b/modules/ssl/ssl_private.h | ||
746 | 18 | @@ -137,13 +137,12 @@ | ||
747 | 19 | SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) | ||
748 | 20 | #define SSL_CTX_set_max_proto_version(ctx, version) \ | ||
749 | 21 | SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) | ||
750 | 22 | -#elif LIBRESSL_VERSION_NUMBER < 0x2070000f | ||
751 | 23 | +#endif /* LIBRESSL_VERSION_NUMBER < 0x2060000f */ | ||
752 | 24 | /* LibreSSL before 2.7 declares OPENSSL_VERSION_NUMBER == 2.0 but does not | ||
753 | 25 | * include most changes from OpenSSL >= 1.1 (new functions, macros, | ||
754 | 26 | * deprecations, ...), so we have to work around this... | ||
755 | 27 | */ | ||
756 | 28 | -#define MODSSL_USE_OPENSSL_PRE_1_1_API (1) | ||
757 | 29 | -#endif /* LIBRESSL_VERSION_NUMBER < 0x2060000f */ | ||
758 | 30 | +#define MODSSL_USE_OPENSSL_PRE_1_1_API (LIBRESSL_VERSION_NUMBER < 0x2070000f) | ||
759 | 31 | #else /* defined(LIBRESSL_VERSION_NUMBER) */ | ||
760 | 32 | #define MODSSL_USE_OPENSSL_PRE_1_1_API (OPENSSL_VERSION_NUMBER < 0x10100000L) | ||
761 | 33 | #endif | ||
762 | diff --git a/debian/patches/support-openssl3-007.patch b/debian/patches/support-openssl3-007.patch | |||
763 | 0 | new file mode 100644 | 34 | new file mode 100644 |
764 | index 0000000..6f760b8 | |||
765 | --- /dev/null | |||
766 | +++ b/debian/patches/support-openssl3-007.patch | |||
767 | @@ -0,0 +1,72 @@ | |||
768 | 1 | From: Joe Orton <jorton@redhat.com> | ||
769 | 2 | Date: Mon, 26 Jul 2021 14:15:28 +0100 | ||
770 | 3 | Subject: Support for OpenSSL 1.1.0: - BIO was made opaque after OpenSSL | ||
771 | 4 | 1.1.0pre4. | ||
772 | 5 | |||
773 | 6 | Submitted by: rjung | ||
774 | 7 | |||
775 | 8 | |||
776 | 9 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
777 | 10 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
778 | 11 | --- | ||
779 | 12 | modules/ssl/ssl_engine_io.c | 12 ++++++------ | ||
780 | 13 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
781 | 14 | |||
782 | 15 | diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c | ||
783 | 16 | index f7e5cfc..3db7077 100644 | ||
784 | 17 | --- a/modules/ssl/ssl_engine_io.c | ||
785 | 18 | +++ b/modules/ssl/ssl_engine_io.c | ||
786 | 19 | @@ -194,7 +194,7 @@ static int bio_filter_destroy(BIO *bio) | ||
787 | 20 | static int bio_filter_out_read(BIO *bio, char *out, int outl) | ||
788 | 21 | { | ||
789 | 22 | /* this is never called */ | ||
790 | 23 | - bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr); | ||
791 | 24 | + bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)BIO_get_data(bio); | ||
792 | 25 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, outctx->c, | ||
793 | 26 | "BUG: %s() should not be called", "bio_filter_out_read"); | ||
794 | 27 | AP_DEBUG_ASSERT(0); | ||
795 | 28 | @@ -297,7 +297,7 @@ static long bio_filter_out_ctrl(BIO *bio, int cmd, long num, void *ptr) | ||
796 | 29 | static int bio_filter_out_gets(BIO *bio, char *buf, int size) | ||
797 | 30 | { | ||
798 | 31 | /* this is never called */ | ||
799 | 32 | - bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr); | ||
800 | 33 | + bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)BIO_get_data(bio); | ||
801 | 34 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, outctx->c, | ||
802 | 35 | "BUG: %s() should not be called", "bio_filter_out_gets"); | ||
803 | 36 | AP_DEBUG_ASSERT(0); | ||
804 | 37 | @@ -307,7 +307,7 @@ static int bio_filter_out_gets(BIO *bio, char *buf, int size) | ||
805 | 38 | static int bio_filter_out_puts(BIO *bio, const char *str) | ||
806 | 39 | { | ||
807 | 40 | /* this is never called */ | ||
808 | 41 | - bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr); | ||
809 | 42 | + bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)BIO_get_data(bio); | ||
810 | 43 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, outctx->c, | ||
811 | 44 | "BUG: %s() should not be called", "bio_filter_out_puts"); | ||
812 | 45 | AP_DEBUG_ASSERT(0); | ||
813 | 46 | @@ -545,7 +545,7 @@ static int bio_filter_in_read(BIO *bio, char *in, int inlen) | ||
814 | 47 | |||
815 | 48 | static int bio_filter_in_write(BIO *bio, const char *in, int inl) | ||
816 | 49 | { | ||
817 | 50 | - bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
818 | 51 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)BIO_get_data(bio); | ||
819 | 52 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
820 | 53 | "BUG: %s() should not be called", "bio_filter_in_write"); | ||
821 | 54 | AP_DEBUG_ASSERT(0); | ||
822 | 55 | @@ -554,7 +554,7 @@ static int bio_filter_in_write(BIO *bio, const char *in, int inl) | ||
823 | 56 | |||
824 | 57 | static int bio_filter_in_puts(BIO *bio, const char *str) | ||
825 | 58 | { | ||
826 | 59 | - bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
827 | 60 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)BIO_get_data(bio); | ||
828 | 61 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
829 | 62 | "BUG: %s() should not be called", "bio_filter_in_puts"); | ||
830 | 63 | AP_DEBUG_ASSERT(0); | ||
831 | 64 | @@ -563,7 +563,7 @@ static int bio_filter_in_puts(BIO *bio, const char *str) | ||
832 | 65 | |||
833 | 66 | static int bio_filter_in_gets(BIO *bio, char *buf, int size) | ||
834 | 67 | { | ||
835 | 68 | - bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)(bio->ptr); | ||
836 | 69 | + bio_filter_in_ctx_t *inctx = (bio_filter_in_ctx_t *)BIO_get_data(bio); | ||
837 | 70 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, inctx->f->c, | ||
838 | 71 | "BUG: %s() should not be called", "bio_filter_in_gets"); | ||
839 | 72 | AP_DEBUG_ASSERT(0); | ||
840 | diff --git a/debian/patches/support-openssl3-008.patch b/debian/patches/support-openssl3-008.patch | |||
841 | 0 | new file mode 100644 | 73 | new file mode 100644 |
842 | index 0000000..d04497f | |||
843 | --- /dev/null | |||
844 | +++ b/debian/patches/support-openssl3-008.patch | |||
845 | @@ -0,0 +1,29 @@ | |||
846 | 1 | From: Joe Orton <jorton@redhat.com> | ||
847 | 2 | Date: Wed, 28 Jul 2021 12:28:59 +0100 | ||
848 | 3 | Subject: mod_ssl: follow up to r1876934: fix | ||
849 | 4 | !modssl_X509_STORE_load_locations() logic. | ||
850 | 5 | |||
851 | 6 | Submitted by: ylavic | ||
852 | 7 | |||
853 | 8 | |||
854 | 9 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
855 | 10 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
856 | 11 | --- | ||
857 | 12 | modules/ssl/ssl_engine_init.c | 4 ++-- | ||
858 | 13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
859 | 14 | |||
860 | 15 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
861 | 16 | index d0ef4ba..5d199cd 100644 | ||
862 | 17 | --- a/modules/ssl/ssl_engine_init.c | ||
863 | 18 | +++ b/modules/ssl/ssl_engine_init.c | ||
864 | 19 | @@ -1046,8 +1046,8 @@ static apr_status_t ssl_init_ctx_crl(server_rec *s, | ||
865 | 20 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01900) | ||
866 | 21 | "Configuring certificate revocation facility"); | ||
867 | 22 | |||
868 | 23 | - if (!store || modssl_X509_STORE_load_locations(store, mctx->crl_file, | ||
869 | 24 | - mctx->crl_path)) { | ||
870 | 25 | + if (!store || !modssl_X509_STORE_load_locations(store, mctx->crl_file, | ||
871 | 26 | + mctx->crl_path)) { | ||
872 | 27 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01901) | ||
873 | 28 | "Host %s: unable to configure X.509 CRL storage " | ||
874 | 29 | "for certificate revocation", mctx->sc->vhost_id); | ||
875 | diff --git a/debian/patches/support-openssl3-009.patch b/debian/patches/support-openssl3-009.patch | |||
876 | 0 | new file mode 100644 | 30 | new file mode 100644 |
877 | index 0000000..01687e9 | |||
878 | --- /dev/null | |||
879 | +++ b/debian/patches/support-openssl3-009.patch | |||
880 | @@ -0,0 +1,36 @@ | |||
881 | 1 | From: Joe Orton <jorton@redhat.com> | ||
882 | 2 | Date: Mon, 4 Oct 2021 14:26:49 +0100 | ||
883 | 3 | Subject: * modules/ssl/ssl_engine_init.c (ssl_init_server_certs): For OpenSSL | ||
884 | 4 | 1.1+, | ||
885 | 5 | disable auto DH parameter selection if parameters have been manually | ||
886 | 6 | configured. This fixes a regression in r1890067 after which manually | ||
887 | 7 | configured parameters are ignored. | ||
888 | 8 | |||
889 | 9 | Submitted by: jorton | ||
890 | 10 | |||
891 | 11 | |||
892 | 12 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
893 | 13 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
894 | 14 | --- | ||
895 | 15 | modules/ssl/ssl_engine_init.c | 7 +++++++ | ||
896 | 16 | 1 file changed, 7 insertions(+) | ||
897 | 17 | |||
898 | 18 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
899 | 19 | index 5d199cd..3986ba7 100644 | ||
900 | 20 | --- a/modules/ssl/ssl_engine_init.c | ||
901 | 21 | +++ b/modules/ssl/ssl_engine_init.c | ||
902 | 22 | @@ -1496,7 +1496,14 @@ static apr_status_t ssl_init_server_certs(server_rec *s, | ||
903 | 23 | certfile = APR_ARRAY_IDX(mctx->pks->cert_files, 0, const char *); | ||
904 | 24 | if (certfile && !modssl_is_engine_id(certfile) | ||
905 | 25 | && (dh = ssl_dh_GetParamFromFile(certfile))) { | ||
906 | 26 | + /* ### This should be replaced with SSL_CTX_set0_tmp_dh_pkey() | ||
907 | 27 | + * for OpenSSL 3.0+. */ | ||
908 | 28 | SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dh); | ||
909 | 29 | +#if !MODSSL_USE_OPENSSL_PRE_1_1_API | ||
910 | 30 | + /* OpenSSL ignores manually configured DH params if automatic | ||
911 | 31 | + * selection if enabled, so disable auto selection here. */ | ||
912 | 32 | + SSL_CTX_set_dh_auto(mctx->ssl_ctx, 0); | ||
913 | 33 | +#endif | ||
914 | 34 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02540) | ||
915 | 35 | "Custom DH parameters (%d bits) for %s loaded from %s", | ||
916 | 36 | modssl_DH_bits(dh), vhost_id, certfile); | ||
917 | diff --git a/debian/patches/support-openssl3-010.patch b/debian/patches/support-openssl3-010.patch | |||
918 | 0 | new file mode 100644 | 37 | new file mode 100644 |
919 | index 0000000..2791e96 | |||
920 | --- /dev/null | |||
921 | +++ b/debian/patches/support-openssl3-010.patch | |||
922 | @@ -0,0 +1,54 @@ | |||
923 | 1 | From: Joe Orton <jorton@redhat.com> | ||
924 | 2 | Date: Tue, 12 Oct 2021 13:48:55 +0100 | ||
925 | 3 | Subject: * modules/ssl/ssl_engine_init.c (ssl_init_ctx_callbacks, | ||
926 | 4 | ssl_init_server_certs): Flip logic for enabling/disabling DH auto | ||
927 | 5 | parameter selection for OpenSSL 1.1+ to be simpler and consistent with | ||
928 | 6 | auto ECDH curve selection. | ||
929 | 7 | |||
930 | 8 | |||
931 | 9 | Forwarded: yes, https://github.com/apache/httpd/pull/258 | ||
932 | 10 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1951476 | ||
933 | 11 | --- | ||
934 | 12 | modules/ssl/ssl_engine_init.c | 16 +++++++++------- | ||
935 | 13 | 1 file changed, 9 insertions(+), 7 deletions(-) | ||
936 | 14 | |||
937 | 15 | diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c | ||
938 | 16 | index 3986ba7..f440a37 100644 | ||
939 | 17 | --- a/modules/ssl/ssl_engine_init.c | ||
940 | 18 | +++ b/modules/ssl/ssl_engine_init.c | ||
941 | 19 | @@ -836,9 +836,9 @@ static void ssl_init_ctx_callbacks(server_rec *s, | ||
942 | 20 | SSL_CTX *ctx = mctx->ssl_ctx; | ||
943 | 21 | |||
944 | 22 | #if MODSSL_USE_OPENSSL_PRE_1_1_API | ||
945 | 23 | + /* Note that for OpenSSL>=1.1, auto selection is enabled via | ||
946 | 24 | + * SSL_CTX_set_dh_auto(,1) if no parameter is configured. */ | ||
947 | 25 | SSL_CTX_set_tmp_dh_callback(ctx, ssl_callback_TmpDH); | ||
948 | 26 | -#else | ||
949 | 27 | - SSL_CTX_set_dh_auto(ctx, 1); | ||
950 | 28 | #endif | ||
951 | 29 | |||
952 | 30 | SSL_CTX_set_info_callback(ctx, ssl_callback_Info); | ||
953 | 31 | @@ -1499,16 +1499,18 @@ static apr_status_t ssl_init_server_certs(server_rec *s, | ||
954 | 32 | /* ### This should be replaced with SSL_CTX_set0_tmp_dh_pkey() | ||
955 | 33 | * for OpenSSL 3.0+. */ | ||
956 | 34 | SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dh); | ||
957 | 35 | -#if !MODSSL_USE_OPENSSL_PRE_1_1_API | ||
958 | 36 | - /* OpenSSL ignores manually configured DH params if automatic | ||
959 | 37 | - * selection if enabled, so disable auto selection here. */ | ||
960 | 38 | - SSL_CTX_set_dh_auto(mctx->ssl_ctx, 0); | ||
961 | 39 | -#endif | ||
962 | 40 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02540) | ||
963 | 41 | "Custom DH parameters (%d bits) for %s loaded from %s", | ||
964 | 42 | modssl_DH_bits(dh), vhost_id, certfile); | ||
965 | 43 | DH_free(dh); | ||
966 | 44 | } | ||
967 | 45 | +#if !MODSSL_USE_OPENSSL_PRE_1_1_API | ||
968 | 46 | + else { | ||
969 | 47 | + /* If no parameter is manually configured, enable auto | ||
970 | 48 | + * selection. */ | ||
971 | 49 | + SSL_CTX_set_dh_auto(mctx->ssl_ctx, 1); | ||
972 | 50 | + } | ||
973 | 51 | +#endif | ||
974 | 52 | |||
975 | 53 | #ifdef HAVE_ECC | ||
976 | 54 | /* |
Thanks for tackling this, looks like you've researched the situation quite thoroughly. I've verified the builds all look good in the PPA, and it builds fine for me locally as well. The autopkgtest failures (https:/ /bileto. ubuntu. com/excuses/ 4726/jammy. html) surprised me, but I can believe that it just needs -proposed enabled.
I am planning on tackling the merge for apache2 at some point here, so it would be great to get this MP landed, and thus agree the pros outweigh the cons. When I do get to the merge, that will be an additional checkpoint where we can see where things sit upstream and to make any necessary corrections, and in the immediate term this will help with the openssl 3.0 transition.
LGTM, +1