如今企业大一点都会分布不少办公点,为了更好的访问内部资源,***是一个很好的选择,今天分享一下在centos7 下安装open***的过程和一些踩的坑,有时间写个脚本,让安装今后简单。
centos7 open*** 安装
安装基础使用的工具
yum install ntpdate wget -y
同步时间:
ntpdate time.windows.com
配置iptables路由转发:
echo "net.ipv4.ip_forward = 1" >>/etc/sysctl.d/test.conf && sysctl -p
必定要先同步时间 在生产证书:
出现这个错误就是没有同步时间就开始生产证书致使的,删除证书,从新同步时间,生产证书,重启服务便可解决。
VERIFY ERROR: depth=1, error=self signed certificate in certificate chain:
配置epel源:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install open*** openssl openssl-devel -y
下载easy-rsa包:
wget https://github.com/Open×××/easy-rsa/releases/download/2.2.2/EasyRSA-2.2.2.tgz
tar -zxf EasyRSA-2.2.2.tgz
mv EasyRSA-2.2.2 easy-rsa
cp -r easy-rsa /etc/open***
cd /etc/open***/easy-rsa
修改vars:
[root@open*** easy-rsa]# cat vars |grep -v ^#|grep -v ^$
export EASY_RSA="pwd
"
export OPENSSL="openssl"
export PKCS11TOOL="pkcs11-tool"
export GREP="grep"
export KEY_CONFIG=$EASY_RSA/whichopensslcnf $EASY_RSA
export KEY_DIR="$EASY_RSA/keys"
echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
export PKCS11_MODULE_PATH="dummy"
export PKCS11_PIN="dummy"
export KEY_SIZE=2048
export CA_EXPIRE=3650
export KEY_EXPIRE=3650
export KEY_COUNTRY="CN"
export KEY_PROVINCE="SC"
export KEY_CITY="CHENGDU"
export KEY_ORG="CEIEC"
export KEY_EMAIL="ADMIN@ADMIN.COM"
export KEY_OU="MyOrganizationalUnit"
export KEY_NAME="EasyRSA"html
source ./vars
./clean-allgit
./build-cagithub
./build-key-server server
./build-dhwindows
./build-key clientcentos
修改配置文件
cp /usr/share/doc/open***-2.4.5/sample/sample-config-files/server.conf /etc/open***服务器
[root@open*** open***]# cat /etc/open***/server.conf |grep -v ^#|grep -v ^$|grep -v ^";"
port 1194
proto tcp
dev tun
ca /etc/open***/easy-rsa/keys/ca.crt
cert /etc/open***/easy-rsa/keys/server.crt
key /etc/open***/easy-rsa/keys/server.key # This file should be kept secret
dh /etc/open***/easy-rsa/keys/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.8.0.0 255.255.255.0"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
client-to-client
duplicate-cn
keepalive 10 120
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
status open***-status.log
log /var/log/open***/open***.log
log-append /var/log/open***/open***.log
verb 3app
建立日志目录:
mkdir /var/log/open***/
启动
systemctl start open***@server.servicetcp
开启路由转发:
因为centos7 没有iptables 命令,因此须要 yum install iptables-services -y 安装。
iptables -A INPUT -p TCP --dport 1194 -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j MASQUERADE
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPTide
客户端安装:
下载地址:http://build.open***.net/downloads/releases/ 全部安装文件都在这里能够找到工具
http://build.open***.net/downloads/releases/open***-2.2.2-install.exe ##咱们下载windows版本
将 C:\Program Files\Open×××\sample-config 下 client.o*** 文件拷贝到 C:\Program Files\Open×××\config 目录
将server端生成的 ca.crt client.crt client.key 文件拷贝到 C:\Program Files\Open×××\config
配置文件见附件
参考:
https://blog.51cto.com/noodle/1775744
https://chchc.me/2016/06/23/CentOS7-%E6%90%AD%E5%BB%BAOpen×××/
https://renwole.com/archives/471
https://my.oschina.net/liucao/blog/862930
常见问题:
现象 客户端隔几分钟就开始从新链接,日志以下
Fixing Open××× "Authenticate/Decrypt packet error: cipher final failed"
将服务端的cipher
cipher AES-256-CBC 配置到client端配置文件便可。
参看文件:
http://matthewcasperson.blogspot.com/2015/03/fixing-open***-authenticatedecrypt.html
必定要先同步时间 在生成证书:
出现这个错误就是没有同步时间就开始生成证书致使的,删除证书,从新同步时间,生成证书,重启服务便可解决。
VERIFY ERROR: depth=1, error=self signed certificate in certificate chain:
最后提醒一下,出了问题不要着急,必定是先看日志,一步一步拍错,都是很简单的。
附上成功的截图:
这个变成绿色,表示你的***客户端已经链接server端。***内网段已经通了。到此为止属于你的open***已经搭建好了。