Skip to content

Commit 6ddb746

Browse files
dschovdye
authored andcommitted
http: use new "best effort" strategy for Secure Channel revoke checking
The native Windows HTTPS backend is based on Secure Channel which lets the caller decide how to handle revocation checking problems caused by missing information in the certificate or offline CRL distribution points. Unfortunately, cURL chose to handle these problems differently than OpenSSL by default: while OpenSSL happily ignores those problems (essentially saying "¯\_(ツ)_/¯"), the Secure Channel backend will error out instead. As a remedy, the "no revoke" mode was introduced, which turns off revocation checking altogether. This is a bit heavy-handed. We support this via the `http.schannelCheckRevoke` setting. In curl/curl#4981, we contributed an opt-in "best effort" strategy that emulates what OpenSSL seems to do. In Git for Windows, we actually want this to be the default. This patch makes it so, introducing it as a new value for the `http.schannelCheckRevoke" setting, which now becmes a tristate: it accepts the values "false", "true" or "best-effort" (defaulting to the last one). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9c97596 commit 6ddb746

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Documentation/config/http.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,13 @@ http.sslBackend::
173173

174174
http.schannelCheckRevoke::
175175
Used to enforce or disable certificate revocation checks in cURL
176-
when http.sslBackend is set to "schannel". Defaults to `true` if
177-
unset. Only necessary to disable this if Git consistently errors
178-
and the message is about checking the revocation status of a
179-
certificate. This option is ignored if cURL lacks support for
180-
setting the relevant SSL option at runtime.
176+
when http.sslBackend is set to "schannel" via "true" and "false",
177+
respectively. Another accepted value is "best-effort" (the default)
178+
in which case revocation checks are performed, but errors due to
179+
revocation list distribution points that are offline are silently
180+
ignored, as well as errors due to certificates missing revocation
181+
list distribution points. This option is ignored if cURL lacks
182+
support for setting the relevant SSL option at runtime.
181183

182184
http.schannelUseSSLCAInfo::
183185
As of cURL v7.60.0, the Secure Channel backend can use the

http.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ static char *cached_accept_language;
134134

135135
static char *http_ssl_backend;
136136

137-
static int http_schannel_check_revoke = 1;
137+
static int http_schannel_check_revoke_mode =
138+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
139+
CURLSSLOPT_REVOKE_BEST_EFFORT;
140+
#else
141+
CURLSSLOPT_NO_REVOKE;
142+
#endif
143+
138144
/*
139145
* With the backend being set to `schannel`, setting sslCAinfo would override
140146
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -285,7 +291,19 @@ static int http_options(const char *var, const char *value, void *cb)
285291
}
286292

287293
if (!strcmp("http.schannelcheckrevoke", var)) {
288-
http_schannel_check_revoke = git_config_bool(var, value);
294+
if (value && !strcmp(value, "best-effort")) {
295+
http_schannel_check_revoke_mode =
296+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
297+
CURLSSLOPT_REVOKE_BEST_EFFORT;
298+
#else
299+
CURLSSLOPT_NO_REVOKE;
300+
warning(_("%s=%s unsupported by current cURL"),
301+
var, value);
302+
#endif
303+
} else
304+
http_schannel_check_revoke_mode =
305+
(git_config_bool(var, value) ?
306+
0 : CURLSSLOPT_NO_REVOKE);
289307
return 0;
290308
}
291309

@@ -805,9 +823,9 @@ static CURL *get_curl_handle(void)
805823
#endif
806824

807825
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
808-
!http_schannel_check_revoke) {
826+
http_schannel_check_revoke_mode) {
809827
#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
810-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
828+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
811829
#else
812830
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
813831
#endif

0 commit comments

Comments
 (0)