PPTP/L2TP + FreeRADIUS + MySQL 安装与配置

2012年11月11日 | 分类: 翻墙相关 | 标签: , , , ,

Debian/Ubuntu PPTP VPN 安装笔记

VPN 也叫虚拟专用网,常见的 VPN 类型有:点对点隧道协议(PPTP)、使用 IPsec 的第2层隧道协议(L2TP/IPsec)、安全套接字隧道协议(SSL VPN)。其中 PPTP 是安装使用最为简便的一种。

在开始前建议你先阅读以下3篇文章,特别是有关路由方面的知识:《详解IPv4地址》《子网划分及子网掩码计算方法》《理解Windws中的路由表》

一、安装 pptpd

不建议编译安装,没有多大意义,得不偿失。

1
2
apt-get -y update
apt-get -y install pptpd

二、编辑 pptpd.conf

localip 是 VPN 服务器 IP,可任意指定。
remoteip 是可分配给 vpn 客户端 IP。
为避免冲突,localip、remoteip 最好不要与服务器当前内网或经常拨入的客户端内网地址在同一网段。

1
2
3
4
cat >>/etc/pptpd.conf<<EOF
localip 10.10.10.1
remoteip 10.10.10.2-254
EOF

三、编辑 pptpd-options

1
cp /etc/ppp/pptpd-options /etc/ppp/pptpd-options.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cat >/etc/ppp/pptpd-options<<EOF
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
debug
dump
lock
nobsdcomp
novj
novjccomp
logfile /var/log/pptpd.log
EOF

name pptpd(pptpd服务名,可以随便填写。)
refuse-pap(拒绝pap身份认证模式。)
refuse-chap(拒绝chap身份认证模式。)
refuse-mschap(拒绝mschap身份认证模式。)
require-mschap-v2(在端点进行连接握手时需要使用微软的 mschap-v2 进行自身验证。)
require-mppe-128(MPPE 模块使用 128 位加密。)
ms-dns 8.8.8.8 (ppp 为 Windows 客户端提供 DNS 服务器 IP 地址。)
proxyarp (建立 ARP 代理键值。)
nodefaultroute(不替换默认路由)
debug(开启调试模式,相关信息记录在 /var/logs/message 中。)
lock(锁定客户端 PTY 设备文件。)
nobsdcomp (禁用 BSD 压缩模式。)

四、添加 VPN 用户

chap-secrets 文件为4段,分别是:用户名、服务器名称、密码、分配给客户端的IP。
服务器名可以是pptpd或今后的l2tpd,*号代表全部。
密码以明文填写,不需进行加密。
最后的*号代表从remoteip指定的IP段随机分配

1
2
3
cat >>/etc/ppp/chap-secrets<<EOF
test * test *
EOF

五、配置iptables规则

ipv4转发,否则连接VPN后,只能访问服务器资源,而不能访问这台服务器以外的资源。

1
2
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sysctl -p

备份当前iptables规则。

1
iptables-save > /etc/iptables.down.rules

设置 iptables NAT 转发

1
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE

设置 MTU (选做)

1
iptables -I FORWARD -s 10.0.0.0/8 -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1300

保存新的 iptables 的规则,以便重启后继续有效。

1
iptables-save > /etc/iptables.up.rules
1
2
3
4
cat >>/etc/ppp/pptpd-options<<EOF
pre-up iptables-restore < /etc/iptables.up.rules
post-down iptables-restore < /etc/iptables.down.rules
EOF

六、重启pptpd服务

1
2
/etc/init.d/pptpd restart
netstat -lntp

补充:PPTPD 自动安装脚本

1
2
3
wget -c http://small-script.googlecode.com/files/debian-pptpd.tar.gz
tar -zxf debian-pptpd.tar.gz
./pptpd.sh

最后更新:2011.08.16

原文地址 : http://wangyan.org/blog/debian-pptp-vpn.html

==========

Debian/Ubuntu L2TP/IPSec VPN 安装笔记

第2层隧道协议 (L2TP),是 VPN 隧道协议的一种,是 PPTP 的后续版本。L2TP 支持两端点间多隧道,但通常要由 IPSec 来提供加密和验证功能,可建立变动的客户端到固定服务器的连接。

一、安装 IPSec

IPSec 用于对 IP 数据包进行加密和验证,通常使用 Openswan 来实现 IPSec。

1.1、安装编译工具

1
apt-get -y install build-essential

1.2、安装 OpenSwan 依赖包

1
apt-get -y install libgmp3-dev flex bison

1.3、编译安装 OpenSwan

1
2
3
4
wget -c http://www.openswan.org/download/openswan-2.6.33.tar.gz
tar -zxf openswan-2.6.33.tar.gz
cd openswan-2.6.33
make programs install

1.4、编辑 IPSec 配置文件

注意将”192.168.1.102″换成服务器公网IP。

1
cp /etc/ipsec.conf /etc/ipsec.conf.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cat >/etc/ipsec.conf<<EOF
version 2.0

config setup
    nat_traversal=yes
    virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12
    oe=off
    protostack=netkey

conn L2TP-PSK-NAT
    rightsubnet=vhost:%priv
    also=L2TP-PSK-noNAT

conn L2TP-PSK-noNAT
    authby=secret
    pfs=no
    auto=add
    keyingtries=3
    rekey=no
    ikelifetime=8h
    keylife=1h
    type=transport
    left=192.168.1.102
    leftprotoport=17/1701
    right=%any
    rightprotoport=17/%any
EOF

1.5、设置 PSK 预共享密钥

注意将”192.168.1.102″换成服务器公网IP。将”123456″换成你自己的PSK。

1
2
3
cat >/etc/ipsec.secrets<<EOF
192.168.1.102 %any: PSK "123456"
EOF

1.6、调整网络策略

for 循环语句,请一行一行地输入,输完后按回车。

1
2
3
4
5
for each in /proc/sys/net/ipv4/conf/*
do
echo 0 > $each/accept_redirects
echo 0 > $each/send_redirects
done

1.7、重启IPSec 服务

1
2
/etc/init.d/ipsec restart
/usr/local/sbin/ipsec verify

可尝试使用 L2TP/IPSec 客户端连接一次,以测试 IPSec 部分配置是否成功。

1
cat /var/log/auth.log | grep pluto

如出现”IPsec SA established transport mode”则成功了。

二、安装 L2TP

使用 xl2tpd 来实现 L2TP,另外要注意的是 xl2tpd 需要从 rp-l2tp 中提取 l2tp-control。

2.1、提取 l2tp-control

1
2
3
4
5
6
7
8
wget http://nchc.dl.sourceforge.net/project/rp-l2tp/rp-l2tp/0.4/rp-l2tp-0.4.tar.gz
tar zxvf rp-l2tp-0.4.tar.gz
cd rp-l2tp-0.4
./configure
make
cp handlers/l2tp-control /usr/local/sbin/
mkdir /var/run/xl2tpd/
ln -s /usr/local/sbin/l2tp-control /var/run/xl2tpd/l2tp-control

2.2、编译安装 xl2tpd

1
apt-get -y install libpcap-dev #安装依赖包
1
2
3
4
5
wget -c http://www.xelerance.com/wp-content/uploads/software/xl2tpd/xl2tpd-1.2.8.tar.gz
tar -zxf xl2tpd-1.2.8.tar.gz
cd xl2tpd-1.2.8
make install
mkdir /etc/xl2tpd

2.3、编辑 xl2tpd 配置文件

ip range 是连接上来的客户端所获得的服务器端内网的 IPv4 地址段。
local ip 是 pppX 所占用的那个 IP 地址。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cat >/etc/xl2tpd/xl2tpd.conf<<EOF
[global]
ipsec saref = yes

[lns default]
local ip = 10.10.11.1
ip range = 10.10.11.2-10.10.11.245
refuse chap = yes
refuse pap = yes
require authentication = yes
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
EOF

三、PPP 的安装配置

3.1、安装 ppp 包

1
apt-get -y install ppp

3.2、配置 options.xl2tpd

主要是改MS-DNS,其他默认。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cat >/etc/ppp/options.xl2tpd<<EOF
require-mschap-v2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
asyncmap 0
auth
crtscts
lock
hide-password
modem
debug
name l2tpd
proxyarp
lcp-echo-interval 30
lcp-echo-failure 4
EOF

四、添加 VPN 用户

chap-secrets 文件为4段,分别是:用户名、服务器名称、密码、分配给客户端的IP。
服务器名可以是l2tpd 或 pptpd,*号代表全部。
密码以明文填写,不需进行加密。
最后的*号代表从remoteip指定的IP段随机分配

1
2
3
cat >>/etc/ppp/chap-secrets<<EOF
user * 123456 *
EOF

五、配置数据包转发

否则连接VPN后,只能访问服务器资源,而不能访问这台服务器以外的资源。

1
2
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sysctl -p

开启iptables转发

1
iptables -t nat -A POSTROUTING -j MASQUERADE

设置MTU

1
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356

六、启动 xl2tpd 服务

1
2
/usr/local/sbin/xl2tpd
/usr/local/sbin/xl2tpd -D #以调式模式启动

参考资料:

1. http://www.linuxhomenetworking.com/wiki/index.php
2. http://www.linode.com/wiki/index.php/AndroidL2TPPSKServer
3. https://humou.net/blog/201102061326.html
4. http://b.gkp.cc/2010/06/19/setup-ipsec-l2tp-on-centos-55/
5. http://apple4.us/2010/05/setting-up-l2tp-vpn-on-debian-ubuntu.html

原文地址 : http://wangyan.org/blog/debian-l2tp-ipsec-vpn.html

==========

PPTP/L2TP + FreeRADIUS + MySQL 安装与配置

FreeRADIUS 是实现 RADIUS 协议的开源软件,而 RADIUS 主要用来实现认证(Authentication)、授权(Authorization)以及计费(Accounting)功能。

首先请确认你已经搭建好pptpd,并可以正常使用。安装方法见《Debian/Ubuntu PPTP VPN 安装笔记》

一、FreeRADIUS 服务端安装

1.1、下载、编译、安装

1
2
3
4
5
wget ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.1.12.tar.gz
tar zxf freeradius-server-2.1.12.tar.gz
cd freeradius-server-2.1.12
./configure --prefix=/usr/local/radius
make && make install
1
2
echo "/usr/local/radius/lib" >> /etc/ld.so.conf
ldconfig

1.2、基本文件的本地测试(选做)

测试是否安装成功,如果不需要与mysql集成,那么就已安装完成。

1
2
3
4
5
6
7
8
查找 steve Cleartext (76-84行), 取消注释
vim /usr/local/radius/etc/raddb/users

# 大写X,意思是以debug模式运行。
/usr/local/radius/sbin/radiusd -X 

#新开一个窗口执行,看到 "Access-Accept packet" 表示成功了,"Access-Reject" 表示失败了。
/usr/local/radius/bin/radtest steve testing localhost 0 testing123

二、FreeRadius MySQL 模块配置

2.1、启用MySQL模块支持

1
2
# 查找"sql.conf”(700行),去掉#号
vim /usr/local/radius/etc/raddb/radiusd.conf

2.2、创建 radius 数据库及表

1
2
# 123456是你mysql的root密码
mysqladmin -uroot -p123456 create radius;
1
2
3
4
#设置radius帐号的密码
cd /usr/local/radius/etc/raddb/sql/mysql
sed -i 's/radpass/123456/g' admin.sql
sed -i 's/radpass/123456/g' /usr/local/radius/etc/raddb/sql.conf
1
2
3
4
5
6
mysql -uroot -p123456 < admin.sql
mysql -uroot -p123456 radius < cui.sql
mysql -uroot -p123456 radius < ippool.sql
mysql -uroot -p123456 radius < nas.sql
mysql -uroot -p123456 radius < schema.sql
mysql -uroot -p123456 radius < wimax.sql

2.3、打开从数据库查询nas支持

默认从 “/usr/local/etc/raddb/clients.conf” 文件读取,开启后可从数据库nas表读取。

1
sed -i 's/\#readclients/readclients/g' /usr/local/radius/etc/raddb/sql.conf

2.4、打开在线人数查询支持

1
2
# 查找simul_count_query将279-282行注释去掉
vim /usr/local/radius/etc/raddb/sql/mysql/dialup.conf

2.5、修改sites-enabled目录配置文件

1
vim /usr/local/radius/etc/raddb/sites-enabled/default

找到authorize {}模块,注释掉files(170行),去掉sql前的#号(177行)
找到accounting {}模块,注释掉radutmp(396行),注释掉去掉sql前面的#号(406行)。
找到session {}模块,注释掉radutmp(450行),去掉sql前面的#号(454行)。
找到post-auth {}模块,去掉sql前的#号(475行),去掉sql前的#号(563行)。

1
vim /usr/local/radius/etc/raddb/sites-enabled/inner-tunnel

找到authorize {}模块,注释掉files(124行),去掉sql前的#号(131行)。
找到session {}模块,注释掉radutmp(251行),去掉sql前面的#号(255行)。
找到post-auth {}模块,去掉sql前的#号(277行),去掉sql前的#号(301行)。

三、FreeRADIUS 客户端安装与配置

3.1、编译与安装

1
2
3
4
5
wget ftp://ftp.freeradius.org/pub/freeradius/freeradius-client-1.1.6.tar.gz
tar -zxf freeradius-client-1.1.6.tar.gz
cd freeradius-client-1.1.6
./configure --prefix=/usr/local/radius
make && make install

3.2、设置通信密码

1
2
3
cat >>/usr/local/radius/etc/radiusclient/servers<<EOF
localhost   testing123
EOF

其中localhost可以写成服务器IP地址,testing123是认证服务器的连接密码。
注:如果使用的是IP地址,记得同时修改下面设置。

1
sed -i 's/localhost/192.168.8.129/g' /usr/local/radius/etc/radiusclient/radiusclient.conf

3.3、增加字典

这一步很重要!否则windows客户端无法连接服务器。

1
2
wget -c http://small-script.googlecode.com/files/dictionary.microsoft
mv ./dictionary.microsoft /usr/local/radius/etc/radiusclient/
1
2
3
4
5
6
7
cat >>/usr/local/radius/etc/radiusclient/dictionary<<EOF
INCLUDE /usr/local/radius/etc/radiusclient/dictionary.sip
INCLUDE /usr/local/radius/etc/radiusclient/dictionary.ascend
INCLUDE /usr/local/radius/etc/radiusclient/dictionary.merit
INCLUDE /usr/local/radius/etc/radiusclient/dictionary.compat
INCLUDE /usr/local/radius/etc/radiusclient/dictionary.microsoft
EOF

3.4、PPTP启用freeradius插件

这一步网上一些教程没提,但很重要,否则会报错!

1
2
3
#sed -i 's/logwtmp/\#logwtmp/g' /etc/pptpd.conf
sed -i 's/radius_deadtime/\#radius_deadtime/g' /usr/local/radius/etc/radiusclient/radiusclient.conf
sed -i 's/bindaddr/\#bindaddr/g' /usr/local/radius/etc/radiusclient/radiusclient.conf

注:64位系统插件路径是 “/usr/lib64/pppd/2.4.5/radius.so”

1
2
3
4
cat >>/etc/ppp/options.pptpd<<EOF
plugin /usr/lib64/pppd/2.4.5/radius.so
radius-config-file /usr/local/radius/etc/radiusclient/radiusclient.conf
EOF

3.5、L2TP启用freeradius插件

L2TP 的道理也一样,你首先安装配置好L2TP/IPSec,并保证能正常使用。
《Debian/Ubuntu L2TP/IPSec VPN 安装笔记》

注:64位系统插件路径是 “/usr/lib64/pppd/2.4.5/radius.so”

1
2
3
4
cat >>/etc/ppp/options.xl2tpd<<EOF
plugin  /usr/lib64/pppd/2.4.5/radius.so
radius-config-file /usr/local/radius/etc/radiusclient/radiusclient.conf
EOF

四、用户权限管理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#连接 MySQL 数据库
mysql -uroot -p123456;

# 使用 radius 数据库
USE radius; 

# 添加用户test,密码test,注意是在radchec表
INSERT INTO radcheck (username,attribute,op,VALUE) VALUES ('test','Cleartext-Password',':=','test');

# 将用户test加入VIP1用户组
INSERT INTO radusergroup (username,groupname) VALUES ('test','VIP1');

# 限制同时登陆人数,注意是在radgroupcheck表
INSERT INTO radgroupcheck (groupname,attribute,op,VALUE) VALUES ('VIP1','Simultaneous-Use',':=','3');

# 添加NAS
INSERT INTO radius.nas VALUES ('1','192.168.8.129','Toky', 'other', NULL ,'linodecn.net',NULL ,NULL ,'RADIUS Client');

# 其他(选做)
INSERT INTO radgroupreply (groupname,attribute,op,VALUE) VALUES ('VIP1','Auth-Type',':=','Local');
INSERT INTO radgroupreply (groupname,attribute,op,VALUE) VALUES ('VIP1','Service-Type',':=','Framed-User');
INSERT INTO radgroupreply (groupname,attribute,op,VALUE) VALUES ('VIP1','Framed-Protocol',':=','PPP');
INSERT INTO radgroupreply (groupname,attribute,op,VALUE) VALUES ('VIP1','Framed-MTU',':=','1500');
INSERT INTO radgroupreply (groupname,attribute,op,VALUE) VALUES ('VIP1','Framed-Compression',':=','Van-Jacobson-TCP-IP');

五、自动启动

1
2
3
4
5
6
#cp /usr/local/radius/sbin/rc.radiusd /etc/init.d/radiusd
#/usr/local/radius/sbin/radiusd -X
wget http://wangyan.org/download/conf/init.radiusd -P /etc/init.d/radiusd
chmod 755 /etc/init.d/radiusd
chkconfig radiusd on
/etc/init.d/radiusd start

参考资料:

1. http://wiki.freeradius.org/SQL%20HOWTO
2. https://tomem.info/blog/2011/04/562
3. https://tomem.info/blog/2011/04/577
4. http://www.xtgly.com/2011/01/05/…
5. http://ichinihachi.blogspot.com/2011/02/ubuntufreeradius.html

更新历史:

2011.08.23 …
2012.02.11 更改安装路径便于卸载、部分错误修正。

原文地址 : http://wangyan.org/blog/freeradius-pptp-l2tp-html.html

==========

通过FreeRADIUS实现VPN流量控制功能

搭建一个VPN非常容易,但如何实现PPTP/L2TP VPN流量限制?首先必须先安装配置好FreeRADIUS,方法见《PPTP/L2TP + FreeRADIUS + MySQL 安装与配置》,然后再进行下面操作。

一、启用 Rlm sqlcounter 模块

查找”counter.conf”(712行),去掉#号

1
vim /usr/local/radius/etc/raddb/radiusd.conf

二、添加 Traffic Counter流量计数器

网上一些教程有拼写错误,折腾了大半天才在官方文档上找到原因。

1
vim /usr/local/radius/etc/raddb/sql/mysql/counter.conf

在文件末尾添加下面代码

1
2
3
4
5
6
7
8
9
sqlcounter monthlytrafficcounter {
    counter-name = Monthly-Traffic
    check-name = Max-Monthly-Traffic
    reply-name = Monthly-Traffic-Limit
    sqlmod-inst = sql
    key = User-Name
    reset = monthly
    query = "SELECT SUM(acctinputoctets + acctoutputoctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) > '%b'"
}

上面代码意思是按月进行统计,从数据库的radacct表中,根据用户名(%k)将所有入站和出站流量累加。

时间也是可以自定义的(months、weeks、days、hours),也可以指定具体值,如三天重置一次 “reset = 3 d”

三、启用Traffic Counter流量计数器

1
vim /usr/local/radius/etc/raddb/sites-enabled/default

在authorize区块的末尾(205行)添加

1
monthlytrafficcounter

四、添加字典文件

1
vim /usr/local/radius/etc/raddb/dictionary

在文件末尾添加下面两行

1
2
ATTRIBUTE Max-Monthly-Traffic 3003 integer
ATTRIBUTE Monthly-Traffic-Limit 3004 integer

五、数据库插入流量限制值

注意事项:

1)这里插入到radgroupcheck表,是限制某个用户组的流量。也可以插入到radcheck表,以限制某个用户的流量。
2)流量值以 byte 为单位,1G = 1073741824 bytes
3)VIP1是用户组,123456是数据库root密码

# 连接到MySQL数据库

1
mysql -uroot -p123456;

# 每月最大流量(1G)

1
INSERT INTO radgroupcheck (groupname,attribute,op,VALUE) VALUES ('VIP1','Max-Monthly-Traffic',':=','1073741824');

# 流量统计时间的间隔(60秒)

1
INSERT INTO radgroupcheck (groupname,attribute,op,VALUE) VALUES ('VIP1','Acct-Interim-Interval',':=','60');

参考资料:

1. http://wiki.freeradius.org/Rlm_sqlcounter
2. http://freeradius.org/rfc/attributes.html
3. https://blog.easisee.com/2010/09/freeradius-traffic-limit/

原文地址 : http://wangyan.org/blog/freeradius-traffic-limit.html

==========

ASN RADIUS Admin 安装指南

ARA (ASN RADIUS admin) 是一个简单但功能强大的FreeRADIUS服务器Web管理程序。它可以管理用户、用户组、网络访问服务器、查看在线用户、用户流量使用情况等等(官方介绍)。

一、下载与安装

1.1 安装 Sigma 模板引擎

请先确保PHP的pear扩展已正确安装。否则会出现“白屏”等问题。

1
2
pear channel-update pear.php.net
pear install HTML_Template_Sigma

1.2 下载、安装

1
2
3
4
yum install git
git clone git://git.asn.pl/asn/ara
mv ara/src /usr/local
ln -s /usr/local/ara/htdocs/ /var/www/ara

1.3 安装中文汉化包

1
2
3
4
# wget http://wangyan.org/download/src/ara-0.6-cn.zip
wget http://pub.easisee.com/p/ara-zh/src.tar.gz
tar -zxf src.tar.gz
mv src/* /usr/local/ara

二、ARA 简单配置

1
2
3
cd /usr/local/ara/config
cp config.php.dist config.php
vim config.php

2.1 修改Radius数据库信息

1
2
3
$config["sql_username"]    = "radius";
$config["sql_passwd"]      = "radius";
$config["sql_db"]          = "radius";

2.2 启用用户扩展信息存储

用于保存用户的 Email、电话、地址等信息,此功能需要导入da.sql到数据库。

1
$config["sql_user_extension"]      = TRUE; //将False改为TRUE。
1
2
3
4
mysql -uroot -p123456; #连接数据库
use radius;#使用radius数据库
source /usr/local/ara/lib/sql-user-ext/da.sql; #导入表结构
grant all on radius.userinfo to radius@localhost; #增加操作userinfo表的权限

2.3 指定ARA访问权限

ALL是最大权限,可选值还有 NONE、VIEW、VIEW_ALL、EDIT。

1
$config["access_level"] = ARA_ACCESS_ALL;

这里还可以针对模块来指定权限。

1
2
$config["forbidden_modules"] = array();  #禁用某个模块
$config["allowed_modules"] = array(); #允许使用某个模块

三、ARA 用户权限配置

默认情况下,ARA用任意用户名和密码都可以登录的,这显然是很危险的。因此我们需要启用ARA自带的用户验证功能。

3.1 启用用户认证

1
2
3
$config["use_auth"] = TRUE; #启用PHP_AUTH_USER认证
$config["force_user_file"] = TRUE; #用户文件验证(users/$user.php)
$config["allow_user_file_without_pass"] = FALSE;#不允许密码为空

3.2 复制用户配文件

实例:创建管理员帐号:admin,密码:123456

1
2
3
cd /usr/local/ara/config/users
cp example.php.dist admin.php
vim admin.php
1
2
3
$ara_user["pass"] = "123456";#去掉注释,密码123456
$config["access_level"] = ARA_ACCESS_ALL;#去掉注释,权限为最大值
$config["default_access"] = TRUE;#去掉注释,默认允许使用。

同样,这里也可以针对模板来指定权限。

1
2
$config["forbidden_modules"] = array();  #禁用某个模块
$config["allowed_modules"] = array(); #允许使用某个模块

图一:用户流量消耗排行榜

图二:查看某个机房的流量情况。

参考资料:

1. http://labs.asn.pl/ara/wiki/install_guide
2. http://daloradius.com/
3. http://www.lazylei.com/?p=545
4. https://blog.easisee.com/2010/09/ara-chinese/

更新历史:

1.增加汉化包备选下载地址 (2012.04.15)

原文地址 : http://wangyan.org/blog/ara-install-guide.html

  1. dorraemon616
    2016年4月26日10:16

    博主我的VPS是ubuntu openvz,完全按你的教程进行部署,PPTP/L2TP能在进程里看到,但就是无法连接,windows显示远程服务器无响应,求博主指导

    • iGFW
      2016年7月12日15:54

      抱歉,这个很旧没有测试了,不知道是不是代码已经失效了。
      简易参考 github.com/quericy/one-key-ikev2-vpn 一键脚本

  2. dorraemon616
    2016年4月20日13:36

    博主我是ubuntu14系统,我按你的教程安装,在安装L2PT,提取 l2tp-control进行到make就报错了
    root@doraemon616:~/rp-l2tp-0.4# make
    make -C handlers
    make[1]: Entering directory `/root/rp-l2tp-0.4/handlers’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/root/rp-l2tp-0.4/handlers’求指导

  3. 福音乐章
    2012年11月14日00:03

    以前我想做vpn生意的,但是考虑到资源消耗、带宽、spam、流量统计、商业竞争、gfw的封锁。。。我望而却步了。。。
    我觉得做vpn风险还是相当大的,万一有一个gfw内部人员注册进去了,看了看里面所有服务器的ip再一个个封 。。。

  4. 福音乐章
    2012年11月13日19:44

    这不是教人怎么做vpn生意吗。。。

    • iGFW
      2012年11月13日20:27

      也行,学会就能开了,哈哈