git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] That change for support different sslcert and sslkey types.
@ 2023-03-19 13:51 Stanislav Malishevskiy via GitGitGadget
  2023-03-20 15:48 ` [PATCH v2] http: add support for " Stanislav Malishevskiy via GitGitGadget
  0 siblings, 1 reply; 16+ messages in thread
From: Stanislav Malishevskiy via GitGitGadget @ 2023-03-19 13:51 UTC (permalink / raw)
  To: git; +Cc: Stanislav Malishevskiy, Stanislav Malishevskiy

From: Stanislav Malishevskiy <s.malishevskiy@auriga.com>

Basically git work with default curl ssl type - PEM. But for support
eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
and as sslkey type. So there added additional options for http for make
that possible.

Signed-off-by: Stanislav Malishevskiy stanislav.malishevskiy@gmail.com
---
    That change for support different sslcert and sslkey types.
    
    Basically git work with default curl ssl type - PEM. But for support
    eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
    and as sslkey type. So there added additional options for http for make
    that possible.
    
    Signed-off-by: Stanislav Malishevskiy stanislav.malishevskiy@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1474%2Fsmalishevskiy%2Fssl_types_support-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1474/smalishevskiy/ssl_types_support-v1
Pull-Request: https://github.com/git/git/pull/1474

 http.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/http.c b/http.c
index dbe4d29ef7a..d5d82c5230f 100644
--- a/http.c
+++ b/http.c
@@ -40,6 +40,7 @@ static int curl_ssl_verify = -1;
 static int curl_ssl_try;
 static const char *curl_http_version = NULL;
 static const char *ssl_cert;
+static const char *ssl_cert_type;
 static const char *ssl_cipherlist;
 static const char *ssl_version;
 static struct {
@@ -59,6 +60,7 @@ static struct {
 #endif
 };
 static const char *ssl_key;
+static const char *ssl_key_type;
 static const char *ssl_capath;
 static const char *curl_no_proxy;
 #ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
@@ -374,8 +376,12 @@ static int http_options(const char *var, const char *value, void *cb)
 		return git_config_string(&ssl_version, var, value);
 	if (!strcmp("http.sslcert", var))
 		return git_config_pathname(&ssl_cert, var, value);
+	if (!strcmp("http.sslcerttype", var))
+		return git_config_string(&ssl_cert_type, var, value);
 	if (!strcmp("http.sslkey", var))
 		return git_config_pathname(&ssl_key, var, value);
+	if (!strcmp("http.sslkeytype", var))
+		return git_config_string(&ssl_key_type, var, value);
 	if (!strcmp("http.sslcapath", var))
 		return git_config_pathname(&ssl_capath, var, value);
 	if (!strcmp("http.sslcainfo", var))
@@ -1014,10 +1020,14 @@ static CURL *get_curl_handle(void)
 
 	if (ssl_cert)
 		curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
+	if (ssl_cert_type)
+		curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
 	if (has_cert_password())
 		curl_easy_setopt(result, CURLOPT_KEYPASSWD, cert_auth.password);
 	if (ssl_key)
 		curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
+	if (ssl_key_type)
+		curl_easy_setopt(result, CURLOPT_SSLKEYTYPE, ssl_key_type);
 	if (ssl_capath)
 		curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
 #ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
@@ -1252,7 +1262,9 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
 		curl_ssl_verify = 0;
 
 	set_from_env(&ssl_cert, "GIT_SSL_CERT");
+	set_from_env(&ssl_cert_type, "GIT_SSL_CERT_TYPE");
 	set_from_env(&ssl_key, "GIT_SSL_KEY");
+	set_from_env(&ssl_key_type, "GIT_SSL_KEY_TYPE");
 	set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
 	set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
 

base-commit: 950264636c68591989456e3ba0a5442f93152c1a
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-19 13:51 [PATCH] That change for support different sslcert and sslkey types Stanislav Malishevskiy via GitGitGadget
@ 2023-03-20 15:48 ` Stanislav Malishevskiy via GitGitGadget
  2023-03-20 17:10   ` Jeff King
  2023-03-20 17:23   ` Junio C Hamano
  0 siblings, 2 replies; 16+ messages in thread
From: Stanislav Malishevskiy via GitGitGadget @ 2023-03-20 15:48 UTC (permalink / raw)
  To: git; +Cc: Stanislav Malishevskiy, Stanislav Malishevskiy

From: Stanislav Malishevskiy <s.malishevskiy@auriga.com>

Basically git work with default curl ssl type - PEM. But for support
eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
and as sslkey type. So there added additional options for http to make
that possible.

Signed-off-by: Stanislav Malishevskiy <stanislav.malishevskiy@gmail.com>
---
    http: add support for different sslcert and sslkey types.
    
    Basically git work with default curl ssl type - PEM. But for support
    eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
    and as sslkey type. So there added additional options for http to make
    that possible.
    
    Signed-off-by: Stanislav Malishevskiy stanislav.malishevskiy@gmail.com
    
    Changes since v1:
    
     * Fixed the commit message (found by Khalid Masum)

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1474%2Fsmalishevskiy%2Fssl_types_support-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1474/smalishevskiy/ssl_types_support-v2
Pull-Request: https://github.com/git/git/pull/1474

Range-diff vs v1:

 1:  a4b2284dd36 ! 1:  899a0761d99 That change for support different sslcert and sslkey types.
     @@ Metadata
      Author: Stanislav Malishevskiy <s.malishevskiy@auriga.com>
      
       ## Commit message ##
     -    That change for support different sslcert and sslkey types.
     +    http: add support for different sslcert and sslkey types.
      
          Basically git work with default curl ssl type - PEM. But for support
          eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
     -    and as sslkey type. So there added additional options for http for make
     +    and as sslkey type. So there added additional options for http to make
          that possible.
      
     -    Signed-off-by: Stanislav Malishevskiy stanislav.malishevskiy@gmail.com
     +    Signed-off-by: Stanislav Malishevskiy <stanislav.malishevskiy@gmail.com>
      
       ## http.c ##
      @@ http.c: static int curl_ssl_verify = -1;


 http.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/http.c b/http.c
index dbe4d29ef7a..d5d82c5230f 100644
--- a/http.c
+++ b/http.c
@@ -40,6 +40,7 @@ static int curl_ssl_verify = -1;
 static int curl_ssl_try;
 static const char *curl_http_version = NULL;
 static const char *ssl_cert;
+static const char *ssl_cert_type;
 static const char *ssl_cipherlist;
 static const char *ssl_version;
 static struct {
@@ -59,6 +60,7 @@ static struct {
 #endif
 };
 static const char *ssl_key;
+static const char *ssl_key_type;
 static const char *ssl_capath;
 static const char *curl_no_proxy;
 #ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
@@ -374,8 +376,12 @@ static int http_options(const char *var, const char *value, void *cb)
 		return git_config_string(&ssl_version, var, value);
 	if (!strcmp("http.sslcert", var))
 		return git_config_pathname(&ssl_cert, var, value);
+	if (!strcmp("http.sslcerttype", var))
+		return git_config_string(&ssl_cert_type, var, value);
 	if (!strcmp("http.sslkey", var))
 		return git_config_pathname(&ssl_key, var, value);
+	if (!strcmp("http.sslkeytype", var))
+		return git_config_string(&ssl_key_type, var, value);
 	if (!strcmp("http.sslcapath", var))
 		return git_config_pathname(&ssl_capath, var, value);
 	if (!strcmp("http.sslcainfo", var))
@@ -1014,10 +1020,14 @@ static CURL *get_curl_handle(void)
 
 	if (ssl_cert)
 		curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
+	if (ssl_cert_type)
+		curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
 	if (has_cert_password())
 		curl_easy_setopt(result, CURLOPT_KEYPASSWD, cert_auth.password);
 	if (ssl_key)
 		curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
+	if (ssl_key_type)
+		curl_easy_setopt(result, CURLOPT_SSLKEYTYPE, ssl_key_type);
 	if (ssl_capath)
 		curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
 #ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
@@ -1252,7 +1262,9 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
 		curl_ssl_verify = 0;
 
 	set_from_env(&ssl_cert, "GIT_SSL_CERT");
+	set_from_env(&ssl_cert_type, "GIT_SSL_CERT_TYPE");
 	set_from_env(&ssl_key, "GIT_SSL_KEY");
+	set_from_env(&ssl_key_type, "GIT_SSL_KEY_TYPE");
 	set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
 	set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
 

base-commit: 950264636c68591989456e3ba0a5442f93152c1a
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-20 15:48 ` [PATCH v2] http: add support for " Stanislav Malishevskiy via GitGitGadget
@ 2023-03-20 17:10   ` Jeff King
  2023-03-20 18:21     ` Stanislav M
  2023-03-20 17:23   ` Junio C Hamano
  1 sibling, 1 reply; 16+ messages in thread
From: Jeff King @ 2023-03-20 17:10 UTC (permalink / raw)
  To: Stanislav Malishevskiy via GitGitGadget
  Cc: Todd Zullinger, git, Stanislav Malishevskiy,
	Stanislav Malishevskiy

On Mon, Mar 20, 2023 at 03:48:49PM +0000, Stanislav Malishevskiy via GitGitGadget wrote:

> From: Stanislav Malishevskiy <s.malishevskiy@auriga.com>
> 
> Basically git work with default curl ssl type - PEM. But for support
> eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
> and as sslkey type. So there added additional options for http to make
> that possible.

Seems like a reasonable thing to want, and the patch looks pretty clean.
Two small points:

>  http.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

There are no tests here. I think it might be possible to add them, but
our https test support is currently optional, and has bit-rotted a bit
over the years. There's some discussion here:

  https://lore.kernel.org/git/Y9s7vyHKXP+TQPRm@pobox.com/

So I don't think it makes sense to block this patch over the lack of
tests, but it's something we might keep in mind to add if the test
situation improves.

> @@ -1014,10 +1020,14 @@ static CURL *get_curl_handle(void)
>  
>  	if (ssl_cert)
>  		curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
> +	if (ssl_cert_type)
> +		curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);

We're just feeding curl whatever string the user gave us (which is good,
since we don't know which ones are valid). But what happens with:

  GIT_SSL_CERT_TYPE=bogus git fetch ...

Should we check for an error here, or will the actual request later
complain properly?

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-20 15:48 ` [PATCH v2] http: add support for " Stanislav Malishevskiy via GitGitGadget
  2023-03-20 17:10   ` Jeff King
@ 2023-03-20 17:23   ` Junio C Hamano
  2023-03-20 18:24     ` Stanislav M
  2023-03-21 17:22     ` Jeff King
  1 sibling, 2 replies; 16+ messages in thread
From: Junio C Hamano @ 2023-03-20 17:23 UTC (permalink / raw)
  To: Stanislav Malishevskiy via GitGitGadget
  Cc: git, Stanislav Malishevskiy, Stanislav Malishevskiy

"Stanislav Malishevskiy via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Stanislav Malishevskiy <s.malishevskiy@auriga.com>
>
> Basically git work with default curl ssl type - PEM. But for support
> eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
> and as sslkey type. So there added additional options for http to make
> that possible.
>
> Signed-off-by: Stanislav Malishevskiy <stanislav.malishevskiy@gmail.com>
> ---

>  http.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Thanks.

Is this something that can be protected from future breakage with a
few new tests somewhere in t/t5559 (which may also involve touching
t/lib-httpd.sh as well)?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-20 17:10   ` Jeff King
@ 2023-03-20 18:21     ` Stanislav M
  2023-03-21 17:22       ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: Stanislav M @ 2023-03-20 18:21 UTC (permalink / raw)
  To: Jeff King
  Cc: Stanislav Malishevskiy via GitGitGadget, Todd Zullinger, git,
	Stanislav Malishevskiy

> > @@ -1014,10 +1020,14 @@ static CURL *get_curl_handle(void)
> >
> >       if (ssl_cert)
> >               curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
> > +     if (ssl_cert_type)
> > +             curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
>
> We're just feeding curl whatever string the user gave us (which is good,
> since we don't know which ones are valid). But what happens with:
>
>   GIT_SSL_CERT_TYPE=bogus git fetch ...
>
> Should we check for an error here, or will the actual request later
> complain properly?


Curl itself validates that string. And if we pass the wrong type or
not pass 'ENG' in case of pkcs11: curl will return an error. In that
case git do the same if GIT_SSL_CERT passed wrong ss 'ENG' in case of
pkcs11: curl will return an error. In that case git do the same if
GIT_SSL_CERT passed wrong


пн, 20 мар. 2023 г. в 20:10, Jeff King <peff@peff.net>:
>
> On Mon, Mar 20, 2023 at 03:48:49PM +0000, Stanislav Malishevskiy via GitGitGadget wrote:
>
> > From: Stanislav Malishevskiy <s.malishevskiy@auriga.com>
> >
> > Basically git work with default curl ssl type - PEM. But for support
> > eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
> > and as sslkey type. So there added additional options for http to make
> > that possible.
>
> Seems like a reasonable thing to want, and the patch looks pretty clean.
> Two small points:
>
> >  http.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
>
> There are no tests here. I think it might be possible to add them, but
> our https test support is currently optional, and has bit-rotted a bit
> over the years. There's some discussion here:
>
>   https://lore.kernel.org/git/Y9s7vyHKXP+TQPRm@pobox.com/
>
> So I don't think it makes sense to block this patch over the lack of
> tests, but it's something we might keep in mind to add if the test
> situation improves.
>
> > @@ -1014,10 +1020,14 @@ static CURL *get_curl_handle(void)
> >
> >       if (ssl_cert)
> >               curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
> > +     if (ssl_cert_type)
> > +             curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
>
> We're just feeding curl whatever string the user gave us (which is good,
> since we don't know which ones are valid). But what happens with:
>
>   GIT_SSL_CERT_TYPE=bogus git fetch ...
>
> Should we check for an error here, or will the actual request later
> complain properly?
>
> -Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-20 17:23   ` Junio C Hamano
@ 2023-03-20 18:24     ` Stanislav M
  2023-03-21 17:22     ` Jeff King
  1 sibling, 0 replies; 16+ messages in thread
From: Stanislav M @ 2023-03-20 18:24 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

> Is this something that can be protected from future breakage with a
> few new tests somewhere in t/t5559 (which may also involve touching
> t/lib-httpd.sh as well)?


I am not sure about that. That required only  for local access to the
cert and key from curl


пн, 20 мар. 2023 г. в 20:23, Junio C Hamano <gitster@pobox.com>:
>
> "Stanislav Malishevskiy via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Stanislav Malishevskiy <s.malishevskiy@auriga.com>
> >
> > Basically git work with default curl ssl type - PEM. But for support
> > eTokens like SafeNet tokens via pksc11 need setup 'ENG' as sslcert type
> > and as sslkey type. So there added additional options for http to make
> > that possible.
> >
> > Signed-off-by: Stanislav Malishevskiy <stanislav.malishevskiy@gmail.com>
> > ---
>
> >  http.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
>
> Thanks.
>
> Is this something that can be protected from future breakage with a
> few new tests somewhere in t/t5559 (which may also involve touching
> t/lib-httpd.sh as well)?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-20 17:23   ` Junio C Hamano
  2023-03-20 18:24     ` Stanislav M
@ 2023-03-21 17:22     ` Jeff King
  2023-03-21 17:43       ` Junio C Hamano
  1 sibling, 1 reply; 16+ messages in thread
From: Jeff King @ 2023-03-21 17:22 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy, Stanislav Malishevskiy

On Mon, Mar 20, 2023 at 10:23:41AM -0700, Junio C Hamano wrote:

> Is this something that can be protected from future breakage with a
> few new tests somewhere in t/t5559 (which may also involve touching
> t/lib-httpd.sh as well)?

I don't think we'd want to put it there. While it is the only test that
requires SSL currently, it's also specific to HTTP/2, so it may not get
run everywhere.

The original design of the SSL support in the test suite was that you'd
do a run of the whole suite with LIB_HTTPD_SSL set, and then it would
run all of the usual tests with ssl. But experience has shown that
nobody does that. So I think there are two paths forward here:

  1. Add a mode to CI that runs with LIB_HTTPD_SSL set. We'd need to fix
     the bit-rotted tests that fail (usually due to things like
     expecting "http" in the output instead of "https", etc). I linked
     to earlier discussion there elsewhere in the thread.

  2. Add a specific "test with https" script that covers some basic
     tests (possibly even just including t5551, in the same way t5559
     does). If the platform apache doesn't support ssl, then it should
     fail gracefully. And then we could add more SSL specific tests
     to that script.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-20 18:21     ` Stanislav M
@ 2023-03-21 17:22       ` Jeff King
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff King @ 2023-03-21 17:22 UTC (permalink / raw)
  To: Stanislav M
  Cc: Stanislav Malishevskiy via GitGitGadget, Todd Zullinger, git,
	Stanislav Malishevskiy

On Mon, Mar 20, 2023 at 09:21:44PM +0300, Stanislav M wrote:

> > > @@ -1014,10 +1020,14 @@ static CURL *get_curl_handle(void)
> > >
> > >       if (ssl_cert)
> > >               curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
> > > +     if (ssl_cert_type)
> > > +             curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
> >
> > We're just feeding curl whatever string the user gave us (which is good,
> > since we don't know which ones are valid). But what happens with:
> >
> >   GIT_SSL_CERT_TYPE=bogus git fetch ...
> >
> > Should we check for an error here, or will the actual request later
> > complain properly?
> 
> Curl itself validates that string. And if we pass the wrong type or
> not pass 'ENG' in case of pkcs11: curl will return an error. In that
> case git do the same if GIT_SSL_CERT passed wrong ss 'ENG' in case of
> pkcs11: curl will return an error. In that case git do the same if
> GIT_SSL_CERT passed wrong

That sounds great. Thanks for confirming!

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-21 17:22     ` Jeff King
@ 2023-03-21 17:43       ` Junio C Hamano
  2023-03-23  9:33         ` Stanislav M
  0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2023-03-21 17:43 UTC (permalink / raw)
  To: Jeff King
  Cc: Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy, Stanislav Malishevskiy

Jeff King <peff@peff.net> writes:

>   2. Add a specific "test with https" script that covers some basic
>      tests (possibly even just including t5551, in the same way t5559
>      does). If the platform apache doesn't support ssl, then it should
>      fail gracefully. And then we could add more SSL specific tests
>      to that script.

Both choices sound sensible.  This second one may be simpler to
arrange.

Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-21 17:43       ` Junio C Hamano
@ 2023-03-23  9:33         ` Stanislav M
  2023-03-23 18:01           ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: Stanislav M @ 2023-03-23  9:33 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jeff King, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

I want to do some clarification there. Those changes are not related
to http or https directly.
That only configures curl to know how to access the certificate and
key locally on the client box, so if the way is wrong there is a
simple error: Certificate or key not found.

вт, 21 мар. 2023 г. в 20:43, Junio C Hamano <gitster@pobox.com>:
>
> Jeff King <peff@peff.net> writes:
>
> >   2. Add a specific "test with https" script that covers some basic
> >      tests (possibly even just including t5551, in the same way t5559
> >      does). If the platform apache doesn't support ssl, then it should
> >      fail gracefully. And then we could add more SSL specific tests
> >      to that script.
>
> Both choices sound sensible.  This second one may be simpler to
> arrange.
>
> Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-23  9:33         ` Stanislav M
@ 2023-03-23 18:01           ` Jeff King
  2023-03-23 18:16             ` Stanislav M
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff King @ 2023-03-23 18:01 UTC (permalink / raw)
  To: Stanislav M
  Cc: Junio C Hamano, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

On Thu, Mar 23, 2023 at 12:33:59PM +0300, Stanislav M wrote:

> I want to do some clarification there. Those changes are not related
> to http or https directly.
> That only configures curl to know how to access the certificate and
> key locally on the client box, so if the way is wrong there is a
> simple error: Certificate or key not found.

Yes, but I'm not sure if there is a way for Git to trigger curl to look
at the certificate that does not involve feeding it an https URL (and we
want a valid one, because we want to see that it correctly speaks to the
server).

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-23 18:01           ` Jeff King
@ 2023-03-23 18:16             ` Stanislav M
  2023-03-29 18:53               ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Stanislav M @ 2023-03-23 18:16 UTC (permalink / raw)
  To: Jeff King
  Cc: Junio C Hamano, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

In my opinion they need the same set of tests which is used as usual
for https. But use the right certificate and key.
But I don't have any idea how to do that with hardware usb eToken in my case.

чт, 23 мар. 2023 г. в 21:02, Jeff King <peff@peff.net>:
>
> On Thu, Mar 23, 2023 at 12:33:59PM +0300, Stanislav M wrote:
>
> > I want to do some clarification there. Those changes are not related
> > to http or https directly.
> > That only configures curl to know how to access the certificate and
> > key locally on the client box, so if the way is wrong there is a
> > simple error: Certificate or key not found.
>
> Yes, but I'm not sure if there is a way for Git to trigger curl to look
> at the certificate that does not involve feeding it an https URL (and we
> want a valid one, because we want to see that it correctly speaks to the
> server).
>
> -Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-23 18:16             ` Stanislav M
@ 2023-03-29 18:53               ` Junio C Hamano
  2023-03-29 19:22                 ` Stanislav M
  2023-03-29 23:23                 ` Jeff King
  0 siblings, 2 replies; 16+ messages in thread
From: Junio C Hamano @ 2023-03-29 18:53 UTC (permalink / raw)
  To: Stanislav M
  Cc: Jeff King, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

Stanislav M <stanislav.malishevskiy@gmail.com> writes:

[administrivia: do not top-post]

>> Yes, but I'm not sure if there is a way for Git to trigger curl to look
>> at the certificate that does not involve feeding it an https URL (and we
>> want a valid one, because we want to see that it correctly speaks to the
>> server).
> ...
> In my opinion they need the same set of tests which is used as usual
> for https. But use the right certificate and key.
> But I don't have any idea how to do that with hardware usb eToken in my case.

OK, so where does this put us, with respect to the change?  We have
some behaviour change that we do not know how to test?  How would we
know when we break it in the future?  It is not like the new feature
is not useful enough that nobody would care if it gets broken by
accident or anything like that, so...?

At least perhaps we can throw bogus strings in the environment and
make sure cURL library gives complaints, or something?

Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-29 18:53               ` Junio C Hamano
@ 2023-03-29 19:22                 ` Stanislav M
  2023-03-29 23:23                 ` Jeff King
  1 sibling, 0 replies; 16+ messages in thread
From: Stanislav M @ 2023-03-29 19:22 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jeff King, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

Yes. If you set bogus strings  in the environment cURL should return
an error the same as if you set the wrong file for certificate or key.

So you can set

GIT_SSL_CERT=some_real_pem_file  - That should work (PEM type used by default)

GIT_SSL_CERT=some_real_pem_file  GIT_SSL_CERT_TYPE=PEM - That should work too

GIT_SSL_CERT=some_real_pem_file  GIT_SSL_CERT_TYPE=Bogus - That shouldn't work

GIT_SSL_CERT=some_real_der_file  GIT_SSL_CERT_TYPE=DER - I am not sure
about that, because as I far remember there issue with DER in openssl

I think that more detailed information there:
https://curl.se/libcurl/c/CURLOPT_SSLKEYTYPE.html

Basically that only a format of cert and key file or engine in case of
pkcs11 url instead of file in others cases.

So if you set it into right values, respect your ssl cert and ssl key
- https should work. But if not, error from curl should returned

ср, 29 мар. 2023 г. в 21:53, Junio C Hamano <gitster@pobox.com>:
>
> Stanislav M <stanislav.malishevskiy@gmail.com> writes:
>
> [administrivia: do not top-post]
>
> >> Yes, but I'm not sure if there is a way for Git to trigger curl to look
> >> at the certificate that does not involve feeding it an https URL (and we
> >> want a valid one, because we want to see that it correctly speaks to the
> >> server).
> > ...
> > In my opinion they need the same set of tests which is used as usual
> > for https. But use the right certificate and key.
> > But I don't have any idea how to do that with hardware usb eToken in my case.
>
> OK, so where does this put us, with respect to the change?  We have
> some behaviour change that we do not know how to test?  How would we
> know when we break it in the future?  It is not like the new feature
> is not useful enough that nobody would care if it gets broken by
> accident or anything like that, so...?
>
> At least perhaps we can throw bogus strings in the environment and
> make sure cURL library gives complaints, or something?
>
> Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-29 18:53               ` Junio C Hamano
  2023-03-29 19:22                 ` Stanislav M
@ 2023-03-29 23:23                 ` Jeff King
  2023-03-30  0:20                   ` Junio C Hamano
  1 sibling, 1 reply; 16+ messages in thread
From: Jeff King @ 2023-03-29 23:23 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Stanislav M, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

On Wed, Mar 29, 2023 at 11:53:11AM -0700, Junio C Hamano wrote:

> > In my opinion they need the same set of tests which is used as usual
> > for https. But use the right certificate and key.
> > But I don't have any idea how to do that with hardware usb eToken in my case.
> 
> OK, so where does this put us, with respect to the change?  We have
> some behaviour change that we do not know how to test?  How would we
> know when we break it in the future?  It is not like the new feature
> is not useful enough that nobody would care if it gets broken by
> accident or anything like that, so...?
> 
> At least perhaps we can throw bogus strings in the environment and
> make sure cURL library gives complaints, or something?

I would be OK taking the patches without any further tests. It is not
really making anything worse in the sense that we already do not test
any of the client-cert stuff.

If we can cheaply add some tests that at least exercise the code and
hand off to curl, that is better than nothing, I guess.

I think the ideal would be a new t5565 that sets LIB_HTTPD_SSL
unconditionally and actually tests various client-cert formats and
requests using a made-on-the-fly cert. But I don't want to hold up a
patch we otherwise think is OK on the basis of long-term technical debt
we already have.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] http: add support for different sslcert and sslkey types.
  2023-03-29 23:23                 ` Jeff King
@ 2023-03-30  0:20                   ` Junio C Hamano
  0 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2023-03-30  0:20 UTC (permalink / raw)
  To: Jeff King
  Cc: Stanislav M, Stanislav Malishevskiy via GitGitGadget, git,
	Stanislav Malishevskiy

Jeff King <peff@peff.net> writes:

> On Wed, Mar 29, 2023 at 11:53:11AM -0700, Junio C Hamano wrote:
>
> ...
>> > But I don't have any idea how to do that with hardware usb eToken in my case.
>> 
>> OK, so where does this put us, with respect to the change?  ...
> I would be OK taking the patches without any further tests. It is not
> really making anything worse in the sense that we already do not test
> any of the client-cert stuff.

Alright.  I think the patch has already been queued for some time,
and it is OK to merge it down to 'next'.

> If we can cheaply add some tests that at least exercise the code and
> hand off to curl, that is better than nothing, I guess.
>
> I think the ideal would be a new t5565 that sets LIB_HTTPD_SSL
> unconditionally and actually tests various client-cert formats and
> requests using a made-on-the-fly cert.

Thanks.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-03-30  0:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19 13:51 [PATCH] That change for support different sslcert and sslkey types Stanislav Malishevskiy via GitGitGadget
2023-03-20 15:48 ` [PATCH v2] http: add support for " Stanislav Malishevskiy via GitGitGadget
2023-03-20 17:10   ` Jeff King
2023-03-20 18:21     ` Stanislav M
2023-03-21 17:22       ` Jeff King
2023-03-20 17:23   ` Junio C Hamano
2023-03-20 18:24     ` Stanislav M
2023-03-21 17:22     ` Jeff King
2023-03-21 17:43       ` Junio C Hamano
2023-03-23  9:33         ` Stanislav M
2023-03-23 18:01           ` Jeff King
2023-03-23 18:16             ` Stanislav M
2023-03-29 18:53               ` Junio C Hamano
2023-03-29 19:22                 ` Stanislav M
2023-03-29 23:23                 ` Jeff King
2023-03-30  0:20                   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).