阿里云+OpenWRT+OPEN***搭建远程运维平台

Open***组网步骤
一、基于ubuntu 16.04的open***的搭建
(1)服务端防火墙配置
打开1194端口
(2)easy-rsa安装
sudo apt-get -y install easy-rsa
(3)Open***的安装与配置
sudo apt-get -y install open*** libssl-dev openssl
详见云服务器 /etc/openvpcn/server.conf(建议与原版的server.conf 对比查看即可,原版有备份在同级目录下)
(4)证书的制作与注销
制作
1.sudo mkdir /etc/open***/easy-rsa/

2.复制 提供的 keys 包 到目录 /etc/open***/easy-rsa/

3.source vars

4.执行vars.txt 内部的指令

5.在 /etc/open***/easy-rsa/ 下执行 ./build-key user1(用户名)
(一路回车 最后2个选项按y,表示授权)

6.在keys下面会生成 user1.crt user1.key

7.将这2个证书放在客户端配置后,可以查看服务器的日志确定 这个用户有没有上线
cat /etc/open***/open***.log

SENT CONTROL [user1]: 'PUSH_REPLY,route 10.8.0.0 255.255.255.0,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5' (status=1)

吊销
1.cd /etc/open***/easy-rsa/

2.source vars

3.执行vars.txt 内部的指令

4../revoke-full nnn(客户端证书名字)

5.在服务端的配置文件 server.conf 中,加入这样一行:
crl-verify /etc/open***/easy-rsa/keys/crl.pem

6./etc/init.d/open*** restart

包含以下内容的分类制作过程:
1、一证多用(网关设备),一证一用(运维人员);
网关设备用 ***csy ,因为人员自行参考上述证书制作

2、根据用户需求可制作动态IP地址和固定IP地址的网关设备;
默认都是动态ip

静态ip设置方法
server.conf 加上配置
client-config-dir /etc/open***/ccd

进入/etc/open***/ccd 目录,然后编辑证书名字同名的文件

然后加入一段 ifconfig-push 10.8.0.13 10.8.0.14
重启***服务器

3、对于运维人员的一证一用,随时制作,随时注销;
参考上述证书制作 吊销
二、基于Openwrt的编译固件的制作
(1)编译固件步骤
1.打开 network->***->open***-openssl
2.打开 luci->applicatio->luci-app-open***
3.修改files/open***文件

config open*** 'custom_config'
option config '/etc/open***/my-***.conf'
option dev 'tun'
option nobind '1'
option client '1'
option port '1194'
option remote 'server_ip'
option proto 'tcp'
option keepalive '10 120'
option compress 'lzo'
option status '/tmp/open***-status.log'
option persist_key '1'
option persist_tun '1'
option verb '3'
option user 'nobody'
option group 'nogroup'
option ca '/lib/uci/upload/cbid.open***.custom_config.ca'
option dh '/lib/uci/upload/cbid.open***.custom_config.dh'
option cert '/lib/uci/upload/cbid.open***.custom_config.cert'
option key '/lib/uci/upload/cbid.open***.custom_config.key'

config open*** 'sample_server'
option port '1194'
option dev 'tun'
option remote 'server_ip'
option keepalive '10 120'
option compress 'lzo'
option persist_key '1'
option persist_tun '1'
option user 'nobody'
option group 'nogroup'
option status '/tmp/open***-status.log'
option verb '3'
option proto 'tcp'
option client '1'
option dev_type 'tun'
option ca '/lib/uci/upload/cbid.open***.sample_server.ca'
option dh '/lib/uci/upload/cbid.open***.sample_server.dh'
option enabled '1'
option cert '/lib/uci/upload/cbid.open***.sample_server.cert'
option key '/lib/uci/upload/cbid.open***.sample_server.key'

4.修改makefile文件添加内容:

$(INSTALL_DATA) \
    files/open***.options \
    $(1)/usr/share/open***/open***.options
mkdir -p $(1)/lib/uci/upload
$(INSTALL_DATA) \
    files/cert/ca.crt \
    $(1)/lib/uci/upload/cbid.open***.sample_server.ca
$(INSTALL_DATA) \
    files/cert/dh2048.pem \
    $(1)/lib/uci/upload/cbid.open***.sample_server.dh
$(INSTALL_DATA) \
    files/cert/***csy.crt \
    $(1)/lib/uci/upload/cbid.open***.sample_server.cert
$(INSTALL_DATA) \
    files/cert/***csy.key \
    $(1)/lib/uci/upload/cbid.open***.sample_server.key

$(INSTALL_CONF) files/open***.config \
    $(1)/etc/config/open***

(2)内网映射及防火墙配置
在web端添加
iptables -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 8888 -j DNAT --to-destination 192.168.1.41:8000

删除
iptables -t nat -D PREROUTING -i tun0 -p tcp -m tcp --dport 8888 -j DNAT --to-destination 192.168.1.41:8000

三、windows客户端的联网
将证书复制到指定位置 修改o***文件即可
 
四、openwrt的客户端联网
1、动态Ip的设备联网
使用 ***csy证书 获得的是动态ip
2、固定Ip地址的设备联网
参考 静态ip设置方法

猜你喜欢

转载自blog.51cto.com/13300270/2607700