下载证书生成工具
wget https://github.com/OpenVPN/easy-rsa/releases/download/3.0.1/EasyRSA-3.0.1.tgz
解压
tar xf EasyRSA-3.0.1.tgz
生成证书
cd EasyRSA-3.0.1/
# 初始化证书目录pki
./easyrsa init-pki
# 创建根证书,提示输入Common Name,名称随意,但是不能和服务端证书或客户端证书名称相同
./easyrsa build-ca nopass
# 生成Diffle Human参数,它能保证密钥在网络中安全传输
./easyrsa gen-dh
#制作服务端OpenVPN Server证书
./easyrsa build-server-full server nopass
#制作客户端证书(用户多就要多制作几个)
./easyrsa build-client-full client1 nopass
./easyrsa build-client-full client2 nopass
./easyrsa build-client-full client3 nopass
将证书拷贝到openvpn目录
cp /root/EasyRSA-3.0.1/pki/ca.crt /etc/openvpn/ca.crt
cp /root/EasyRSA-3.0.1/pki/dh.pem /etc/openvpn/dh1024.pem
cp /root/EasyRSA-3.0.1/pki/private/client1.key /etc/openvpn/
cp /root/EasyRSA-3.0.1/pki/private/client2.key /etc/openvpn/
cp /root/EasyRSA-3.0.1/pki/private/client3.key /etc/openvpn/
cp /root/EasyRSA-3.0.1/pki/private/server.key /etc/openvpn/
cp /root/EasyRSA-3.0.1/pki/issued/* /etc/openvpn/
重启openvpn
/etc/init.d/openvpn restart