Enter New CA Key Passphrase: Re-Enter New CA Key Passphrase: Generating RSA privatekey, 2048 bit long modulus (2 primes) ......+++++ ...................................................................+++++ e is65537 (0x010001) 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]:commonname
CA creation complete and you may now import and sign cert requests. Your new CA certificate file for publishing is at: /etc/openvpn/pki/ca.crt
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020 Generating DH parameters, 2048 bit long safe prime, generator 2 This is going totake a long time .............................................................................................................................................................................................................++......................................................................................................................+...............................................................+.....................................+........+...........................+............................................................+............................................................................................................................................................+..........................................................................................................................+.........................................................................+.............................................................................................................................................+..........................................................................................+...............................................................................+........................+........+.........................................................................................................................................................................................................................................................................................................+.....................................................+.........................................................................................................................+.................................+.................+.............................++............................................................+............................................................++*++*++*++*
DH parameters of size 2048 created at /etc/openvpn/pki/dh.pem
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020 Generating a RSA privatekey .................................................................................................................................+++++ ................................................+++++ writing newprivatekeyto'/etc/openvpn/pki/easy-rsa-72.KCfPPP/tmp.hAdfHa' ----- Using configuration from /etc/openvpn/pki/easy-rsa-72.KCfPPP/tmp.eOOLeG Enter pass phrase for /etc/openvpn/pki/private/ca.key: Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.112:'89.208.247.206' Certificate isto be certified until Jan 1711:41:242026 GMT (825 days)
Write out database with1new entries Data Base Updated
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020 Using configuration from /etc/openvpn/pki/easy-rsa-147.CkJkEd/tmp.lepPeH Enter pass phrase for /etc/openvpn/pki/private/ca.key:
An updated CRL has been created. CRL file: /etc/openvpn/pki/crl.pem
三、生成客户端证书
1 2 3 4 5
exportCLIENTNAME="your_client_name" # 它的作用是将一个名为 CLIENTNAME 的环境变量设置为值 "your_client_name" # with a passphrase (recommended) 下面是设置密码的命令 docker-compose run --rm openvpn easyrsa build-client-full $CLIENTNAME # without a passphrase (not recommended) 下面是不设置设置密码的命令 docker-compose run --rm openvpn easyrsa build-client-full $CLIENTNAME nopass
注:这里生成的密码在这里使用 👇
四、使用嵌入式证书检索客户端配置
1 2 3
docker-compose run --rm openvpn ovpn_getclient $CLIENTNAME > $CLIENTNAME.ovpn
Checking IPv6 Forwarding Sysctl error for disable_ipv6, please run docker with '--sysctl net.ipv6.conf.all.disable_ipv6=0' Sysctl error for default forwarding, please run docker with '--sysctl net.ipv6.conf.default.forwarding=1' Sysctl error for all forwarding, please run docker with '--sysctl net.ipv6.conf.all.forwarding=1' Running 'openvpn --config /etc/openvpn/openvpn.conf --client-config-dir /etc/openvpn/ccd --crl-verify /etc/openvpn/crl.pem ' Sun Oct 15 11:42:43 2023 OpenVPN 2.4.9 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Apr 20 2020 Sun Oct 15 11:42:43 2023 library versions: OpenSSL 1.1.1g 21 Apr 2020, LZO 2.10 Sun Oct 15 11:42:43 2023 Diffie-Hellman initialized with 2048 bit key Sun Oct 15 11:42:43 2023 CRL: loaded 1 CRLs from file /etc/openvpn/crl.pem Sun Oct 15 11:42:43 2023 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication Sun Oct 15 11:42:43 2023 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication Sun Oct 15 11:42:43 2023 ROUTE_GATEWAY 172.20.0.1/255.255.0.0 IFACE=eth0 HWADDR=02:42:ac:14:00:02 Sun Oct 15 11:42:43 2023 TUN/TAP device tun0 opened Sun Oct 15 11:42:43 2023 TUN/TAP TX queue length set to 100 Sun Oct 15 11:42:43 2023 /sbin/ip link set dev tun0 up mtu 1500 Sun Oct 15 11:42:43 2023 /sbin/ip addr add dev tun0 local 192.168.255.1 peer 192.168.255.2 Sun Oct 15 11:42:43 2023 /sbin/ip route add 192.168.254.0/24 via 192.168.255.2 Sun Oct 15 11:42:43 2023 /sbin/ip route add 192.168.255.0/24 via 192.168.255.2 Sun Oct 15 11:42:43 2023 Could not determine IPv4/IPv6 protocol. Using AF_INET Sun Oct 15 11:42:43 2023 Socket Buffers: R=[212992->212992] S=[212992->212992] Sun Oct 15 11:42:43 2023 UDPv4 link local (bound): [AF_INET][undef]:1194 Sun Oct 15 11:42:43 2023 UDPv4 link remote: [AF_UNSPEC] Sun Oct 15 11:42:43 2023 GID set to nogroup Sun Oct 15 11:42:43 2023 UID set to nobody Sun Oct 15 11:42:43 2023 MULTI: multi_init called, r=256 v=256 Sun Oct 15 11:42:43 2023 IFCONFIG POOL: base=192.168.255.4 size=62, ipv6=0 Sun Oct 15 11:42:43 2023 Initialization Sequence Completed
root@host:/opt/1panel/docker/compose/openvpn# export CLIENTNAME="win11ppp_DC9" root@host:/opt/1panel/docker/compose/openvpn# docker-compose run --rm openvpn easyrsa build-client-full $CLIENTNAME UsingSSL: openssl OpenSSL1.1.1g 21Apr2020 Generating a RSAprivate key .....+++++ ..............................+++++ writing new private key to '/etc/openvpn/pki/easy-rsa-1.HDPfFg/tmp.FOpKfD' EnterPEM pass phrase: Verifying-EnterPEM pass phrase: ----- Using configuration from /etc/openvpn/pki/easy-rsa-1.HDPfFg/tmp.fcglbn Enter pass phrase for/etc/openvpn/pki/private/ca.key: Check that the request matches the signature Signature ok TheSubject's DistinguishedNameisas follows commonName :ASN.112:'win11ppp_DC9' Certificateis to be certified until Jan1711:53:062026GMT (825 days)
Write out database with 1 new entries DataBaseUpdated