概述
这里我的环境是在linux服务器上面配置服务器端,然后在把windows当作client来连linux服务器
一,下载所需的软件:
1,安装所需的编译工具:
#apt-get install gcc g++ make pkg-config libpam0g-dev sasl2-bin
1,安装所需的编译工具:
#apt-get install gcc g++ make pkg-config libpam0g-dev sasl2-bin
2,下载lzo库[http://www.oberhumer.com/opensource/lzo/ ]:
#mkdir /usr/local/src/open***
#cd /usr/local/src/open***
#wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.03.tar.gz
#mkdir /usr/local/src/open***
#cd /usr/local/src/open***
#wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.03.tar.gz
说明:lzo是一个实用的无损压缩工具。[可选]
3,下载openssl[http://www.openssl.org/ ]:
#wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
#wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
说明:Open×××依赖OpenSSL库,用于加密,需要安装。
4,下载open***[http://www.open***.net/ ]:
#wget http://www.open***.net/release/open***-2.0.9.tar.gz
#wget http://www.open***.net/release/open***-2.0.9.tar.gz
最新的rc版
#wget http://www.open***.net/release/open***-2.1_rc19.tar.gz
#wget http://www.open***.net/release/open***-2.1_rc19.tar.gz
二,安装Open×××及相关软件:
1,安装lzo:
#tar -zxvf lzo-2.03.tar.gz
#cd lzo-2.03
#./configure –prefix=/usr/local/lzo
#make
#make install
1,安装lzo:
#tar -zxvf lzo-2.03.tar.gz
#cd lzo-2.03
#./configure –prefix=/usr/local/lzo
#make
#make install
在/etc/ld.so.conf中加入以下内容:
/lib
/usr/lib
/usr/local/lib
/usr/local/lzo/lib
/lib
/usr/lib
/usr/local/lib
/usr/local/lzo/lib
/etc/ld.so.conf的结果:
#vi /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/lib
/usr/lib
/usr/local/lib
/usr/local/lzo/lib
#vi /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/lib
/usr/lib
/usr/local/lib
/usr/local/lzo/lib
使用/etc/ld.so.conf中的内容生效,即动态连接库生效:
#ldconfig
#ldconfig
2,安装openssl:
#cd ..
#tar -zxvf openssl-0.9.8k.tar.gz
#cd openssl-0.9.8k
#./config –prefix=/usr/local/openssl
#make
#make install
3,安装open***:
#cd ..
#tar -zxvf open***-2.0.9.tar.gz
#cd open***-2.0.9
#./configure –prefix=/usr/local/open*** –with-lzo-headers=/usr/local/lzo/include –with-lzo-lib=/usr/local/lzo/lib –with-ssl-headers=/usr/local/openssl/include –with-ssl-lib=/usr/local/openssl/lib
#cd ..
#tar -zxvf openssl-0.9.8k.tar.gz
#cd openssl-0.9.8k
#./config –prefix=/usr/local/openssl
#make
#make install
3,安装open***:
#cd ..
#tar -zxvf open***-2.0.9.tar.gz
#cd open***-2.0.9
#./configure –prefix=/usr/local/open*** –with-lzo-headers=/usr/local/lzo/include –with-lzo-lib=/usr/local/lzo/lib –with-ssl-headers=/usr/local/openssl/include –with-ssl-lib=/usr/local/openssl/lib
#make
#make install
#make install
我安装的时候是使用的debian已经完全安装了所有的软件包,以上的安装步骤转自http://www.wearelinuxer.com/?p=215。以上安装的路径和我自己的可能不尽相同,但是仅仅路径不同而已,安装过程完全相同。以下是安装步骤,可供参考:
创建配置环境
#mkdir -p /etc/open***
#cp -R /usr/share/doc/open***/open***-2.0.9/easy-rsa /etc/open***/
#cd /etc/open***/easy-rsa/2.0/vars
#ls
vars 脚本,是用来创建环境变量,设置所需要的变量的脚本
clean-all 脚本,是创建生成ca证书及密钥文件所需要的文件及目录
build-ca 脚本,生成ca证书(交互)
build-dh 脚本,生成Diff-Hellman文件(交互)
build-key-server 脚本,生成服务器端密钥(交互)
build-key 脚本,生成客户端密钥(交互)
pkitool 脚本,直接使用vars的环境变量设置,直接生成证书(非交互)
修改vars文件内容如下:
export KEY_COUNTRY=”CN”
export KEY_PROVINCE=”FuJian”
export KEY_CITY=”PuTian”
export KEY_ORG=”ITCHT”
export KEY_EMAIL=“ly-mr.g@hotmail.com”
#mkdir -p /etc/open***
#cp -R /usr/share/doc/open***/open***-2.0.9/easy-rsa /etc/open***/
#cd /etc/open***/easy-rsa/2.0/vars
#ls
vars 脚本,是用来创建环境变量,设置所需要的变量的脚本
clean-all 脚本,是创建生成ca证书及密钥文件所需要的文件及目录
build-ca 脚本,生成ca证书(交互)
build-dh 脚本,生成Diff-Hellman文件(交互)
build-key-server 脚本,生成服务器端密钥(交互)
build-key 脚本,生成客户端密钥(交互)
pkitool 脚本,直接使用vars的环境变量设置,直接生成证书(非交互)
修改vars文件内容如下:
export KEY_COUNTRY=”CN”
export KEY_PROVINCE=”FuJian”
export KEY_CITY=”PuTian”
export KEY_ORG=”ITCHT”
export KEY_EMAIL=“ly-mr.g@hotmail.com”
#source ./vars
生成并初始keys文件夹
#./clean-all
#source ./vars
生成root ca证书,用于签发server和client证书
#./build-ca
#ls keys 查看生成的ca.crt ca.key文件
生成并初始keys文件夹
#./clean-all
#source ./vars
生成root ca证书,用于签发server和client证书
#./build-ca
#ls keys 查看生成的ca.crt ca.key文件
clean-all vars build-ca是用来初期化PKI的
生成diffie-hellman文件
#./build-dh
#ls-l keys/dh1024.pem 查看生成的DH文件
生成服务器使用的××× server证书和私钥
#./build-key-server topsec-server
#./build-dh
#ls-l keys/dh1024.pem 查看生成的DH文件
生成服务器使用的××× server证书和私钥
#./build-key-server topsec-server
//CA证书的名字是topsec-server,生成的证书为topsec-server.crt topsec-server.key
#cd keys
#cp ca.crt ca.key topsec-server.crt topsec-server.key dh1024.pem /etc/open***
生成客户端的CA及密钥
#./build-key topsec-user1
将在keys目录下生成topsec-user1.crt topsec-user1.csr topsec-user1.key三个客户端证书
#cd keys
#cp ca.crt ca.key topsec-server.crt topsec-server.key dh1024.pem /etc/open***
生成客户端的CA及密钥
#./build-key topsec-user1
将在keys目录下生成topsec-user1.crt topsec-user1.csr topsec-user1.key三个客户端证书
ca.crt topsec-user1.crt topsec-user1.key client.conf是给客户端使用的
ca.crt ca.key dh1024.pem topsec-server.crt topsec-server.key是给服务器使用的
ca.crt ca.key dh1024.pem topsec-server.crt topsec-server.key是给服务器使用的
撤销证书的操作
#./etc/open***/easy-rsa/2.0/vars
#./etc/open***/easy-rsa/2.0/revoke-full topsec-user1
#./etc/open***/easy-rsa/2.0/revoke-full topsec-user1
修改配置文件,可以参考模板也可以自己手动建立
cd /usr/share/doc/open***/examples/sample-config-files
gunzip -d server.conf.gz
cp server.conf /etc/open***/open***.conf 服务器的配置文件
gunzip -d server.conf.gz
cp server.conf /etc/open***/open***.conf 服务器的配置文件
在这里我选择手动建立服务器的配置文件
#mkdir -p /etc/open***/logs
#vi /etc/open***/open***.conf
配置文件的内容如下:
port 1194
proto tcp
dev tun
ca /etc/open***/ca.crt
cert /etc/open***/topsec-server.crt
key /etc/open***/topsec-server.key
dh /etc/open***/dh1024.pem
server 20.20.20.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 20.20.20.0 255.255.255.0"
client-config-dir /etc/open***/ccd
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /etc/open***/logs/open***-status.log
log /etc/open***/logs/open***.log
log-append /etc/open***/logs/open***.log
verb 5
以上具体字段的含义参考我博客里面的配置文件解析
proto tcp
dev tun
ca /etc/open***/ca.crt
cert /etc/open***/topsec-server.crt
key /etc/open***/topsec-server.key
dh /etc/open***/dh1024.pem
server 20.20.20.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 20.20.20.0 255.255.255.0"
client-config-dir /etc/open***/ccd
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /etc/open***/logs/open***-status.log
log /etc/open***/logs/open***.log
log-append /etc/open***/logs/open***.log
verb 5
以上具体字段的含义参考我博客里面的配置文件解析
启动之前要先关闭防火墙对ssh(22)和open***(1194)的拦截
echo 1 >/pro/sys/net/ipv4/ip_forward
启动 /etc/init.d/open*** start
如果启动失败则加载虚拟网卡模块
#mkdir -p /dev/net
#mknod /dev/net/tun c 10 200
#ls -l /dev/net/tun
crw-r-r- 1 root root 10,200
#mknod /dev/net/tun c 10 200
#ls -l /dev/net/tun
crw-r-r- 1 root root 10,200
下面是客户端的配置相对来说比较简单:
在open***.net网站上面下载对应linux版本的客户端,一定要下载匹配的客户端,然后一路默认安装,之后把刚才在服务器上面生成的客户端的证书文件放在c:\program filesopen***config目录下面,之后复制C:Program FilesOpen×××sample-config里面客户端的配置文件client.o***到c:\program filesopen***config。名字可以随便起只要后缀不变就好了。之后对配置文件进行修改,也可以自己新建配置文件然后改下后缀就可以了。
客户端配置文件的内容如下:
client
proto tcp
dev tun
remote 192.168.10.110 1194
ca ca.crt
cert topsec-client-001.crt
key topsec-client-001.key
resolv-retry infinite
nobind
persist-key
persist-tun
ns-cert-type server
comp-lzo
verb 5
proto tcp
dev tun
remote 192.168.10.110 1194
ca ca.crt
cert topsec-client-001.crt
key topsec-client-001.key
resolv-retry infinite
nobind
persist-key
persist-tun
ns-cert-type server
comp-lzo
verb 5
之后保存然后右击客户端选择start open*** on this config file这样就好了
提示:先保证两边的配置文件都是正确的还有关闭防火墙这样就肯定OK了!
转载于:https://blog.51cto.com/lymrg/368513
最后
以上就是忧心豆芽为你收集整理的在debian下面安装open***(使用linux做服务器)的全部内容,希望文章能够帮你解决在debian下面安装open***(使用linux做服务器)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复