路由器authpuppy和wifidog网页认证

2017-12-18  本文已影响0人  王学长1600

前言:之前我设置的路由器设置好了radius认证,现在来利用openwrt+anthpuppy+wifidog来实现用户接入路由需要认证服务器弹出认证界面的目的

首先路由器上先添加接口

然后在接口里设置地址,地址可以随便设置

接下来是配置服务器的步骤

步骤:

1:首先在服务器上安装开发环境,安装mysql-server的过程中会设置密码

apt-get install apache2 php-mysql libapache2-mod-php mysql mysql-server

2:启用a2enmod rewrite

3:将下载好的authpuppy-1.0.0-stable.tgz拷贝到虚拟机(可以去官网下载)

tar -zxvf authpuppy-1.0.0-stable.tgz

mv authpuppy /var/www/html/authpuppy

chmod 777 /var/www/html/authpuppy -R

4:修改/etc/apache2/sites-enabled/000-default.conf替换所有内容

vim /etc/apache2/sites-enabled/000-default.conf ------------(:%d可以全部删除),将里面的代码替换为

直接传代码不会自动换行,所以只好传图片

5:创建authpuppy数据库:mysqladmin -uroot -p create authpuppy

其中manage nodes是设置节点,user是设置用户

这个选择Deployed,然后save。

接下来去User里设置用户。

authpuppy服务器的设置到此就差不多了,自己需要修改其他东西可以自行修改

7:安装wifidog,ssh进入路由器,命令行输入

opkg update

opkg install wifidog   

vim /etc/wifidog.conf

也可以直接复制源码

PS:可以直接将下列代码替换wifidog.conf里面的内容,修改里面的GatewayIDdefault,ExternalInterface,GatewayInterface 和服务器的IP就行了

源码:

GatewayIDdefault #注意这个ID必须跟AuthPuppy的GW ID一致

# Parameter: ExternalInterface

# Default: NONE

# Optional

#

# Set this to the external interface (the one going out to the Inernet or your larger LAN).

# Typically vlan1 for OpenWrt, and eth0 or ppp0 otherwise,

# Normally autodetected

ExternalInterface eth0      #路由器外网的物理接口

# Parameter: GatewayInterface

# Default: NONE

# Mandatory

#

# Set this to the internal interface (typically your wifi interface).

# Typically br-lan for OpenWrt, and eth1, wlan0, ath0, etc. otherwise

GatewayInterface wlan0      #路由器内网的物理接口

AuthServer {

Hostname 192.170.1.104    #authpuppy服务器的IP

SSLAvailable no

Path /

}

CheckInterval 60

ClientTimeout 5

FirewallRuleSet global {

}

FirewallRuleSet validating-users {

FirewallRule allow to 0.0.0.0/0

}

FirewallRuleSet known-users {

FirewallRule allow to 0.0.0.0/0

}

FirewallRuleSet unknown-users {

FirewallRule allow udp port 53

FirewallRule allow tcp port 53

FirewallRule allow udp port 67

FirewallRule allow tcp port 67

}

FirewallRuleSet locked-users {

FirewallRule block to 0.0.0.0/0

}

PS:测试 wifidog 时,应该直接运行 /usr/bin/wifidog -s -f 这样 wifidog 会显示给你详细的运行日志。对于排错非常有用...

8:用手机打开浏览器连接无线就会弹出认证界面了

上一篇下一篇

猜你喜欢

热点阅读