Skip to content

Commit a91aa91

Browse files
shiftkeydscho
authored andcommitted
add support for disabling SSL revocation checks in cURL
This adds support for a new http.schannel.checkRevoke config value. This config value is only used if http.sslBackend is set to "schannel", which forces cURL to use the Windows Certificate Store when validating server certificates associated with a remote server. This config value should only be set to "false" if you are in an environment where revocation checks are blocked by the network, with no alternative options. This is only supported in cURL 7.44 or later. Signed-off-by: Brendan Forster <[email protected]>
1 parent 1b4ff21 commit a91aa91

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Documentation/config.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,6 +2034,14 @@ http.sslBackend::
20342034
This option is ignored if cURL lacks support for choosing the SSL
20352035
backend at runtime.
20362036

2037+
http.schannel.checkRevoke::
2038+
Used to enforce or disable certificate revocation checks in cURL
2039+
when http.sslBackend is set to "schannel". Defaults to `true` if
2040+
unset. Only necessary to disable this if Git consistently errors
2041+
and the message is about checking the revocation status of a
2042+
certificate. This option is ignored if cURL lacks support for
2043+
setting the relevant SSL option at runtime.
2044+
20372045
http.pinnedpubkey::
20382046
Public key of the https service. It may either be the filename of
20392047
a PEM or DER encoded public key file or a string starting with

http.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ static char *cached_accept_language;
153153

154154
static char *http_ssl_backend;
155155

156+
static int http_schannel_check_revoke = 1;
157+
156158
size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
157159
{
158160
size_t size = eltsize * nmemb;
@@ -306,6 +308,11 @@ static int http_options(const char *var, const char *value, void *cb)
306308
return 0;
307309
}
308310

311+
if (!strcmp("http.schannel.checkrevoke", var)) {
312+
http_schannel_check_revoke = git_config_bool(var, value);
313+
return 0;
314+
}
315+
309316
if (!strcmp("http.minsessions", var)) {
310317
min_curl_sessions = git_config_int(var, value);
311318
#ifndef USE_CURL_MULTI
@@ -807,6 +814,16 @@ static CURL *get_curl_handle(void)
807814
}
808815
#endif
809816

817+
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
818+
!http_schannel_check_revoke) {
819+
#if LIBCURL_VERSION_NUM >= 0x074400
820+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
821+
#else
822+
warning("CURLSSLOPT_NO_REVOKE not applied to curl SSL options because\n"
823+
"your curl version is too old (>= 7.44.0)");
824+
#endif
825+
}
826+
810827
if (http_proactive_auth)
811828
init_curl_http_auth(result);
812829

0 commit comments

Comments
 (0)