
Me gustaría configurar el solicitante WPA para que se autentique con el certificado administrado TPM 2.0 para conectarse a la red de la empresa.
Creé un par de claves RSA administrado por mi TPM, generé CSR y recibí un certificado firmado por la CA de la empresa. Ahora necesito configurar el solicitante WPA para usar este certificado y solo encontré 1 ejemplo que es válido para TPM 1.0:
https://w1.fi/cgit/hostap/plain/wpa_supplicant/examples/openCryptoki.conf
# EAP-TLS using private key and certificates via OpenSSL PKCS#11 engine and
# openCryptoki (e.g., with TPM token)
# This example uses following PKCS#11 objects:
# $ pkcs11-tool --module /usr/lib/opencryptoki/libopencryptoki.so -O -l
# Please enter User PIN:
# Private Key Object; RSA
# label: rsakey
# ID: 04
# Usage: decrypt, sign, unwrap
# Certificate Object, type = X.509 cert
# label: ca
# ID: 01
# Certificate Object, type = X.509 cert
# label: cert
# ID: 04
# Configure OpenSSL to load the PKCS#11 engine and openCryptoki module
pkcs11_engine_path=/usr/lib/engines/engine_pkcs11.so
pkcs11_module_path=/usr/lib/opencryptoki/libopencryptoki.so
network={
ssid="test network"
key_mgmt=WPA-EAP
eap=TLS
identity="User"
# use OpenSSL PKCS#11 engine for this network
engine=1
engine_id="pkcs11"
# select the private key and certificates based on ID (see pkcs11-tool
# output above)
key_id="4"
cert_id="4"
ca_cert_id="1"
# set the PIN code; leave this out to configure the PIN to be requested
# interactively when needed (e.g., via wpa_gui or wpa_cli)
pin="123456"
}
Cuando cambio las rutas hacia pkcs11_engine_path
las pkcs11_module_path
utilidades compatibles con TPM 2.0, ¿cómo uso mi certificado en esta configuración? ¿Debería hacerlo también administrado por TPM y cómo?
Gracias de antemano por cualquier ayuda.
Respuesta1
No necesita ejemplos de PKCS#11 específicos de TPM: funcionan como cualquier otro módulo PKCS#11. Si puede hacerlo funcionar con Yubikey o SoftHSM2, entonces debería ser exactamente igual con tpm2-pkcs11.
Sí, muchos programas esperan que se pueda acceder al certificado a través del mismo módulo PKCS#11 que la clave correspondiente. De hecho, la capacidad de importar certificados se agregó a tpm2-pkcs11 hace apenas unos días. (Y si planea compilar desde Git master, tenga en cuenta que el formato de la base de datos también ha cambiado).
Sin embargo, wpa_supplicant (si usa OpenSSL) ahora reconoce los URI "pkcs11:" y carga automáticamente Engine_pkcs11; ya no es necesario utilizar las opciones engine=
o key_id=
. En su lugar puedes usar:
network={
ssid="test network"
key_mgmt=WPA-EAP
eap=TLS
identity="User"
client_cert="pkcs11:model=NPCT75x;token=JM;object=myfirstcert;type=certificate"
private_key="pkcs11:model=NPCT75x;token=JM;object=myfirstcert;type=private"
}
Entonces, en teoría, esto debería permitirle especificar una ruta de archivo local como certificado de cliente, mientras sigue usando un URI token para la clave privada.
Respuesta2
Esto funcionó para mí:
network={
ssid="test network"
key_mgmt=WPA-EAP
eap=TLS
identity="User"
ca_cert="pkcs11:id=%03;type=cert"
client_cert="pkcs11:id=%04;type=cert"
private_key="pkcs11:id=%04;type=private;pin-value=123456"
}
Tenga en cuenta que el tipo es "certificado", no "certificado". Además, el valor del pin debe estar presente en la clave_privada, incluso si no se usa (ranura 9e).