git/list[1] front-page[2] threads[3] people[4] search[5] about
 

passing CURLOPT_CERTTYPE to libcurl

From
FMFlorian Mickler <florian@mickler.org>
Date
Dec 18, 2021, 00:06 UTC
Message-ID
<20211218010621.2fdc2b3c@monster.mickler.org>
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
Next: Junio C Hamano
Message 1 of 5 in “passing CURLOPT_CERTTYPE to libcurl”
  1. Florian MicklerDec 18, 2021
  2. Junio C HamanoDec 18, 2021
  3. Johannes SchindelinDec 20, 2021
  4. Florian MicklerDec 21, 2021
  5. Ævar Arnfjörð BjarmasonDec 21, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.