Centos6.3下利用open***部署远程×××服务
Centos6.3下利用open***部署远程×××服务
open***是一款在LINUX网关服务器使用的开源的×××软件,顾名思义,其实就是用来打通一条安全的虚拟专用通道,实现用户远程办公,获取内网资源。
该软件可跨平台在在Linux、xBSD、Mac OS X与Windows间使用,并利用openssl作为加密库,使用加密证书或用户名/密码来实现身份验证,是一款不可多得的开源×××解决方案。
我们做这个实验的目的就是模拟线上常见的公司外出人员在外需要访问公司内网OA,实现远程办公自动化。
解决方案:
系统环境:centos6.3 x64
OPEN×××: open***-2.3.0(附件有下载)
*** server: eth0:192.168.100.90,eth1:172.24.30.1
*** client: 192.168.100.34
intranet server: 172.24.30.10
# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
# iptables -A INPUT -p TCP --dport 1194 -j ACCEPT
# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
注:这里提一下,INPUT策略是执行后即时生效的,POSTROUTING需要保存并重启服务才能生效
注:若想让该服务器只提供open***等基本服务,可参照本文档附件iptables脚本
# yum install -y openssl openssl-devel lzo lzo-devel pam pam-devel automake pkgconfig
# wget -c http://swupdate.open***.org/community/releases/open***-2.3.0.tar.gz
# tar zxvf open***-2.3.0.tar.gz
# ./configure --prefix=/usr/local/open***
# cp /etc/open***/sample/sample-config-files/server.conf /etc/open***/
注:该包用来制作ca证书,服务端证书,客户端证书,open***2.3.0该版本源码不包含easy-rsa,所以需要单独下载安装用来配合open***实现证书生成。
# wget -c http://www.showerlee.com/down/easy-rsa-master.zip
# cp -rf easy-rsa /etc/open***
# cd /etc/open***/easy-rsa/easy-rsa/2.0
export KEY_EMAIL="user01@example.com"
# ln -s openssl-1.0.0.cnf openssl.cnf
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/open***/easy-rsa/easy-rsa/2.0/keys
注:也就是如果执行./clean-all,就会清空/etc/open***/easy-rsa/easy-rsa/2.0/keys下所有文件
注:下面这个命令在第一次安装时可以运行,以后在添加完客户端后慎用,因为这个命令会清除所有已经生成的证书密钥,和上面的提示对应
3.生成服务器端密钥证书, 后面这个open***.example.com就是服务器名,也可以自定义
# ./build-key-server open***.example.com
Generating a 2048 bit RSA private key
...................................................+++
..................................+++
writing new private key to 'open***.example.com.key'
You are about to be asked to enter information that will be
into your certificate request.
What you are about to enter is what is called a Distinguished Name or
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [CN]:
State or Province Name (full name) [SX]:
Locality Name (eg, city) [Xian]:
Organization Name (eg, company) [example]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname)
Email Address [user01@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:123456
An optional company name []:example
Using configuration from /etc/open***/easy-rsa/easy-rsa/2.0/openssl-1.0.0.cnf
Check that the request matches the signature
The Subject's Distinguished Name is as follows
stateOrProvinceName :PRINTABLE:'SX'
localityName :PRINTABLE:'Xian'
organizationName :PRINTABLE:'example'
commonName :PRINTABLE:'open***.example.com'
emailAddress :IA5STRING:'user01@example.com'
Certificate is to be certified until Jun 10 21:58:49 2023 GMT (3650 days)
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
4.生成所需客户端证书密钥文件(名字任意,建议写成你要发给的人的姓名,方便管理):
注:这里与生成服务端证书配置类似,中间一步提示输入服务端密码,其他按照缺省提示一路回车即可。
5.再生成diffie hellman参数,用于增强open***安全性(生成需要漫长等待)
# 设置创建tun的路由IP通道,还是创建tap的以太网通道
# Windows需要给网卡一个名称,这里设置,linux不需要
# 这里是重点,必须指定SSL/TLS root certificate (ca),
# certificate(cert), and private key (key)
# ca文件是服务端和客户端都必须使用的,但不需要ca.key
ca /etc/open***/easy-rsa/easy-rsa/2.0/keys/ca.crt
cert /etc/open***/easy-rsa/easy-rsa/2.0/keys/open***.example.com.crt
key /etc/open***/easy-rsa/easy-rsa/2.0/keys/open***.example.com.key
# This file should be kept secret
# 指定Diffie hellman parameters.
dh /etc/open***/easy-rsa/easy-rsa/2.0/keys/dh2048.pem
# 配置×××使用的网段,Open×××会自动提供基于该网段的DHCP
# 维持一个客户端和virtual IP的对应表,以方便客户端重新
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
;push "route 192.168.20.0 255.255.255.0"
push "route 172.24.30.0 255.255.255.0"
# 为特定的客户端指定IP或指定路由,该路由通常是客户端后面的
# ccd是/etc/open***下的目录,其中建有希望限制的客户端Common
# Name为文件名的文件,并通过下面的命令写入固定IP地址
# 例如Common Name为client1,则在/etc/open***/ccd/client1写有:
# ifconfig-push 10.9.0.1 10.9.0.2
;route 192.168.40.128 255.255.255.248
# 若客户端希望所有的流量都通过×××传输,则可以使用该语句
# 用Open×××的DHCP功能为客户端提供指定的DNS、WINS等
;push "dhcp-option DNS 10.8.0.1"
;push "dhcp-option WINS 10.8.0.1"
# 如果您希望有相同Common Name的客户端都可以登陆
# 也可以注释下面的语句,推荐每个客户端都使用不用的Common Name
# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
# open*** --genkey --secret ta.key
# The server and each client must have
# The second parameter should be 0
# on the server and 1 on the clients.
;tls-auth ta.key 0 # This file is secret
# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC # Blowfish (default)
;cipher DES-EDE3-CBC # Triple-DES
# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
status /var/log/open***/open***-status.log
log /var/log/open***/open***.log
log-append /var/log/open***/open***.log
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# Silence repeating messages. At most 20
# sequential messages of the same message
# category will be output to the log.
# /usr/local/open***/sbin/open*** --config /etc/open***/server.conf &
http://***tech.googlecode.com/files/open***-2.1.1-gui-1.0.3-install-cn-64bit.zip
2.将服务端打包文件解压,并将包内ca.crt、client1.crt、client1.key复制到客户端C:\Program Files\Open×××\config下.
3.在C:\Program Files\Open×××\config下创建client.o***文件
# Keep trying indefinitely to resolve the
# host name of the Open××× server. Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
# Most clients do not need to bind to
# a specific local port number.
# Try to preserve some state across restarts.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]
# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server". This is an
# important precaution to protect against
# a potential attack discussed here:
# http://open***.net/howto.html#mitm
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server". The build-key-server
# script in the easy-rsa folder will do this.
# If a tls-auth key is used on the server
# then every client must also have the key.
# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
在右下角的open***图标上右击,选择“Connect”,若能正常分配IP,则连接成功。
C:\Users\Administrator>ipconfig/all
---------------------------------------
描述. . . . . . . . . . . . . . . : TAP-Win32 Adapter V9
物理地址. . . . . . . . . . . . . : 00-FF-45-FB-F5-E2
DHCP 已启用 . . . . . . . . . . . : 是
自动配置已启用. . . . . . . . . . : 是
本地链接 IPv6 地址. . . . . . . . : fe80::848d:bd1d:c1f4:fb51%27(首选)
IPv4 地址 . . . . . . . . . . . . : 10.8.0.6(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.252
获得租约的时间 . . . . . . . . . : 2013年6月15日 22:36:59
租约过期的时间 . . . . . . . . . : 2014年6月15日 22:36:59
默认网关. . . . . . . . . . . . . :
DHCP 服务器 . . . . . . . . . . . : 10.8.0.5
DHCPv6 IAID . . . . . . . . . . . : 453050181
----------------------------------
在*** client上ping intranet server 主机IP:172.24.30.10
C:\Users\Administrator>ping 172.24.30.10
正在 Ping 172.24.30.10 具有 32 字节的数据:
来自 172.24.30.10 的回复: 字节=32 时间=2ms TTL=63
来自 172.24.30.10 的回复: 字节=32 时间<1ms TTL=63
来自 172.24.30.10 的回复: 字节=32 时间<1ms TTL=63
来自 172.24.30.10 的回复: 字节=32 时间<1ms TTL=63
# cd /etc/open***/easy-rsa/easy-rsa/2.0
如果报错,则注释掉该目录下openssl.cnf文件若干行内容,如下:
#dynamic_path = /usr/lib/engines/engine_pkcs11.so
#MODULE_PATH = $EVN::PKCS11_MODULE_PATH
若末行返回error23则账号注销成功,但需完全注销掉还需做如下配置:
末行添加如下内容保证每次在重启加载open***配置文件时都会重新加载crl.pem文件:
crl-verify /etc/open***/easy-rsa/easy-rsa/2.0/keys/crl.pem
注:crl.pem为注销的用户的黑名单,可以理解为每次启动open***时,加载一次黑名单操作,保证最新被吊销的证书无法使用。
# /usr/local/open***/sbin/open*** --config /etc/open***/server.conf &
# cd /etc/open***/easy-rsa/easy-rsa/2.0
搜索到两处默认有效期天数"3650",修改该为你需要设置的天数保存即可
open***作为内网server提供远程×××服务解决方案:
# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
push "route 192.168.100.0 255.255.255.0"
最后在客户端配置文件(C:\Program Files\Open×××\config\client.o***)里添加如下内容:
这行客户端会随机连接这2台服务器地址,从而利用其作为代理访问网内其他资源。
本文出自 “一路向北” 博客,请务必保留此出处http://showerlee.blog.51cto.com/2047005/1222738
转载于:https://blog.51cto.com/ljl2013/1359383
Centos6.3下利用open***部署远程×××服务相关推荐
- CentOS下利用Docker部署Surging
CentOS下利用Docker部署Surging 原文:CentOS下利用Docker部署Surging 1. 安装Centos, 配置固定ip 配置文件地址vi /etc/sysconfig/net ...
- 解决CentOS6.5下MySQL5.6无法远程连接的问题
解决CentOS6.5下MySQL5.6无法远程连接的问题 参考文章: (1)解决CentOS6.5下MySQL5.6无法远程连接的问题 (2)https://www.cnblogs.com/yang ...
- Centos6.3下利用rsyslog+loganalyzer+mysql部署日志服务器
作为一名系统运维工程师,平时查看分析LINUX系统日志我觉得是我们每天必做的功课,但时间长了会发现每次查看站点日志都得挨个进后台,几台服务器还可以这么对付,但如果管理成百上千台线上服务器,这种方法就捉 ...
- 信呼OA在centos7.4下利用LibreOffice部署Office文档本地PDF转换服务
安装Libreoffice # yum install -y libreoffice 编辑 /include/chajian/xinhuapiChajian.php 298行 ,注释掉 #if( ...
- Centos6.3下apache+svn部署web版本同步
前段时间一直忙项目,所以项目初期的svn服务就一直没来得及更新,今天刚好忙完就将自己之前的配置重新总结了下,供大家参考. svn(subversion)作为一款开源的代码版本管理软件,目前普遍用在项目 ...
- CENTOS6.3下zabbix安装部署
----------------闲扯---------------- RHCE过的EMAIL已经下来,所以最近闲了就准备把先前的文档更新下. 我更新的内容主要是把自己当时的理解加到配置里,告诉大家我当 ...
- 局域网下利用VNC进行远程操控
2021.04.16更新:文件传输问题,用ssh传输文件了,参考链接: ssh传输文件 1.使用条件:同局域网下,无所谓能否上网,将服务端(被远程操控的机器)和客户端(操作人使用的电脑)连在同一wif ...
- Centos6.3下利用changepassword修改samba账户密码
最近一直在潜心研究linux shell,所以好久没有更新了.今天也是在QQ有人和我聊到samba密码ldap集中验证时,想到一个问题,内网使用samba服务器来存储用户数据,所有的用户不能登陆LIN ...
- centos6.5下的elk部署
1.介绍 elk是实时日志分析平台,主要是为开发和运维人员提供实时的日志分析,方便人员更好的了解系统状态和代码问题. 2.elk中的e(elasticsearch): (2.1)先安装依赖包,官方文档 ...
最新文章
- Android 水波纹点击效果(Ripple Effect)
- flink配置+停止flink中的job
- 与殿堂级大师隔空对话——一张纸是怎么限制了我们的想象力
- 搭建基于.NetFrameWork的私有nuget服务端及打包项目发布上传
- ar路由器 pppoe下发ipv6 dns_IPv6网络设置各种疑难杂症诊疗区
- spring boot 日志乱码_3. Spring Boot日志
- 矩阵分析及应用(1-2章)
- 屏蔽广告(广告终结者)-- CSDN 第一步
- 惊艳的成长计划表刷屏!武大首位 94 年博士入职华为,年薪达 201 万
- 2019校招秋招总结
- eNews 第二十七期/2007.08
- 建立一个网站的具体过程
- lisp不是函授型语言_讨论:为什么Lisp语言不再被广泛使用
- 超短线炒黄金技巧你掌握到位了吗
- 传统推荐算法Facebook的GBDT+LR模型深入理解
- 很实用的应用,推荐一下http://static.apk.hiapk.com/html/2012/06/625213.html?module=256info=MQA2ADMA
- 高效阅读嵌入式源码系列一:静态分析神器understand软件基本操作
- 嵌入式系统之新建工程模版
- JVM--基础--09--内存分配策略--对象优先在Eden分配
- 如何将知网下载的caj文件转换为pdf文件
热门文章
- vmware无法打开ubuntu解决办法
- 2018年计算机职称考试冲刺,2018年中级会计职称考试考前30天冲刺计划和学习方法...
- maven java 配置文件路径_Maven 的配置文件路径读取
- PHP的优点和缺点分别是什么,CSS的优点和缺点分别是什么
- webp的js插件_让浏览器全面兼容WebP图片格式
- rollback 最后判断成功_面试自我介绍随便说说就行?注意3忌2套路帮你提升50%成功率...
- 零基础入门学习Python,我与python的第一次亲密接触后的感受!
- html大作业_杜绝家长作业 关键是如何监督
- 【MySQL】MySQL表的增删改查(进阶-下)
- 欧拉筛 筛法求素数 及其例题 时间复杂度O(n)