Open aiastia opened 5 years ago
PPTP,L2TP,OpenVPN之VPN三合一安装包 2011年8月5日 | 分类: Linux, VPN | 标签: centos, Freeradius, l2tp, Linux, lnmp, mysql, OpenVPN, pptp, sh, shell, VPN, vpn三合一安装包, 三合一安装包, 快速安装系列
yum -y install screen screen -S vpn wget -c http://nchc.dl.sourceforge.net/project/vpn3in1/vpn3in1.tar.gz tar zxvf vpn3in1.tar.gz ./vpn3in1.sh 2>&1 | tee vpn3in1.log
2014.1.20修复openvpn生成证书错误; 2012.8.25更新:本地完整安装包; 2012.3.19更新:添加对自定义下载安装包地址的支持; 2011.8.5更新:添加对centos 6.0支持; 2011.7.2更新:添加验证已安装mysql的root用户密码是否正确;添加Daloradius,RadiusManager,apache。详细安装可以看图示; 2011.5.8更新:添加可选使用本机freeradius服务或者使用远程freeradius服务器,如果使用远程则不会在本机安装freeradius及mysql服务; 提高Mysql是否安装识别,去除Nginx,phpMyAdmin,daloradius安装,这些功能建议单独安装,还原OPENVPN端口为1194。 已知问题: 1,可选RadiusManage是修改mac地址进行破解,如果vps不支持修改mac地址将导致无法连接。 2,L2TP不能记录callingstationid,OPENVPN使用UDP端口不能记录acctstoptime 根据palfans修改而成,http://www.palfans.net/3-in-1-vpn-package/
开启mysql远程帐号脚本 mysql -u root -proot; grant all on . to username@'%' identified by 'password'; flush privileges; 其中 all 指定相关的操作, .说明数据库和表名, username表示用户名,‘%’这里写Host名称,允许所有就用‘%’,‘password’是密码。这里改成相应的值后进行操作就可以开启远程帐号访问
修改VPN服务器radius认证为远程服务器 修改参数在VPN服务器运行下面脚本
radius_server="radius服务器IP" secret_key="yishanhome.com" etc_dir="/usr/local/etc" sed -i -e "s/name=127.0.0.1/name=$radius_server/" /etc/openvpn/radiusplugin.cnf sed -i -e "s/sharedsecret=testpw/sharedsecret=$secret_key/" /etc/openvpn/radiusplugin.cnf sed -i -e "s/localhost:1812/$radius_server:1812/" $etc_dir/radiusclient/radiusclient.conf sed -i -e "s/localhost:1813/$radius_server:1813/" $etc_dir/radiusclient/radiusclient.conf mv -f $etc_dir/radiusclient/servers $etc_dir/radiusclient/servers.bak cat >> $etc_dir/radiusclient/servers <<EOF $radius_server $secret_key EOF 修改参数在radius服务器运行下面脚本
client_ip="VPN服务器IP" secret_key="yishanhome.com" etc_dir="/usr/local/etc" iptables -A INPUT -i eth0 -p udp -s $client_ip --dport 1812 -j ACCEPT iptables -A INPUT -i eth0 -p udp -s $client_ip --dport 1813 -j ACCEPT cat >> $etc_dir/raddb/clients.conf <<EOF client localhost { ipaddr = $client_ip secret = $secret_key require_message_authenticator = no nastype = other } EOF
图片可以点击看大图。
首先是这个,目前支持九种。
0=SS 1=VPN 2=SSH 3=PAC 4=APN 描述文件外链 5=Anyconnect 6=APN 7=PAC PLUS 8=PAC PLUS PLUS
一个个来讲。
注意:
1、在添加节点的时候,请遵守 "节点名 - 方式"的命名规则,以便于自动归类,特别注意 “ - ”,即 一个空格 一个横杠 一个空格。
2、radius secret 密钥的话 ,你先在 sspanel 魔改版的配置文件里配置好,再在子节点配置的时候进行设置。自己定义,但一定要对应。
3、PAC 类应用需要在主服务器运行一个 PAC 生成器 https://github.com/Leask/Flora_Pac
监听在 127.0.0.1:8974
运行命令如下
cd ~/Flora_Pac screen -dmS pac ./flora_pac -x "TIHUAN" -p 8974
首先在面板里进行如下的节点添加。
然后,推荐部署 https://github.com/glzjin/ssshell-jar/wiki/
这个后端,此处不再赘述。记住 nodeid 要和
对应。
首先请确保你正确地按照 https://www.zhaoj.in/read-3289.html
这里的说明安装了 Radius ,并正确地在 ss-panel 里设置了数据库信息,并且正确地设置了计划任务.
然后是在面板里添加一个 VPN 节点,请注意,添加这个节点的同时也会向 Radius 数据库里 nas 表添加一个节点,如果你不使用VPN ,但遇到要使用 Radius 验证的方式的时候,也请添加一个 类型 1 ,即 VPN 节点,这样才能保证能向 Radius 数据库里 添加 NAS 信息。
同时,要统计流量的话,请确保计划任务在正常运行,并且节点列表中有这两个东西
至于子节点的安装,用 http://www.yishanhome.com/archives/307 的一键包即可,在填写 Radius 服务器信息的时候请填主节点的信息,并确保主节点 Radius 服务在正常运行。
同 VPN ,也是 Radius 验证,首先要添加一个类型 1 VPN 节点,以便使用 Radius 验证,然后在面板里添加节点也和 VPN 差不多,就是类型要填 2。
子节点的搭建,请参考这篇东西 https://www.zhaoj.in/read-2547.html
不过有点过时了= =在 ss-panel v3 可能会有错误= =自己拿源码改改吧。。。主要是现在我也不用这个方式了。
通过连接 squid 监听 的 25 端口来进行连接。
同 VPN ,也是 Radius 验证,首先要添加一个类型 1 VPN 节点,以便使用 Radius 验证,然后在面板里添加节点也和 VPN 差不多,就是类型要填 3,同时地址要这样填 域名:端口。别看下面两张图,已经过期了。
子节点的搭建的话
以 Centos 6 x64 为例
首先安装 squid
yum install squid -y
然后编辑一下 /etc/squid/squid.conf
编辑成如下
# TAG: auth_param #Authentication Radius: auth_param basic program /usr/lib64/squid/squid_radius_auth -f /etc/squid/squid_rad_auth.conf auth_param basic children 10 auth_param basic realm Zhaojin97.cn auth_param basic credentialsttl 24 hours auth_param basic casesensitive off acl radius-auth proxy_auth REQUIRED # TAG: http_access # Allow authorized users: http_access allow radius-auth # # Recommended minimum configuration: # acl manager proto cache_object acl localhost src 127.0.0.1/32 ::1 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing # should be allowed acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src 172.16.0.0/12 # RFC1918 possible internal network acl localnet src 192.168.0.0/16 # RFC1918 possible internal network acl localnet src fc00::/7 # RFC 4193 local private network range acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines #acl SSL_ports port 443 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT # # Recommended minimum Access Permission configuration: # # Only allow cachemgr access from localhost http_access allow manager localhost http_access deny manager # Deny requests to certain unsafe ports http_access deny !Safe_ports # Deny CONNECT to other than secure SSL ports #http_access deny CONNECT !SSL_ports # We strongly recommend the following be uncommented to protect innocent # web applications running on the proxy server who think the only # one who can access services on "localhost" is a local user #http_access deny to_localhost # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # # Example rule allowing access from your local networks. # Adapt localnet in the ACL section to list your (internal) IP networks # from where browsing should be allowed http_access allow localnet http_access allow localhost # And finally deny all other access to this proxy http_access deny all # Squid normally listens to port 3128 http_port 25 # Uncomment and adjust the following to add a disk cache directory. #cache_dir ufs /var/spool/squid 100 16 256 # Leave coredumps in the first cache dir coredump_dir /var/spool/squid # Add any of your own refresh_pattern entries above these. refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320
然后编辑 /etc/squid/squid_rad_auth.conf
server 《主服务器域名》 # Radius Server IP or Hostname secret 《密钥》
然后启动即可
service squid start chkconfig squid on
用得不多,就是链接到外部的 PAC 文件的。
同 VPN ,也是 Radius 验证,首先要添加一个类型 1 VPN 节点,以便使用 Radius 验证,然后在面板里添加节点也和 VPN 差不多,就是类型要填 3,同时地址要这样填 地址:端口。
子节点搭建的话 参考这里 https://www.zhaoj.in/read-2904.html
统计流量的话 看 https://mengyang.wang/anyconnect-node-mb/
给苹果手机用的,
通过连接 squid 监听 的 25 端口来进行连接。
同 VPN ,也是 Radius 验证,首先要添加一个类型 1 VPN 节点,以便使用 Radius 验证,然后在面板里添加节点也和 VPN 差不多,就是类型要填 3,同时地址要这样填 节点域名:端口。
这个是国内中转套件的一部分,请捐赠用户们晚些看我另外一篇东西。
这个是国内中转套件的一部分,请捐赠用户们晚些看我另外一篇东西。
openconnect是否支持流量统计呢
是支持的
https://mengyang.wang/anyconnect-node-mb/ 这个网站已经进不去了, 还有别的办法嘛?
根据这个教程衍生和记录而来。
Centos 6 x64 下进行。
1、依赖 yum install pam-devel readline-devel http-parser-devel unbound gmp-devel yum install tar gzip xz wget gcc make autoconf 2、安装 nettle cd wget https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz tar zxvf nettle-3.1.tar.gz cd nettle-3.1/ ./configure --prefix=/usr/local/nettle make && make install echo '/usr/local/nettle/lib64/' > /etc/ld.so.conf.d/nettle.conf ldconfig 3、安装 gnutls cd export NETTLE_CFLAGS="-I/usr/local/nettle/include/" export NETTLE_LIBS="-L/usr/local/nettle/lib64/ -lnettle" export HOGWEED_LIBS="-L/usr/local/nettle/lib64/ -lhogweed" export HOGWEED_CFLAGS="-I/usr/local/nettle/include" wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.7.tar.xz tar xvf gnutls-3.4.7.tar.xz cd gnutls-3.4.7 ./configure --prefix=/usr/local/gnutls --with-included-libtasn1 --without-p11-kit make && make install ln -s /usr/local/gnutls/bin/certtool /usr/bin/certtool echo '/usr/local/gnutls/lib/' > /etc/ld.so.conf.d/gnutls.conf ldconfig 4、安装 libnl cd yum install bison flex wget https://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz tar xvf libnl-3.2.25.tar.gz cd libnl-3.2.25 ./configure --prefix=/usr/local/libnl make && make install echo '/usr/local/libnl/lib/' > /etc/ld.so.conf.d/libnl.conf ldconfig 5、安装 radius 相关 export LIBNL3_LIBS="-L//usr/local/libnl/lib/ -lnl-3 -lnl-route-3" export LIBGNUTLS_LIBS="-L/usr/local/gnutls/lib/ -lgnutls" export LIBGNUTLS_CFLAGS="-I/usr/local/gnutls/include/" wget https://github.com/radcli/radcli/releases/download/1.2.5/radcli-1.2.5.tar.gz tar xvzf radcli-1.2.5.tar.gz cd radcli-1.2.5 ./configure --prefix=/usr/local/radcli echo '/usr/local/radcli/lib/' > /etc/ld.so.conf.d/radcli.conf make && make install ldconfig yum install freeradius-client -y 6、安装正宫–ocserv export RADCLI_LIBS="-L/usr/local/radcli/lib/ -lradcli" export RADCLI_CFLAGS="-I/usr/local/radcli/include/" wget ftp://ftp.infradead.org/pub/ocserv/ocserv-0.10.9.tar.xz tar xvf ocserv-0.10.9.tar.xz cd ocserv-0.10.9 编辑 src/vpn.h
7、证书相关 这里因为我有个泛域名证书,所以就不生成了= =直接用。
mkdir /etc/ocserv/
编辑 /etc/ocserv/server-cert.pem ,把证书文件贴进去,记住只贴一个,就是颁发给你的证书= =你贴证书链后面会报错= =貌似是 CA 证书不科学的原因。
然后 chmod 600 /etc/ocserv/server-cert.pem 还有 server-key.pem ,也是一样的,密钥粘进去,权限设置好。
8、freeradius-client 的设置 我这里只做了登陆的验证。
编辑 /etc/radiusclient/radiusclient.conf
yourserveraddress 指代 radius 服务器地址。 authserver yourserveraddress:1812
然后是编辑 /etc/radiusclient/servers ,
添加
yourserveraddress 指代 radius 服务器地址。yourserversecret 指代 radius 服务器密钥。
配置文件的话,我们回到刚才编译 ocserv 的目录。
主要修改以下几个 try-mtu-discovery = true cisco-client-compat = true server-cert = /etc/ocserv/server-cert.pem server-key = /etc/ocserv/server-key.pem max-clients = 50 max-same-clients = 10 tcp-port = 5444 udp-port = 5444 dns = 8.8.8.8 dns = 8.8.4.4 ipv4-network = 192.168.10.0 occtl-socket-file = /var/run/occtl.socket
ca-cert=。。。。 对没错注释掉
9、防火墙&系统配置
把这行加进 /etc/rc.local 就可以开机自启动了。