大网数据广告活动
服务器运维问答

openvpn client certificate error with "unsupported purpose"

· 52CE 我爱测

I was following this wiki instruction to generate OpenVPN client certificate. This involves: easyrsa gen-req client1 nopass I tried to use this client1 certificate in my OpenVPN setup. The server log show the following logs (note…

问题原文

原帖链接 · Koala Yeung · CC BY-SA 3.0

I was following this wiki instruction to generate OpenVPN client certificate. This involves:

easyrsa gen-req client1 nopass

I tried to use this client1 certificate in my OpenVPN setup. The server log show the following logs (note: the IP address changed from public IP to 192.168.0.2 for security reason):

192.168.0.2:5570 TLS: Initial packet from [AF_INET]192.168.0.2:5570, sid=1e71335b cc13ec8f
192.168.0.2:5570 VERIFY ERROR: depth=0, error=unsupported certificate purpose: CN=client1
192.168.0.2:5570 OpenSSL: error:1417C086:SSL routines:tls_process_client_certificate:certificate verify failed
192.168.0.2:5570 TLS_ERROR: BIO read tls_read_plaintext error
192.168.0.2:5570 TLS Error: TLS object -> incoming plaintext read error
192.168.0.2:5570 TLS Error: TLS handshake failed
192.168.0.2:5570 SIGUSR1[soft,tls-error] received, client-instance restarting

So the clear error should be this:

VERIFY ERROR: depth=0, error=unsupported certificate purpose: CN=client1

I checked the certificate with this command:

openssl x509 -in client1.crt -text -noout -purpose

And the Certificate purposes section output looks like this:

Certificate purposes:
SSL client : No
SSL client CA : No
SSL server : Yes
SSL server CA : No
Netscape SSL server : Yes
Netscape SSL server CA : No
S/MIME signing : No
S/MIME signing CA : No
S/MIME encryption : No
S/MIME encryption CA : No
CRL signing : No
CRL signing CA : No
Any Purpose : Yes
Any Purpose CA : Yes
OCSP helper : Yes
OCSP helper CA : No
Time Stamp signing : No
Time Stamp signing CA : No

My Questions:

  1. What is wrong with my client certificate?
  2. What should I do to generate the correct certificate?

已采纳解答

原帖链接 · dotvotdot · CC BY-SA 3.0

The correct way to enable nsCertType is via the easyrsa vars file:

# Support deprecated "Netscape" extensions? (choices "yes" or "no".) The default
# is "no" to discourage use of deprecated extensions. If you require this
# feature to use with --ns-cert-type, set this to "yes" here. This support
# should be replaced with the more modern --remote-cert-tls feature.  If you do
# not use --ns-cert-type in your configs, it is safe (and recommended) to leave
# this defined to "no".  When set to "yes", server-signed certs get the
# nsCertType=server attribute, and also get any NS_COMMENT defined below in the
# nsComment field.

#set_var EASYRSA_NS_SUPPORT "no"
 set_var EASYRSA_NS_SUPPORT "yes"

The resulting certificate has the following purpose:

    X509v3 Extended Key Usage: 
        TLS Web Client Authentication
    X509v3 Key Usage: 
        Digital Signature
    Netscape Comment: 
        Easy-RSA Generated Certificate
    Netscape Cert Type: 
        SSL Client

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。