Skip to content

Commit f6f2a9e

Browse files
larsksgitster
authored andcommitted
http: add support for specifying an SSL cipher list
Teach git about a new option, "http.sslCipherList", which permits one to specify a list of ciphers to use when negotiating SSL connections. The setting can be overwridden by the GIT_SSL_CIPHER_LIST environment variable. Signed-off-by: Lars Kellogg-Stedman <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16018ae commit f6f2a9e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Documentation/config.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,19 @@ http.savecookies::
15611561
If set, store cookies received during requests to the file specified by
15621562
http.cookiefile. Has no effect if http.cookiefile is unset.
15631563

1564+
http.sslCipherList::
1565+
A list of SSL ciphers to use when negotiating an SSL connection.
1566+
The available ciphers depend on whether libcurl was built against
1567+
NSS or OpenSSL and the particular configuration of the crypto
1568+
library in use. Internally this sets the 'CURLOPT_SSL_CIPHER_LIST'
1569+
option; see the libcurl documentation for more details on the format
1570+
of this list.
1571+
+
1572+
Can be overridden by the 'GIT_SSL_CIPHER_LIST' environment variable.
1573+
To force git to use libcurl's default cipher list and ignore any
1574+
explicit http.sslCipherList option, set 'GIT_SSL_CIPHER_LIST' to the
1575+
empty string.
1576+
15641577
http.sslVerify::
15651578
Whether to verify the SSL certificate when fetching or pushing
15661579
over HTTPS. Can be overridden by the 'GIT_SSL_NO_VERIFY' environment

contrib/completion/git-completion.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,7 @@ _git_config ()
21232123
http.noEPSV
21242124
http.postBuffer
21252125
http.proxy
2126+
http.sslCipherList
21262127
http.sslCAInfo
21272128
http.sslCAPath
21282129
http.sslCert

http.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ char curl_errorstr[CURL_ERROR_SIZE];
3535
static int curl_ssl_verify = -1;
3636
static int curl_ssl_try;
3737
static const char *ssl_cert;
38+
static const char *ssl_cipherlist;
3839
#if LIBCURL_VERSION_NUM >= 0x070903
3940
static const char *ssl_key;
4041
#endif
@@ -153,6 +154,8 @@ static int http_options(const char *var, const char *value, void *cb)
153154
curl_ssl_verify = git_config_bool(var, value);
154155
return 0;
155156
}
157+
if (!strcmp("http.sslcipherlist", var))
158+
return git_config_string(&ssl_cipherlist, var, value);
156159
if (!strcmp("http.sslcert", var))
157160
return git_config_string(&ssl_cert, var, value);
158161
#if LIBCURL_VERSION_NUM >= 0x070903
@@ -327,6 +330,13 @@ static CURL *get_curl_handle(void)
327330
if (http_proactive_auth)
328331
init_curl_http_auth(result);
329332

333+
if (getenv("GIT_SSL_CIPHER_LIST"))
334+
ssl_cipherlist = getenv("GIT_SSL_CIPHER_LIST");
335+
336+
if (ssl_cipherlist != NULL && *ssl_cipherlist)
337+
curl_easy_setopt(result, CURLOPT_SSL_CIPHER_LIST,
338+
ssl_cipherlist);
339+
330340
if (ssl_cert != NULL)
331341
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
332342
if (has_cert_password())

0 commit comments

Comments
 (0)