git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Mickler <florian@mickler.org>
To: git@vger.kernel.org
Cc: jqassar@gmail.com
Subject: passing CURLOPT_CERTTYPE to libcurl
Date: Sat, 18 Dec 2021 01:06:21 +0100	[thread overview]
Message-ID: <20211218010621.2fdc2b3c@monster.mickler.org> (raw)

Hi,

I recently needed to use a tls client certificate from my companies pki
card (smartcard)  in order to get access to a git repository via https.
The client system I used was set up such that there was a pkcs11 openssl
module that would asks for a pin whenever the certificate was needed. 

While I was able to connect to the git repo via curl with 

	curl -E 'pkcs\:[REDACTED_PART_OF_PKCS_URL]' --key\
	'pkcs:[REDACTED_PART_OF_PKCS_URL]' --cert-type ENG\
	--key-type ENG $URL

I was not able to connect to the host with current git. I could pass
the pkcs urls for key and cert, but openssl expected them to be in "PEM"
encoding. While the certificates on the card where apparently of form
"ENG". 

After a bit of searching, I found a patch[1] for git to pass
the cert-type to libcurl (CURLOPT_SSLKEYTYPE and CURLOPT_SSLCERTTYPE)
from 2013. And sure enough, forward-porting it to current HEAD meant
that I could successfully connect to that host and clone the repo. 

Only the CURLOPT_SSLKEYTYPE and CURLOPT_SSLCERTTYPE are needed in my
case, because the openssl config sets up the pkcs11 module. My
understanding is that the pkcs11 module get's triggered by the
pkcs11:urls for key and cert. It might be this openssl module: 
https://github.com/OpenSC/libp11 

Is there a specific reason, that patch wasn't merged? It would allow
for non-pem ssl certificates to be loaded also (without pkcs11 at all). 

I realize, that the underlying systems could and should set up
everything automagically as soon as i point them to the certificate that
i want to use. But not opening up these CURL Settings from git seems
kind of silly given that today's systems still seem kinda borked and do
not do that.  What harm comes from these two tuning knobs being exposed?

Best regards,
Flo


[1] https://marc.info/?l=git&m=136675822032549&w=2



             reply	other threads:[~2021-12-18  0:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18  0:06 Florian Mickler [this message]
2021-12-18  1:08 ` passing CURLOPT_CERTTYPE to libcurl Junio C Hamano
2021-12-20 22:21   ` Johannes Schindelin
2021-12-21  9:45     ` Florian Mickler
2021-12-21 16:20       ` Ævar Arnfjörð Bjarmason

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=20211218010621.2fdc2b3c@monster.mickler.org \
    --to=florian@mickler.org \
    --cc=git@vger.kernel.org \
    --cc=jqassar@gmail.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).