本文共 4739 字,大约阅读时间需要 15 分钟。
yum install epel-release
lsb_release -ayum install -y openssl openssl-devel lzo lzo-devel pam pam-devel automake pkgconfig makecacheyum install -y open***yum install -y easy-rsa#启动open***的用户groupadd open***useradd -g open*** -M -s /sbin/nologin open***mkdir /etc/open***/
cp -R /usr/share/easy-rsa/ /etc/open***/cp /usr/share/doc/open***-2.4.4/sample/sample-config-files/server.conf /etc/open***/cp -r /usr/share/doc/easy-rsa-3.0.3/vars.example /etc/open***/easy-rsa/3.0/varsvim /etc/open***/server.conf(配置文件如下:)
port 1194
proto udpdev tunca /etc/open***/easy-rsa/3.0/pki/ca.crtcert /etc/open***/easy-rsa/3.0/pki/issued/wwwserver.crtkey /etc/open***/easy-rsa/3.0/pki/private/wwwserver.keydh /etc/open***/easy-rsa/3.0/pki/dh.pemtls-auth /etc/open***/ta.key 0server 10.8.0.0 255.255.255.0ifconfig-pool-persist ipp.txtpush "redirect-gateway def1 bypass-dhcp"push "dhcp-option DNS 223.5.5.5"push "dhcp-option DNS 114.114.114.114"keepalive 10 120cipher AES-256-CBCcomp-lzomax-clients 50user open***group open***persist-keypersist-tunstatus open***-status.loglog-append open***.logverb 3mute 20vim /etc/open***/easy-rsa/3.0/vars
修改第45、65、76、84-89、97、105、113、117、134、139、171、180、192行:set_var EASYRSA "$PWD"
set_var EASYRSA_PKI "$EASYRSA/pki"set_var EASYRSA_DN "cn_only"set_var EASYRSA_REQ_COUNTRY "CN"set_var EASYRSA_REQ_PROVINCE "BEIJING"set_var EASYRSA_REQ_CITY "BEIJING"set_var EASYRSA_REQ_ORG "Open××× CERTIFICATE AUTHORITY"set_var EASYRSA_REQ_EMAIL "110@qq.com"set_var EASYRSA_REQ_OU "Open××× EASY CA"set_var EASYRSA_KEY_SIZE 2048set_var EASYRSA_ALGO rsaset_var EASYRSA_CA_EXPIRE 7000set_var EASYRSA_CERT_EXPIRE 3650set_var EASYRSA_NS_SUPPORT "no"set_var EASYRSA_NS_COMMENT "Open××× CERTIFICATE AUTHORITY"set_var EASYRSA_EXT_DIR "$EASYRSA/x509-types"set_var EASYRSA_SSL_CONF "$EASYRSA/openssl-1.0.cnf"set_var EASYRSA_DIGEST "sha256"cd /etc/open***/easy-rsa/3.0
./easyrsa init-pki./easyrsa build-ca设置ca密码(输入两次):ca.com (创建CA、密码ca.com)./easyrsa gen-dh
open*** --genkey --secret ta.keycp -r ta.key /etc/open***/创建服务端证书,生成请求,使用gen-req来生成req
./easyrsa gen-req wwwserver
设置server密码(输入两次):openserver.com (创建服务端证书、密码openserver.com)签发证书,签约服务端证书./easyrsa sign-req server wwwserver(输入yes签发证书,输入ca密码:ca.com)生成windows客户端用户:
./easyrsa build-client-full www001#注意:生成客户端用户的时候会提示设置密码#可以直按回车密码为空、也可以设置输入密码(如设置密码,客户端连接时需输入密码)(生成客户端证书,并设置密码(客户端连接时用))查看客户端证书存放路径:ls -l /etc/open***/easy-rsa/3.0/pki/issued/www001.crt-rw-------. 1 root root 4517 Apr 16 00:30 /etc/open***/easy-rsa/3.0/pki/issued/www001.crtls -l /etc/open***/easy-rsa/3.0/pki/private/www001.key
-rw-------. 1 root root 1834 Apr 16 00:30 /etc/open***/easy-rsa/3.0/pki/private/www001.keyvim /etc/sysctl.conf
末尾加入
net.ipv4.ip_forward = 1保存后执行:sysctl -pFairwall(0.4.4)执行:
防火墙列表systemctl start firewalld.servicefirewall-cmd --statefirewall-cmd --zone=public --list-allfirewall-cmd --add-service=open*** --permanentfirewall-cmd --add-port=1194/udp --permanentfirewall-cmd --add-port=22/tcp --permanentfirewall-cmd --add-source=10.8.0.0 --permanentfirewall-cmd --query-source=10.8.0.0 --permanentfirewall-cmd --add-masquerade --permanentfirewall-cmd --query-masquerade --permanentfirewall-cmd --reload启动open***
systemctl start open***@server启动时输入服务端证书密码:openserver.com第一次启动的时候可能会提示,重新执行systemctl start open***@server输入密码即可
启动***,输入密码才能启动网络信息,至此open***服务器安装完成客户端open***版本为2.4.5(Open××× 2.4.5 x86_64)windows 64位官网下载就可以,也可以到网盘下载链接: 密码: 5dcp客户端需要的证书:www001.crt、www001.key、ca.crt、ta.key
存放到一个文件夹,然后将里边的文件夹拷贝到本地电脑
mkdir -p /etc/open***/clientcp -r /etc/open***/easy-rsa/3.0/pki/issued/www001.crt /etc/open***/client/cp -r /etc/open***/easy-rsa/3.0/pki/private/www001.key /etc/open***/client/cp -r /etc/open***/easy-rsa/3.0/pki/ca.crt /etc/open***/client/cp -r /etc/open***/ta.key /etc/open***/client/客户端配置文件www001.o***(ip换为open***服务器外网ip)
client
dev tunproto udpresolv-retry infinitenobindremote 47.175.155.184 1194 ns-cert-type servercomp-lzoca ca.crtcert www001.crtkey www001.keytls-auth ta.key 1keepalive 10 120persist-keypersist-tunverb 5redirect-gatewayroute-method exeroute-delay 2status www001-status.loglog-append www001.log安装Open××× 2.4.5 x86_64后,清空config文件夹,将www001.crt、www001.key、ca.crt、ta.key、www001.o***放入config中,完①如生成证书时输错密码了(如www002用户),报如下错误
(如新建用户www002时密码输错,导致生成客户端证书失败)(如新建用户www002时密码输错,导致生成客户端证书失败)删除以下文件即可
rm -rf /etc/open***/easy-rsa/3.0/pki/reqs/www002.reqrm -rf /etc/open***/easy-rsa/3.0/pki/private/www002.key②撤销证书(www001为例)
撤销命令revokecd /etc/open***/easy-rsa/3.0./easyrsa revoke www001生成CRL文件(撤销证书的列表)./easyrsa gen-crl(crl的路径)重启open***服务生效systemctl stop open***@serversystemctl start open***@server(以上为注销用户的过程)完!!转载于:https://blog.51cto.com/terry520/2104925