Openvpn : connect error: Missing External PKI alias
Openvpn : connect error: Missing External PKI alias
我刚刚设置了一个 2.4.4 版的 openvpn 服务器,它在 Windows 和 Android 中与 Openvpn 客户端配合使用很好,但在 Mac OS 中出错。
Tue Dec 10 10:50:31 2019 OMI Connecting to /Library/Application Support/OpenVPN/sock/ovpn-KTMpKfLsCR5a.sock [unix]
Tue Dec 10 10:50:35 2019 CLIENT_EXCEPTION : connect error: Missing External PKI alias [FATAL-ERR]
Tue Dec 10 10:50:35 2019 >FATAL:CLIENT_EXCEPTION: connect error: Missing External PKI alias
我正在 MacOS 版本 10.4.4 和 Openvpn 客户端 2.7.1.100 中进行测试。
下面是client.ovpn
client
dev tun
proto tcp-client
remote vpn01 9443
resolv-retry infinite
cipher AES-256-CBC
redirect-gateway
# Keys
# Identity
key-direction 1
remote-cert-tls server
auth-user-pass
auth-nocache
# Security
nobind
persist-key
persist-tun
comp-lzo
verb 3
# Proxy ?
# http-proxy cache.univ.fr 3128
<ca>
-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIUdu/viXgfwhA+wu0K49vvnXaCyFkwDQYJKoZIhvcNAQEL
BQAwHDEaMBgGA1UEAwwRdnBuMDEuaG9tZWNjYS5jb20wHhcNMTkxMjA5MTA1NTQ5
任何想法或可能导致此问题的原因?
我在 MacOS 上使用 OpenVPN Connect 客户端时遇到了同样的问题 - 我切换到 TunnelBlick 客户端软件,并使用相同的 .ovpn 文件工作正常。还没有找到任何关于为什么 OpenVPN Connect 不起作用的线索。
外部 PKI 意味着 OpenVPN Connect 客户端使用 'external certificate' 与其配置 'profile' 相比,.ovpn 文件也可以具有内联 PEM 证书。
据我了解,此外部 PKI 可以是 Windows crtmgr 或 macOS Keychain 证书存储(或移动设备中的证书存储)中的证书。在 Windows 的情况下,它很简单并且有效。 macOS 是另一回事了。
目前(截至 2020-04)Catalina 是最新的 macOS 版本,它只有 CryptoTokenKit (CTK) 框架,Tokend 没有了。当使用硬件安全模块 (HSM)、智能卡、USB 令牌时,它们不再像使用 Tokend 那样出现在 Keychain 中。不明白为什么。如果这个 'external PKI' 真的在寻找来自 Keychain 的证书,这就是一个问题。
https://openvpn.net/vpn-server-resources/external-public-key-infrastructure-pki/
说
On the client, the server-locked profile can only be used to make a VPN
tunnel connection if a suitable client certificate/key pair has already
been installed into the host OS Keychain or certificate/key store. Some
hardware devices or tokens contain a certificate inside that is registered
with the certificate store with additional software when the token
device/card is plugged in.
从页面的其余部分和我在其他地方读到的内容,我猜想这个丢失的别名是将钥匙串中的证书映射到给定连接尝试的名称。你不确定。
据我所知,真正的问题是 Connect 客户端正在从 Keychain 查找证书,而 Apple 切换到 CTK 破坏了它。即使那些硬件令牌在系统中工作,它们也不会出现在钥匙串中。我正在寻找撤消此更改的解决方案,并偶然发现了 keychain-pkcs11,它说:
https://github.com/kenh/keychain-pkcs11/blob/master/man/keychain-pkcs11.man
will provide two virtual PKCS#11 slots. The first slot will provide all
identities that are available from connected SmartCards. The second slot
will provide an interface to certificates stored in the operating system
Keychain.
这不是我想要的。它在 pkcs#11 插件之外提供那些钥匙串证书,但不会将 HSM 证书填充到钥匙串。
一旦您完全确定我是否正确理解了实际问题图片,问题就有点难以解决,更不用说找出解决方案了。 :)
您应该尝试编辑您的 *.ovpn 配置文件:
Delete your profile in the openvpn client and then edit the .ovpn file you exported from the server and add the following line before
client-cert-not-required
我从 https://forum.opnsense.org/index.php?topic=14687.0
得到这个答案
此错误之前:
配置文件修改修复了这个错误。
我刚刚设置了一个 2.4.4 版的 openvpn 服务器,它在 Windows 和 Android 中与 Openvpn 客户端配合使用很好,但在 Mac OS 中出错。
Tue Dec 10 10:50:31 2019 OMI Connecting to /Library/Application Support/OpenVPN/sock/ovpn-KTMpKfLsCR5a.sock [unix]
Tue Dec 10 10:50:35 2019 CLIENT_EXCEPTION : connect error: Missing External PKI alias [FATAL-ERR]
Tue Dec 10 10:50:35 2019 >FATAL:CLIENT_EXCEPTION: connect error: Missing External PKI alias
我正在 MacOS 版本 10.4.4 和 Openvpn 客户端 2.7.1.100 中进行测试。 下面是client.ovpn
client
dev tun
proto tcp-client
remote vpn01 9443
resolv-retry infinite
cipher AES-256-CBC
redirect-gateway
# Keys
# Identity
key-direction 1
remote-cert-tls server
auth-user-pass
auth-nocache
# Security
nobind
persist-key
persist-tun
comp-lzo
verb 3
# Proxy ?
# http-proxy cache.univ.fr 3128
<ca>
-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIUdu/viXgfwhA+wu0K49vvnXaCyFkwDQYJKoZIhvcNAQEL
BQAwHDEaMBgGA1UEAwwRdnBuMDEuaG9tZWNjYS5jb20wHhcNMTkxMjA5MTA1NTQ5
任何想法或可能导致此问题的原因?
我在 MacOS 上使用 OpenVPN Connect 客户端时遇到了同样的问题 - 我切换到 TunnelBlick 客户端软件,并使用相同的 .ovpn 文件工作正常。还没有找到任何关于为什么 OpenVPN Connect 不起作用的线索。
外部 PKI 意味着 OpenVPN Connect 客户端使用 'external certificate' 与其配置 'profile' 相比,.ovpn 文件也可以具有内联 PEM 证书。 据我了解,此外部 PKI 可以是 Windows crtmgr 或 macOS Keychain 证书存储(或移动设备中的证书存储)中的证书。在 Windows 的情况下,它很简单并且有效。 macOS 是另一回事了。
目前(截至 2020-04)Catalina 是最新的 macOS 版本,它只有 CryptoTokenKit (CTK) 框架,Tokend 没有了。当使用硬件安全模块 (HSM)、智能卡、USB 令牌时,它们不再像使用 Tokend 那样出现在 Keychain 中。不明白为什么。如果这个 'external PKI' 真的在寻找来自 Keychain 的证书,这就是一个问题。
https://openvpn.net/vpn-server-resources/external-public-key-infrastructure-pki/
说
On the client, the server-locked profile can only be used to make a VPN
tunnel connection if a suitable client certificate/key pair has already
been installed into the host OS Keychain or certificate/key store. Some
hardware devices or tokens contain a certificate inside that is registered
with the certificate store with additional software when the token
device/card is plugged in.
从页面的其余部分和我在其他地方读到的内容,我猜想这个丢失的别名是将钥匙串中的证书映射到给定连接尝试的名称。你不确定。
据我所知,真正的问题是 Connect 客户端正在从 Keychain 查找证书,而 Apple 切换到 CTK 破坏了它。即使那些硬件令牌在系统中工作,它们也不会出现在钥匙串中。我正在寻找撤消此更改的解决方案,并偶然发现了 keychain-pkcs11,它说:
https://github.com/kenh/keychain-pkcs11/blob/master/man/keychain-pkcs11.man
will provide two virtual PKCS#11 slots. The first slot will provide all
identities that are available from connected SmartCards. The second slot
will provide an interface to certificates stored in the operating system
Keychain.
这不是我想要的。它在 pkcs#11 插件之外提供那些钥匙串证书,但不会将 HSM 证书填充到钥匙串。
一旦您完全确定我是否正确理解了实际问题图片,问题就有点难以解决,更不用说找出解决方案了。 :)
您应该尝试编辑您的 *.ovpn 配置文件:
Delete your profile in the openvpn client and then edit the .ovpn file you exported from the server and add the following line before
client-cert-not-required
我从 https://forum.opnsense.org/index.php?topic=14687.0
得到这个答案此错误之前:
配置文件修改修复了这个错误。