Skip to content

Commit 69f816d

Browse files
dschoGit for Windows Build Agent
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 <johannes.schindelin@gmx.de>
1 parent 09b9c1e commit 69f816d

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

Documentation/config/http.adoc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,13 @@ http.sslKeyType::
244244

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

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

http.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ static char *cached_accept_language;
151151

152152
static char *http_ssl_backend;
153153

154-
static int http_schannel_check_revoke = 1;
154+
static long http_schannel_check_revoke_mode =
155+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
156+
CURLSSLOPT_REVOKE_BEST_EFFORT;
157+
#else
158+
CURLSSLOPT_NO_REVOKE;
159+
#endif
155160

156161
static long http_retry_after = 0;
157162
static long http_max_retries = 0;
@@ -431,7 +436,19 @@ static int http_options(const char *var, const char *value,
431436
}
432437

433438
if (!strcmp("http.schannelcheckrevoke", var)) {
434-
http_schannel_check_revoke = git_config_bool(var, value);
439+
if (value && !strcmp(value, "best-effort")) {
440+
http_schannel_check_revoke_mode =
441+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
442+
CURLSSLOPT_REVOKE_BEST_EFFORT;
443+
#else
444+
CURLSSLOPT_NO_REVOKE;
445+
warning(_("%s=%s unsupported by current cURL"),
446+
var, value);
447+
#endif
448+
} else
449+
http_schannel_check_revoke_mode =
450+
(git_config_bool(var, value) ?
451+
0 : CURLSSLOPT_NO_REVOKE);
435452
return 0;
436453
}
437454

@@ -1159,8 +1176,8 @@ static CURL *get_curl_handle(void)
11591176
#endif
11601177

11611178
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
1162-
!http_schannel_check_revoke) {
1163-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_NO_REVOKE);
1179+
http_schannel_check_revoke_mode) {
1180+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
11641181
}
11651182

11661183
if (http_proactive_auth != PROACTIVE_AUTH_NONE)

0 commit comments

Comments
 (0)