openwrt路由器搭建EAP热点
首页 > Openwrt   作者:皮皮华  2023年10月29日 18:12 星期日  热度:451°  字号:   评论:0 条
时间:2023-10-29 18:12   热度:451°  评论:0 条 

最近需要搭个802.1x-EAP认证 WIFI环境,就研究了下Openwrt

首先在系统包安装freeradius3

opkg install freeradius3 freeradius3-default freeradius3-utils

/etc/freeradius3/mods-config/files/authorize

这个配置文件是用来配置最终用户的用户名和密码,默认已经提供了一些样例用户名和密码,这里我们使用最简单的bob,把这两行的注释去掉。然后可以再追加,例如创建一个xgdct的账户,密码相同。

 bob     Cleartext-Password := "hello"
         Reply-Message := "Hello, %{User-Name}"
 xgdct     Cleartext-Password := "xgdct"
         Reply-Message := "Hello, %{User-Name}"
执行radiusd -X指令发现有以下报错
Errors reading or parsing /etc/freeradius3/sites-enabled/default[1054]: (EAP-Key-Name && &reply:EAP-Session-Id) { 

Errors reading or parsing /etc/freeradius3/sites-enabled/default[1054]: ^ Expected a module return code 

Errors reading or parsing /etc/freeradius3/radiusd.conf

将这几行直接注释掉


 
 #if (EAP-Key-Name && &reply:EAP-Session-Id) {   
 #    update reply {   
 #        &EAP-Key-Name := &reply:EAP-Session-Id   
 #    }   
 #}
继续执行radiusd -X还是错,直接在下面的路径新建一个coa的文件

Couldn't open /etc/freeradius3/mods-config/attr_filter/coa for reading: No such file or directory
Errors reading /etc/freeradius3/mods-config/attr_filter/coa
/etc/freeradius3/mods-enabled/attr_filter[58]: Instantiation failed for module "attr_filter.coa"


最后执行指令显示Ready to process requests表示Radius 认证服务器启动成功


我们输入以下指令测试账号密码是否对


radtest bob hello 127.0.0.1 0 testing123
Sent Access-Request Id 252 from 0.0.0.0:56165 to 127.0.0.1:1812 length 73
        User-Name = "bob"
        User-Password = "hello"
        NAS-IP-Address = 192.168.4.1
        NAS-Port = 0
        Message-Authenticator = 0x00
        Cleartext-Password = "hello"
Received Access-Accept Id 252 from 127.0.0.1:1812 to 127.0.0.1:56165 length 32
        Reply-Message = "Hello, bob"

如果显示Received Access-Accept则表示配置成功

试用以下指令查看1812端口是否正常启动

    lsof -i:1812

    radiusd 2587 root    8u  IPv4   4012      0t0  UDP *:radius
    radiusd 2587 root   10u  IPv6   4014      0t0  UDP *:radius


    hostapd 3167 root   21u  IPv4   5132      0t0  UDP localhost:39351->localhost:radius



最后执行以下指令设置开机自启

radiusd enable

radiusd start



当我们需要测试将指定设备踢出可以发送以下指令

iw dev wlan1 station del 0A:4E:B0:20:A3:47 subtype 0xC reason-code 17

        指令描述如下

        dev <devname> station del <MAC address> [subtype <subtype>] [reason-code <code>]
                Remove the given station entry (use with caution!)
                Example subtype values: 0xA (disassociation), 0xC (deauthentication)


试用 logread -f 指令可以实时查看设备连接情况的日志


参考文章:

https://blog.csdn.net/u014572382/article/details/79108093/

https://zhuanlan.zhihu.com/p/495108853


 您阅读这篇文章共花了: 
捐赠支持:如果觉得这篇文章对您有帮助,请“扫一扫”鼓励作者!
 本文无需标签!
二维码加载中...
本文作者:皮皮华      文章标题: openwrt路由器搭建EAP热点
本文地址:http://huazai.eleuu.com/?post=69
版权声明:若无注明,本文皆为“皮皮华博客”原创,转载请保留文章出处。

发表吐槽

你肿么看?

你还可以输入 250 / 250 个字

嘻嘻 大笑 可怜 吃惊 害羞 调皮 鄙视 示爱 大哭 开心 偷笑 嘘 奸笑 委屈 抱抱 愤怒 思考 日了狗

评论信息框


既然没有吐槽,那就赶紧抢沙发吧!