Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5757c02

Browse files
committed
ssl: dump the SSL ciphers in favour of TLS
All versions of SSL are considered deprecated now, so let's ask OpenSSl to only use TLSv1. We still ask it to load those ciphers for compatibility with servers which want to use an older hello but will use TLS for encryption. For good measure we also disable compression, which can be exploitable, if the OpenSSL version supports it.
1 parent d6b97cb commit 5757c02

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/global.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,20 @@ static void init_ssl(void)
6969
#ifdef GIT_SSL
7070
SSL_load_error_strings();
7171
OpenSSL_add_ssl_algorithms();
72+
/*
73+
* Load SSLv{2,3} and TLSv1 so that we can talk with servers
74+
* which use the SSL hellos, which are often used for
75+
* compatibility. We then disable SSL so we only allow OpenSSL
76+
* to speak TLSv1 to perform the encryption itself.
77+
*/
7278
git__ssl_ctx = SSL_CTX_new(SSLv23_method());
79+
SSL_CTX_set_options(git__ssl_ctx,
80+
SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3
81+
/* Older OpenSSL and MacOS OpenSSL doesn't have this */
82+
# ifdef SSL_OP_NO_COMPRESSION
83+
| SSL_OP_NO_COMPRESSION
84+
# endif
85+
);
7386
SSL_CTX_set_mode(git__ssl_ctx, SSL_MODE_AUTO_RETRY);
7487
SSL_CTX_set_verify(git__ssl_ctx, SSL_VERIFY_NONE, NULL);
7588
if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx)) {

0 commit comments

Comments
 (0)