环境
centos7.9
安装
yum install -y open-vm-tools openvpn-as-bundled-clients-17.rpm
yum install -y openvpn-as-2.9.2_04614689-CentOS7.x86_64.rpm
yum install -y lrzsz
查看登录信息
cat /usr/local/openvpn_as/init.log
# Login as "openvpn" with the same password used to authenticate
# to this UNIX host.
#
# During normal operation, OpenVPN AS can be accessed via these URLs:
# Admin UI: https://192.168.3.184:943/admin
# Client UI: https://192.168.3.184:943/
设置管理员密码
passwd openvpn
破解用户限制
cd /usr/local/openvpn_as/lib/Python/ target=_blank class=infotextkey>Python
cp pyovpn-2.0-py3.6.egg /root/
cd /root && unzip pyovpn-2.0-py3.6.egg
cd pyovpn/lic/ && mv uprop.pyc uprop2.pyc
vi uprop.py
# 说明
# concurrent_connections 为连接数
from pyovpn.lic import uprop2
old_figure = None
def new_figure(self, licdict):
ret = old_figure(self, licdict)
ret['concurrent_connections'] = 1024
return ret
for x in dir(uprop2):
if x[:2] == '__':
continue
if x == 'UsageProperties':
exec('old_figure = uprop2.UsageProperties.figure')
exec('uprop2.UsageProperties.figure = new_figure')
exec('%s = uprop2.%s' % (x, x))
编译pyc文件
# 编译
python3 -O -m compileall uprop.py
#注意 uprop.cpython-37.opt-1.pyc 文件名会随着 python 版本变化而变化
mv __pycache__/uprop.cpython-37.opt-1.pyc uprop.pyc
替换文件
# 将破解文件和源文件拷贝到桌面
sz uprop2.pyc
sz uprop.pyc
# 源文件(注意文件名可能不同)
sz pyovpn-2.0-pyx.x.egg
# 使用压缩软件打开pyovpn-2.0-pyx.egg
# 将uprop2.pyc、uprop.pyc复制替换/pyovpn/lic/目录下
# 将文件上传至服务器并替换(注意文件名可能不同)
rz
cp pyovpn-2.0-pyx.x.egg /usr/local/openvpn_as/lib/python
# 重启服务器
reboot
登录查看授权用户
使用方法: 创建用户, 用户访问openvpn服务网页, 登录, 下载客户端和配置文件