Skip to contentSkip to conversation

tpm2-pkcs11 and certificates, also Linux Networking

tpm2 s.schwebel at uvensys.de 2 participants 5 messages Jan 16, 2020 – Jan 17, 2020

lore
Share & tools
lore

s.schwebel at uvensys.de

#0 lore raw

Hello again,

Ive been trying for some time now to get this Linux machine to connect to a 802.1 Network, that is client certificates

As far as I can tell, that means using PKCS11, that seems to be supported in wpa_suplicant at least.

Ive found a version of NetworkManager that seems to access TPM2 via tpm2-tss -> https://gitlab.freedesktop.org/apatard/NetworkManager
but I cannot provided a custom build Networkmanager for users.

So, I try to use pcks11, which works fine up to the point where I have to import the signed cert into the store. I think I need to do that, at least.

My steps:
1) create store
tpm2_ptool init

2) create token
tpm2_ptool addtoken --pid=1 --label=soveryimportant --sopin=123123 --userpin=456456

Now, I can create Keys and I tested pretty much any way I know of
3) create key
tpm2_ptool addkey --label=soveryimportant --userpin=456456 --algorithm=rsa2048
p11tool --login --generate-rsa --bits=2048 --label=soveryimportant "pkcs11:model=;manufacturer=STMicro;serial=0000000000000000;token=soveryimportant"

and whatever the syntax of pkcs11-tool is, I tried that as well

I can generate a CSR just fine
openssl req -new -engine pkcs11 -keyform engine -key "$url" -out cert.csr

Adding the cert fails in a million ways:

tpm2pkcs11-tool -w hardware.crt -y cert
Using slot 0 with a present token (0x1)
error: PKCS11 function C_CreateObject failed: rv = CKR_FUNCTION_NOT_SUPPORTED (0x54)

p11tool just hangs..
p11tool --login --write "pkcs11:model=;manufacturer=STMicro;serial=0000000000000000;token=soveryimortant" --load-certificate hardware.crt --label "soveryimportant"

/tpm2_ptool addcert --label soveryimportant --key-id "f2:be:d0:ab:c3:81:72:8a:b5:40:69:31:d1:38:28:8c:9d:bb:ee:9e" /home/steffenschwebel/Projects/PKI_network/hardware.crt

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pyasn1/type/constraint.py", line 32, in __call__
self._testValue(value, idx)
File "/usr/lib/python3/dist-packages/pyasn1/type/constraint.py", line 297, in _testValue
raise error.ValueConstraintError(value)
pyasn1.type.error.ValueConstraintError: Extensions:

Any help?
I'll now try to get it working without having the cert in the store, only the key

regards,
Steffen Schwebel

#1 lore raw

Hi Steffen,

In our side, we were able to get wpa_supplicant, tpm2_pkcs11, and EAP-TLS to authenticate a device in a corporate network. It requires a wireless AP or router that supports EAP-TLS, and a Radius server for auth.

There is a thread in this mailing list about that here https://lists.01.org/hyperkitty/list/tpm2(a)lists.01.org/thread/AYUBCAFCCXITEVSWA4IFC466LYS6ZIYX/
There are also commits in tpm2-pkcs11 to enable support for wpa_supplicant https://github.com/tpm2-software/tpm2-pkcs11/pull/366

#2 lore raw

Hi,

I managed to get that working as well.

I also asked at NetworkManager and wpa_supplicant mailing list.

Seems that NM has support for tpm2-tss at versions > 1.20 Not sure yet about wpa_supplicant.

Since I couldnt store the client cert via PKCS11, I point wpa_supplicant to a file on disk

client_cert="/home/steffenschwebel/Projects/PKI_network/hardware.crt" private_key="pkcs11:model=;manufacturer=STMicro;serial=0000000000000000;token=soveryimportant;id=%F2%BE%D0%AB%C3%81%72%8A%B5%40%69%31%D1%38%28%8C%9D%BB%EE%9E;object=klarna;type=private" pin="456456"

regards,
Steffen

Quoted 11 lines · On 1/16/20 7:49 PM, nicolasoliver03(a)gmail.com wrote:

Hi Steffen,

In our side, we were able to get wpa_supplicant, tpm2_pkcs11, and EAP-TLS to authenticate a device in a corporate network. It requires a wireless AP or router that supports EAP-TLS, and a Radius server for auth.

There is a thread in this mailing list about that here https://lists.01.org/hyperkitty/list/tpm2(a)lists.01.org/thread/AYUBCAFCCXITEVSWA4IFC466LYS6ZIYX/
There are also commits in tpm2-pkcs11 to enable support for wpa_supplicant https://github.com/tpm2-software/tpm2-pkcs11/pull/366
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

#3 lore raw
Quoted 12 lines

-----Original Message-----
From: Steffen Schwebel [mailto:s.schwebel(a)uvensys.de]
Sent: Thursday, January 16, 2020 1:02 PM
To: tpm2(a)lists.01.org >> tpm2 <tpm2(a)lists.01.org>
Subject: [tpm2] Re: tpm2-pkcs11 and certificates, also Linux Networking

Hi,

I managed to get that working as well.

Quoted 7 lines

I also asked at NetworkManager and wpa_supplicant mailing list.

Seems that NM has support for tpm2-tss at versions > 1.20 Not sure yet about wpa_supplicant.

Since I couldnt store the client cert via PKCS11, I point wpa_supplicant to a file on disk

You should be able to now via tpm2_ptool addcert on the master branch. I have that Feature heading for v1.1.

Quoted 34 lines

client_cert="/home/steffenschwebel/Projects/PKI_network/hardware.crt" private_key="pkcs11:model=;manufacturer=STMicro;serial=0000000000000000;t oken=soveryimportant;id=%F2%BE%D0%AB%C3%81%72%8A%B5%40%69%31%D 1%38%28%8C%9D%BB%EE%9E;object=klarna;type=private" pin="456456"

regards,
Steffen

Quoted 3 lines · On 1/16/20 7:49 PM, nicolasoliver03(a)gmail.com wrote:

Hi Steffen,

In our side, we were able to get wpa_supplicant, tpm2_pkcs11, and EAP-TLS to

authenticate a device in a corporate network.

Quoted 1 line

It requires a wireless AP or router that supports EAP-TLS, and a Radius server

for auth.

Quoted 10 lines

There is a thread in this mailing list about that here
https://lists.01.org/hyperkitty/list/tpm2(a)lists.01.org/thread/AYUBCAFC
CXITEVSWA4IFC466LYS6ZIYX/ There are also commits in tpm2-pkcs11 to enable support for wpa_supplicant
https://github.com/tpm2-software/tpm2-pkcs11/pull/366
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

#4 lore raw

Hello,

yes, "should" :)

I was just about to open an issue on github when I tried it again this morning.

For some reason it worked

steffenschwebel(a)ubuntu:/opt/tpm2-pkcs11/tools$ ./tpm2_ptool addcert --label soveryimportant /home/steffenschwebel/Projects/PKI_network/hardware.crt --key-label soveryimportant
action: add
cert:
  CKA_ID: f2bed0abc381728ab5406931d138288c9dbbee9e

But I have other problems with that now. If I try to list-all I just hangs. And I cant use the certificate URL via wpa_supplicant

Not sure how to debug this further..