翻墙教程 · 2019年3月14日

ShadowSocksR的流量控制系统

网上太多SSR的安装方法,诸如秋水等一键脚本,亦或是魔改XXX,偶然发现一个SSR的控制面板,里面好像还有openvpn的控制,具体大家自己研究一下,东西我分享出来

Demo

附一个我搭建好了的测试地址(可能会失效):

环境:Centos7.0 PHP+apache

前后台都是从一个登陆入口进的

后台账号 admin 密码 123456

部分截图

网站安装方法

Github:https://github.com/Lsido/OsR-OpenVpn_ShadowsocksR

Web包下载地址:http://blog2222.oss-cn-shenzhen.aliyuncs.com/2017/06/webInstall.zip
(非稳定2017-11-14日更新下载地址)

上传到空间或者服务器环境,导入数据库文件htmlos.sql
修改api/PDO.class.php数据库配置信息

ShadowsocksR配置安装方法

关闭Selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
安装依赖
yum install python-setuptools -y 
yum install git -y 
easy_install pip 
yum -y groupinstall "Development Tools" 
yum -y install python-devel 
yum -y install libffi-devel 
yum -y install openssl-devel 
pip install cymysql
yum install supervisor python-pip -y 
pip install supervisor==3.1
chkconfig supervisord on
yum install -y openssl openssl-devel lzo lzo-devel pam pam-devel automake pkgconfig zlib glibc.i686
yum install -y libstdc++.i686 glibc.i686 zlib.i686 --setopt=protected_multilib=false 
安装 libsodium
cd /root/
wget https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz
tar xf libsodium-1.0.10.tar.gz && cd libsodium-1.0.10
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
安装 ssr
cd /root/
git clone -b manyuser https://git.coding.net/mlhtml/ss.git
cd /root/ss/
cp apiconfig.py userapiconfig.py
cp config.json user-config.json
sed -i "s/MYSQL_HOST = '127.0.0.1'/MYSQL_HOST = '这里填你的数据库地址'/g" /root/ss/userapiconfig.py
sed -i "s/MYSQL_USER = 'ss'/MYSQL_USER = '这里填你的数据库用户名'/g" /root/ss/userapiconfig.py
sed -i "s/MYSQL_PORT = 3306/MYSQL_PORT = "这里填你的数据库端口"/g" /root/ss/userapiconfig.py
sed -i "s/MYSQL_PASS = 'ss'/MYSQL_PASS = '这里填你的数据库密码'/g" /root/ss/userapiconfig.py
sed -i "s/MYSQL_DB = 'shadowsocks'/MYSQL_DB = '这里填你的数据库名'/g" /root/ss/userapiconfig.py
sed -i "s/modwebapi/glzjinmod/g" /root/ss/userapiconfig.py
wget -O /etc/supervisord.conf http://mlhtml.oss-cn-shenzhen.aliyuncs.com/shell/supervisord.conf
wget -O /etc/init.d/supervisord https://github.com/glzjin/ssshell-jar/raw/master/supervisord 

优化TCP
modprobe bridge
echo '
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_congestion_control=bbr
net.core.default_qdisc=fq
net.core.rmem_default = 8388608  
net.core.rmem_max = 16777216  
net.core.wmem_default = 8388608  
net.core.wmem_max = 16777216  
net.core.netdev_max_backlog = 32768  
net.core.somaxconn = 32768  
net.core.optmem_max = 81920  
net.ipv4.tcp_wmem = 8192 436600 873200
net.ipv4.tcp_rmem  = 32768 436600 873200
net.ipv4.tcp_mem = 94500000 91500000 92700000 
net.ipv4.tcp_keepalive_time = 1200  
net.ipv4.tcp_keepalive_intvl = 30  
net.ipv4.tcp_keepalive_probes = 3  
net.ipv4.tcp_sack = 1  
net.ipv4.tcp_fack = 1  
net.ipv4.tcp_timestamps = 1  
net.ipv4.tcp_window_scaling = 1  
net.ipv4.tcp_syncookies = 1  
net.ipv4.tcp_tw_reuse = 1  
net.ipv4.tcp_tw_recycle = 1  
net.ipv4.tcp_fin_timeout = 30  
net.ipv4.ip_local_port_range = 10000  65000  
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_max_syn_backlog = 65536
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_retries2 = 5
vm.overcommit_memory = 1
' >/etc/sysctl.conf
sysctl -p
安装完成

服务器ShadowsocksR启动方式:

systemctl restart supervisord

或者

python /root/ss/server.py &

#关于OpenVPN控制

挺简单的,研究一下他的用户表,在OpenVPN服务端使用远程数据库控制