
我想將 WPA 請求者設定為使用 TPM 2.0 託管憑證進行驗證,以便連接到公司網路。
我建立了由 TPM 管理的 RSA 金鑰對,產生了 CSR 並收到了由公司 CA 簽署的憑證。現在我需要設定 WPA 請求者以使用此證書,並發現僅 1 個對 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"
}
當我更改 TPM 2.0 相容實用程式的路徑時pkcs11_engine_path
,pkcs11_module_path
如何在此配置中使用我的憑證?我是否也應該由 TPM 管理它以及如何管理?
預先感謝您的任何幫助。
答案1
您不需要特定於 TPM 的 PKCS#11 範例 - 它們的工作方式與任何其他 PKCS#11 模組一樣。如果您可以讓它與 Yubikey 或 SoftHSM2 一起工作,那麼它應該與 tpm2-pkcs11 完全相同。
是的,許多程式希望可以透過與對應金鑰相同的 PKCS#11 模組來存取憑證。導入證書的功能實際上是在幾天前添加到 tpm2-pkcs11 中的。 (如果您打算從 Git master 進行構建,請注意資料庫格式也已變更。)
但是,wpa_supplicant(如果使用 OpenSSL)現在可以識別「pkcs11:」URI 並自動載入 engine_pkcs11;您不再需要使用engine=
或key_id=
選項。相反,您可以使用:
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"
}
因此理論上,這應該允許您指定本機檔案路徑作為客戶端證書,同時仍然使用令牌 URI 作為私鑰。
答案2
這對我有用:
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"
}
請注意,類型是“cert”而不是“certificate”。此外,私鑰上也需要存在 pin 值,即使未使用它(插槽 9e)。