xml地图|网站地图|网站标签 [设为首页] [加入收藏]
来自 新闻动态 2019-12-01 06:36 的文章
当前位置: 新濠国际登录平台 > 新闻动态 > 正文

安装LNMP缺少的组件

1.安装web环境,使用LNMP一键安装包
具体安装步骤参考

VPN:PPTP+MySQL+Freeradiux的安装配置MySQL存储vpn帐号Freeradiux验证vpn帐号1.安装ppp2.安装pptp配置文件如下:#vimoptions.pptpdnamepptpdrefuse-paprefuse-chaprefuse-mschaprequire-mschap-v2require-mppe-128proxyarplocknobsdcompnovjnovjccompnologfdms-dns218.85.157.99ms-dns218.85.152.99plugin/usr/local/ppp/lib/pppd/2.4.4/radius.soplugin/usr/local/ppp/lib/pppd/2.4.4/radattr.soradius-config-file/usr/local/freeradius/etc/radiusclient/radiusclient.conf#vimpptpd.confoption/usr/local/pptpd/etc/options.pptpdlocalip192.168.100.100remoteip192.168.100.150-200黄底为新加配置内容。3.安装mysql4.安装freeradius#wgetftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.1.10.tar.gz#tarzxvpffreeradius-server-2.1.10.tar.gz-C../software#./configure--prefix=/usr/local/freeradius#make#makeinstall#makdir/usr/local/freeradius/etc/radiusclient#cp/usr/local/src/tarbag/ppp-2.4.4/pppd/plugins/radius/etc/*/usr/local/freeradius/etc/radiusclient#chown-Rradiusd.radiusd/usr/local/freeradius#vimservers//修改key#ServerNameorClient/ServerpairKey#-------------------------------#localhosttesting123localhost vpn#/usr/local/freeradius/sbin/radiusd-X//此过程会生产证书如果要修改key首先要删除之前的证书文件#cd/usr/local/freeradius/etc/raddb/certs#rm-rf*.pem*.der*.csr*.crt*.key*.p12serial*index.txt*5.关联mysql文件在这个目录下/usr/local/freeradius/etc/raddb/sql/mysql,包括一些授权命令都写好了。>createdatabasevpn>source/usr/local/freeradius/etc/raddb/sql/mysql/schema.sql>source/usr/local/freeradius/etc/raddb/sql/mysql/nas.sql>source/usr/local/freeradius/etc/raddb/sql/mysql/ippool.sql>source/usr/local/freeradius/etc/raddb/sql/mysql/wimax.sql>grantselect,insert,update,deleteon`vpn`.*to'user'@'x.x.x.x'identifiedby'password'>insertintoradgroupreply(groupname,attribute,op,value)values('user','Auth-Type',':=','Local')>insertintoradgroupreply(groupname,attribute,op,value)values('user','Service-Type','=','Framed-User')>insertintoradgroupreply(groupname,attribute,op,value)values('user','Framed-IP-Netmask','=','255.255.255.255')>insertintoradgroupreply(groupname,attribute,op,value)values('user','Framed-IP-Netmask',':=','255.255.255.0')>insertintoradcheck(UserName,Attribute,Value)values('test','User-Password','123456)>insertintoradusergroup(username,groupname)values('test','user')>insertintoradgroupcheck(groupname,attribute,op,value)Values('user','simultaneous-use',':=','1')//限制同一帐号同时只允许登录一次>insertintoradreply(username,attribute,op,value)values('vpnname','Framed-IP-Address',':=','xxx.xxx.xxx.xxx')//分配固定IP6.连接数据库#vim/usr/local/freeradius/etc/raddb/sql.conf修改数据库类型;数据库地址;用户名;密码;数据库名;数据表名#readclients=yes前面的#去掉7.开启sql模块#/usr/local/freeradius/etc/raddb/sites-enabled/defaultfiles行前面加#sql行前面去掉##/usr/local/freeradius/etc/raddb/sites-enabled/inner-tunnelfiles行前面加#sql行前面去掉#8.修改eap类型#vim/usr/local/freeradius/etc/raddb/eap.confdefalt_eap_type=md5改为default_eap_type=peap9.修改相应的路径#vim/usr/local/freeradius/etc/radiusclient/radiusclient.conf/usr/local/etc/改为/usr/local/freeradius/etc/10.修改radius以radiusd用户运行#/usr/local/freeradius/etc/raddb/radiusd.confuser=radiusdgroup=radiusd11.修改clients.conf#/usr/local/freeradius/etc/raddb/clients.confsecret=vpnclient192.168.100.0/24{secret=vpnshortname=vpn-network}12.修改dictionary#/usr/local/freeradius/etc/radiusclient/dictionaryINCLUDE/usr/local/freeradius/etc/radiusclient/dictionary.microsoftINCLUDE/usr/local/freeradius/etc/radiusclient/dictionary.ascendINCLUDE/usr/local/freeradius/etc/radiusclient/dictionary.meritINCLUDE/usr/local/freeradius/etc/radiusclient/dictionary.compat13.测试帐号##/usr/local/freeradius/bin/radtesttest123456localhost1812vpnSendingAccess-Requestofid7to127.0.0.1port1812User-Name="JSB_TEST_11"User-Password="ABC1234567890?aaa"NAS-IP-Address=127.0.0.1NAS-Port=1812rad_recv:Access-Acceptpacketfromhost127.0.0.1port1812,id=7,length=32Service-Type=Framed-UserFramed-IP-Netmask=255.255.255.0出现access-accept帐号可以使用不一定可以登录(比如禁用帐号后验证是通过的但是不能登录的),出现Access-Reject则失败。===========================================================ppp/pptp日志的分离#vim/etc/syslog.confdaemon.*/var/log/ppp.log#serviesyslogrestart拨上VPN后部分网站内容显示不全或打不开原因及解决办法:新濠国际登录平台 1新濠国际登录平台 2新濠国际登录平台 3mtu:MaxitumTransmissionUnit最大传输单元mss:MaxitumSegmentSize最大分段大小mtumss(应用层数据)+tcp包头+IP包头mss大小是通讯双方在建立TCP连接时根据双方提供的MSS值的最小值确定为这次连接的最大MSS值tcp数据包包头大小20Byteip数据包包头大小20Byte如果超过mtu的大小就需要对ip报文进行分片。如果ip报文中有DF(DonotFragment)标记就表示不可分片。如果报文超过MTU值又不能分片,就会丢弃报文,返回一个错误信息unreachable-needtofrag(不可到达,需要分片)。解决办法:iptables-AFORWARD-ptcp--syn-s192.168.100.0/24-jTCPMSS--set-mss1356凡是来自192.168.100.0/24网段的tcp包,mss设置为1356.

2.安装完成后,安装LNMP缺少的组件
ionCube组件安装
进入lnmp解压后的目录,执行:./addons.sh install ionCube
回车确认后就会自动安装ionCube loader。

...

yum install perl-DBI

yum freeradius-mysql freeradius-utils

3.安装FreeRadius
wget
tar xvf freeradius-server-2.1.8-dmamod-1.tar.gz
cd freeradius-server-2.1.8
./configure
make
make install

4.文件所有者和权限配置
chmod 644 /usr/local/etc/raddb/dictionary
chown www /usr/local/etc/raddb
chown www /usr/local/etc/raddb/clients.conf

5.测试FreeRadius
radiusd -X
出现错误
“error while loading shared libraries:libfreeradius-radius-2.1.8.so: cannot open shared object file : no such file or directory.”

采取的解决方式是将/usr/local/lib添加到/etc/ld.so.conf中

ld.so.conf文件内容如下:
include /etc/ld.so.conf.d/*.conf
添加一行 /usr/local/lib
完成后输入/sbin/ldconfig,再重新进行上面步骤。
Ldconfig命令是将/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.

在此命令调试radiusd -X
出现错误
Failed binding to authentication address * port 1812: Address already in use
/usr/local/etc/raddb/radiusd.conf[240]: Error binding to port for 0.0.0.0 port 1812

端口占用问题.
使用命令lsof -i:1812
得到
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
radiusd 11163 radiusd 5u IPv4 949974 0t0 UDP *:radius
发现居然是radius自己占用了

处理方法(暴力点)
kill 11163(radius进程的PID,centos查看进程PID命令:ps -ef)
如发现没有这个命令可以使用yum install psmisc进行安装

再次radiusd -X调试
显示Ready to process requests.

Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on command file /usr/local/var/run/radiusd/radiusd.sock
Listening on proxy address * port 1814
Ready to process requests.

到此处freeradius已经安装成功了

6.对freeradius详细配置,因为我们需要和RM整合,这里就需要详细的配置radius文件
首先说明一下在使用LNMP环境包,也可以简单的安装freeradius,简单安装步骤如下
使用命令:yum install perl-DBI freeradius freeradius-mysql freeradius-utils

可以一步到位安装好radius,我个人建议使用安装包一步步安装,这样发现问题可以随时找到问题并解决

对于配置radius文件有两种方法:

A:简单的方法使用glzjin(赵一初心)写好的文件直接覆盖
wget -O /etc/raddb/radiusd.conf
wget -O /etc/raddb/sites-enabled/default
wget -O /etc/raddb/sql/mysql/dialup.conf
wget -O /etc/raddb/dictionary
wget -O /etc/raddb/sql/mysql/counter.conf

新濠国际登录平台,B:详细的手动配置如下
#编辑/usr/local/etc/raddb/radiusd.conf文件

vi /usr/local/etc/raddb/radiusd.conf
查找"allow_vulnerabel_openssl = no"改为yes
查找" $INCLUDE sql.conf”(743行),去掉#号
查找" $INCLUDE sql/mysql/counter.conf”(712行),去掉#号

#清空/usr/local/etc/raddb/sites-enabled/default文件,直接把已经配置好的文件内容复制进去保存
cat /dev/null > /usr/local/etc/raddb/sites-enabled/default
vi /usr/local/etc/raddb/sites-enabled/default

#清空/usr/local/etc/raddb/sites-enabled/inner-tunnel文件,直接把已经配置好的文件内容复制进去保存
cat /dev/null > /usr/local/etc/raddb/sites-enabled/inner-tunnel
vi /usr/local/etc/raddb/sites-enabled/inner-tunnel

#编辑/usr/local/etc/raddb/eap.conf,修改MD5验证方式为peap方式
vi /usr/local/etc/raddb/eap.conf
第30行default_eap_type = md5改为default_eap_type = peap

#编辑/usr/local/etc/raddb/modules/mschap文件,修改为如下内容
vi /usr/local/etc/raddb/modules/mschap
mschap { use_mppe = yes require_encryption = yes require_strong = yes }

#编辑/usr/local/etc/raddb/sql/mysql/dialup.conf文件
vi /usr/local/etc/raddb/sql/mysql/dialup.conf

查找simul_count_query将279-282行注释去掉,打开simul_count_query函数

#编辑/usr/local/etc/raddb/sql/mysql/counter.conf文件,添加自定义计算函数
monthlytrafficcounter(每月计算流量) 和 yearlytrafficcounter(每年计算流量)
vi /usr/local/etc/raddb/sql/mysql/counter.conf

在末尾加入
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 ABS(SUM(acctinputoctets + acctoutputoctets) DIV 1048576) FROM radacct WHERE UserName='%{%k}' AND AcctStartTime >= date_sub(curdate(),interval 30 day)"
}

本文由新濠国际登录平台发布于新闻动态,转载请注明出处:安装LNMP缺少的组件

关键词: