git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lodato <lodatom@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Cc: Mark Lodato <lodatom@gmail.com>
Subject: [PATCH 2/2] http.c: add http.sslCertNoPass option
Date: Wed, 27 May 2009 23:16:03 -0400	[thread overview]
Message-ID: <1243480563-5954-2-git-send-email-lodatom@gmail.com> (raw)
In-Reply-To: <1243480563-5954-1-git-send-email-lodatom@gmail.com>

Add a configuration option, http.sslCertNoPass, and associated
environment variable, GIT_SSL_CERT_NO_PASS, to allow disabling of the
SSL client certificate password prompt from within git.  If this option
is set to true, or if the environment variable exists, git falls back to
OpenSSL's prompts (as in earlier versions of git).

This option is useful in (at least) two cases:
1. The certificate is not encrypted and the user does not want to be
   prompted needlessly.
2. The user does not wish to leave the password in the clear in git's
   (and libcurl's) memory, in case the program crashes and core dumps.

The environment variable may only be used to disable, not to re-enable,
git's password prompt.  This behavior mimics GIT_NO_VERIFY; the mere
existence of the variable is all that is checked.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
 Documentation/config.txt |    9 +++++++++
 http.c                   |    9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2c03162..65c3ac5 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1038,6 +1038,15 @@ http.sslKey::
 	over HTTPS. Can be overridden by the 'GIT_SSL_KEY' environment
 	variable.
 
+http.sslCertNoPass::
+	Disable git's password prompt for the SSL certificate.  OpenSSL
+	will still prompt the user, possibly many times, if the
+	certificate or private key is encrypted.  Useful if the
+	certificate is not encrypted (to disable the password prompt) or
+	if you do not wish to store the certificate password in git's
+	memory.  Can be overridden by the 'GIT_SSL_CERT_NO_PASS'
+	environment variable.
+
 http.sslCAInfo::
 	File containing the certificates to verify the peer with when
 	fetching or pushing over HTTPS. Can be overridden by the
diff --git a/http.c b/http.c
index 1fc3444..6ae59b6 100644
--- a/http.c
+++ b/http.c
@@ -131,6 +131,11 @@ static int http_options(const char *var, const char *value, void *cb)
 #endif
 	if (!strcmp("http.sslcainfo", var))
 		return git_config_string(&ssl_cainfo, var, value);
+	if (!strcmp("http.sslcertnopass", var)) {
+		if (git_config_bool(var, value))
+			ssl_cert_password_required = -1;
+		return 0;
+	}
 #ifdef USE_CURL_MULTI
 	if (!strcmp("http.maxrequests", var)) {
 		max_requests = git_config_int(var, value);
@@ -359,7 +364,9 @@ void http_init(struct remote *remote)
 
 	if (remote && remote->url && remote->url[0]) {
 		http_auth_init(remote->url[0]);
-		if (!prefixcmp(remote->url[0], "https://"))
+		if (ssl_cert_password_required == 0 &&
+		    !getenv("GIT_SSL_CERT_NO_PASS") &&
+		    !prefixcmp(remote->url[0], "https://"))
 			ssl_cert_password_required = 1;
 	}
 
-- 
1.6.3.1

  reply	other threads:[~2009-05-28  3:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28  3:16 [PATCH 1/2] http.c: prompt for SSL client certificate password Mark Lodato
2009-05-28  3:16 ` Mark Lodato [this message]
2009-06-05  2:44 ` Mark Lodato
2009-06-05  8:20   ` Constantine Plotnikov
2009-06-07 14:10     ` Mark Lodato
2009-06-11 23:00 ` Mark Lodato
2009-06-11 23:42   ` Nanako Shiraishi
2009-06-11 23:59     ` Junio C Hamano
2009-06-12  7:56     ` Daniel Stenberg
2009-06-12 15:38       ` Constantine Plotnikov
2009-06-12 16:50         ` Jakub Narebski
2009-06-12 21:49           ` Rogan Dawes
2009-06-12 23:11           ` Mark Lodato
2009-06-12 23:26       ` Mark Lodato
2009-06-13  0:31         ` Junio C Hamano
2009-06-13  0:49           ` Mark Lodato
2009-06-13 11:22           ` Daniel Stenberg
2009-06-11 23:56   ` Junio C Hamano
2009-06-12 22:31     ` Mark Lodato
2009-06-12  6:34 ` Junio C Hamano
2009-06-12  7:59   ` Daniel Stenberg
2009-06-12 23:13   ` Mark Lodato
2009-06-13  0:14     ` Junio C Hamano
2009-06-13  0:33       ` Mark Lodato
2009-06-13  1:12         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243480563-5954-2-git-send-email-lodatom@gmail.com \
    --to=lodatom@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).