Skip to content

Commit ddb19a8

Browse files
committed
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 9028643 commit ddb19a8

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
@@ -218,11 +218,13 @@ http.sslBackend::
218218

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

227229
http.schannelUseSSLCAInfo::
228230
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
@@ -142,7 +142,13 @@ static char *cached_accept_language;
142142

143143
static char *http_ssl_backend;
144144

145-
static int http_schannel_check_revoke = 1;
145+
static int http_schannel_check_revoke_mode =
146+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
147+
CURLSSLOPT_REVOKE_BEST_EFFORT;
148+
#else
149+
CURLSSLOPT_NO_REVOKE;
150+
#endif
151+
146152
/*
147153
* With the backend being set to `schannel`, setting sslCAinfo would override
148154
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -417,7 +423,19 @@ static int http_options(const char *var, const char *value,
417423
}
418424

419425
if (!strcmp("http.schannelcheckrevoke", var)) {
420-
http_schannel_check_revoke = git_config_bool(var, value);
426+
if (value && !strcmp(value, "best-effort")) {
427+
http_schannel_check_revoke_mode =
428+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
429+
CURLSSLOPT_REVOKE_BEST_EFFORT;
430+
#else
431+
CURLSSLOPT_NO_REVOKE;
432+
warning(_("%s=%s unsupported by current cURL"),
433+
var, value);
434+
#endif
435+
} else
436+
http_schannel_check_revoke_mode =
437+
(git_config_bool(var, value) ?
438+
0 : CURLSSLOPT_NO_REVOKE);
421439
return 0;
422440
}
423441

@@ -1044,8 +1062,8 @@ static CURL *get_curl_handle(void)
10441062
#endif
10451063

10461064
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
1047-
!http_schannel_check_revoke) {
1048-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
1065+
http_schannel_check_revoke_mode) {
1066+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
10491067
}
10501068

10511069
if (http_proactive_auth != PROACTIVE_AUTH_NONE)

0 commit comments

Comments
 (0)