# 初始化 cd /usr/local/openvpn/easy-rsa ./easyrsa init-pki
初始化成功后,可以看到如下输出信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Notice ------ 'init-pki' complete; you may now create a CA or requests.
Your newly created PKI dir is: * /usr/local/openvpn/easy-rsa/pki
Using Easy-RSA configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
2. 创建 CA 证书
以 自定义 CA 的名义,为 caogo 颁布 CA 证书,无密码登录方式。
1
./easyrsa build-ca nopass
处理结果:
CA 证书文件:/usr/local/openvpn/easy-rsa/pki/ca.crt
CA 私钥文件:/usr/local/openvpn/easy-rsa/pki/issued/ca.key
Using Easy-RSA 'vars' configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
Using SSL: * openssl OpenSSL 3.2.2 4 Jun 2024 (Library: OpenSSL 3.2.2 4 Jun 2024) ...+.....+.........+...+.+..+.......+......+..+.......+...+...+.....+.......+..+.......+.....+.+........+.+...+.....+...+.........+.+...++++++ ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Common Name (eg: your user, host, or server name) [Easy-RSA CA]:caogo
Notice ------ CA creation complete. Your new CA certificate is at: * /usr/local/openvpn/easy-rsa/pki/ca.crt
Using Easy-RSA 'vars' configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
Using SSL: * openssl OpenSSL 3.2.2 4 Jun 2024 (Library: OpenSSL 3.2.2 4 Jun 2024) .........+...+.....+.............+..+...+.......+++++++++++++++++++++++++++++++++++++++*..+.+......+........+..........++++++ -----
Notice ------ Private-Key and Public-Certificate-Request files created. Your files are: * req: /usr/local/openvpn/easy-rsa/pki/reqs/caogo.req * key: /usr/local/openvpn/easy-rsa/pki/private/caogo.key
You are about to sign the following certificate: Request subject, to be signed as a server certificate for '825' days:
subject= commonName = caogo
Type the word 'yes' to continue, or any other input to abort. Confirm request details: yes
Using configuration from /usr/local/openvpn/easy-rsa/pki/openssl-easyrsa.cnf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'caogo' Certificate is to be certified until Apr 9 10:05:01 2027 GMT (825 days)
Write out database with 1 new entries Database updated
Notice ------ Certificate created at: * /usr/local/openvpn/easy-rsa/pki/issued/caogo.crt
Using Easy-RSA 'vars' configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
Using SSL: * openssl OpenSSL 3.2.2 4 Jun 2024 (Library: OpenSSL 3.2.2 4 Jun 2024) .+...................+++++++++++++++++++++++++++++++++++++++*.+......+......+......+.......+..+....+.....+....+..+...+.......+.........+..+...+.+.........+..+....+...+..+.+... ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Common Name (eg: your user, host, or server name) [x-client]:x
Notice ------ Private-Key and Public-Certificate-Request files created. Your files are: * req: /usr/local/openvpn/easy-rsa/pki/reqs/x-client.req * key: /usr/local/openvpn/easy-rsa/pki/private/x-client.key
Using Easy-RSA 'vars' configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
Using SSL: * openssl OpenSSL 3.2.2 4 Jun 2024 (Library: OpenSSL 3.2.2 4 Jun 2024) You are about to sign the following certificate: Please check over the details shown below for accuracy. Note that this request has not been cryptographically verified. Please be sure it came from a trusted source or that you have verified the request checksum with the sender. Request subject, to be signed as a client certificate for '825' days:
subject= commonName = x
Type the word 'yes' to continue, or any other input to abort. Confirm request details: yes
Using configuration from /usr/local/openvpn/easy-rsa/pki/openssl-easyrsa.cnf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'x' Certificate is to be certified until Apr 9 11:21:39 2027 GMT (825 days)
Write out database with 1 new entries Database updated
Notice ------ Certificate created at: * /usr/local/openvpn/easy-rsa/pki/issued/x-client.crt
Using Easy-RSA 'vars' configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
Using SSL: * openssl OpenSSL 3.2.2 4 Jun 2024 (Library: OpenSSL 3.2.2 4 Jun 2024) Generating DH parameters, 2048 bit long safe prime ..............................................................................................++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* DH parameters appear to be ok.
Notice ------
DH parameters of size 2048 created at: * /usr/local/openvpn/easy-rsa/pki/dh.pem
Using Easy-RSA 'vars' configuration: * /usr/local/openvpn/easy-rsa/vars
IMPORTANT: The preferred location for 'vars' is within the PKI folder. To silence this message move your 'vars' file to your PKI or declare your 'vars' file with option: --vars=<FILE>
Using SSL: * openssl OpenSSL 3.2.2 4 Jun 2024 (Library: OpenSSL 3.2.2 4 Jun 2024) Using configuration from /usr/local/openvpn/easy-rsa/pki/openssl-easyrsa.cnf
Notice ------ An updated CRL has been created: * /usr/local/openvpn/easy-rsa/pki/crl.pem