|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
routeros配置注意以下两条:/radius add service=hotspot address=x.x.x.x secret=ex/ip hotspot aaa set use-radius=yesXTRadius+MySQL服务器配置:#cat /etc/raddb/usersDEFAULT Auth-Type = External Exec-Program-Wait = "/usr/local/bin/chap", Fall-Through = 0#cat /usr/local/bin/chap#!/usr/bin/perl use Digest::MD5 qw(md5);use DBI; my $user=$ENV{'User-Name'}; my $dbh = DBI->connect("dbi:mysql:accounting","root","pppoe");my $sth = $dbh->prepare("select * from users where login = '$user'");$sth->execute;my $ref = $sth->fetchrow_hashref(); my $Plain_Password=$ref->{'passwd'};my $CHAP_Password=$ENV{'CHAP-Password'};my $CHAP_Challenge=$ENV{'CHAP-Challenge'}; # just one function callif (RADIUSCHAPCheck($CHAP_Challenge,$CHAP_Password,$Plain_Password)){ exit 0;# print "Success";}else{ exit 255;# print "Failed";} # RADIUSCHAPCheck($CHAP_Challenge,$CHAP_Password,$Plain_Password)sub RADIUSCHAPCheck{ my ($CHAP_Challenge,$CHAP_Password,$Plain_Password)=@_[0,1,2]; my @BCHAP_Password=unpack ('A2'x(length($CHAP_Password)/2),$CHAP_Password); my $CHAP_ID=chr(hex($BCHAP_Password[0])); $CHAP_Password=''; for($i=1;$i |
|