@matheusbsbs / matheus-bagliano / commits / af026519c9
Fork 0

http: add environment variable support for HTTPS proxies

Add 4 environment variables that can be used to configure the proxy cert, proxy ssl key, the proxy cert password protected flag, and the CA info for the proxy. Documentation for the options was also updated. Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jorge Lopez Silva committed Mar 4, 2020 at 18:40 UTC af026519c9cf82928be111974e89bc122765f13f
2 files changed +15 -4
Documentation/config/http.txt
+8 -4
@@ -31,20 +31,24 @@ http.proxyAuthMethod::
31
32 http.proxySSLCert::
33 The pathname of a file that stores a client certificate to use to authenticate
34 - with an HTTPS proxy.
34 + with an HTTPS proxy. Can be overridden by the `GIT_PROXY_SSL_CERT` environment
35 + variable.
36
37 http.proxySSLKey::
38 The pathname of a file that stores a private key to use to authenticate with
38 - an HTTPS proxy.
39 + an HTTPS proxy. Can be overridden by the `GIT_PROXY_SSL_KEY` environment
40 + variable.
41
42 http.proxySSLCertPasswordProtected::
43 Enable Git's password prompt for the proxy SSL certificate. Otherwise OpenSSL
44 will prompt the user, possibly many times, if the certificate or private key
43 - is encrypted.
45 + is encrypted. Can be overriden by the `GIT_PROXY_SSL_CERT_PASSWORD_PROTECTED`
46 + environment variable.
47
48 http.proxySSLCAInfo::
49 Pathname to the file containing the certificate bundle that should be used to
47 - verify the proxy with when using an HTTPS proxy.
50 + verify the proxy with when using an HTTPS proxy. Can be overriden by the
51 + `GIT_PROXY_SSL_CAINFO` environment variable.
52
53 http.emptyAuth::
54 Attempt authentication without seeking a username or password. This
http.c
+7
@@ -1211,6 +1211,13 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
1211 max_requests = DEFAULT_MAX_REQUESTS;
1212 #endif
1213
1214 + set_from_env(&http_proxy_ssl_cert, "GIT_PROXY_SSL_CERT");
1215 + set_from_env(&http_proxy_ssl_key, "GIT_PROXY_SSL_KEY");
1216 + set_from_env(&http_proxy_ssl_ca_info, "GIT_PROXY_SSL_CAINFO");
1217 +
1218 + if (getenv("GIT_PROXY_SSL_CERT_PASSWORD_PROTECTED"))
1219 + proxy_ssl_cert_password_required = 1;
1220 +
1221 if (getenv("GIT_CURL_FTP_NO_EPSV"))
1222 curl_ftp_no_epsv = 1;
1223