![freeradius 测试用户失败 条目测试的解析错误(回复):预期行尾或逗号](https://linux22.com/image/116295/freeradius%20%E6%B5%8B%E8%AF%95%E7%94%A8%E6%88%B7%E5%A4%B1%E8%B4%A5%20%E6%9D%A1%E7%9B%AE%E6%B5%8B%E8%AF%95%E7%9A%84%E8%A7%A3%E6%9E%90%E9%94%99%E8%AF%AF%EF%BC%88%E5%9B%9E%E5%A4%8D%EF%BC%89%EF%BC%9A%E9%A2%84%E6%9C%9F%E8%A1%8C%E5%B0%BE%E6%88%96%E9%80%97%E5%8F%B7.png)
我正在尝试使用文件顶部的以下内容授权在默认配置上测试新的 Radius 安装。
head /etc/raddb/mods-config/files/authorize
bob Cleartext-Password := "hello"
Reply-Message := "Hello, %{User-Name}"
test Cleartext-Password := "test"
Reply-Message := "Hello, %{User-Name}
#
# Configuration file for the rlm_files module.
# Please see rlm_files(5) manpage for more information.
这在启动时无法加载。日志的最后几行看起来像这样。
/sbin/radiusd -f -X -x
.....
Wed Aug 16 16:37:38 2017 : Debug: reference = "Accounting-Request.%{%{Acct-Status-Type}:-unknown}"
Wed Aug 16 16:37:38 2017 : Debug: }
Wed Aug 16 16:37:38 2017 : Debug: (Loaded rlm_files, checking if it's valid)
Wed Aug 16 16:37:38 2017 : Debug: # Loaded module rlm_files
Wed Aug 16 16:37:38 2017 : Debug: # Instantiating module "files" from file /etc/raddb/mods-enabled/files
Wed Aug 16 16:37:38 2017 : Debug: files {
Wed Aug 16 16:37:38 2017 : Debug: filename = "/etc/raddb/mods-config/files/authorize"
Wed Aug 16 16:37:38 2017 : Debug: usersfile = "/etc/raddb/mods-config/files/authorize"
Wed Aug 16 16:37:38 2017 : Debug: acctusersfile = "/etc/raddb/mods-config/files/accounting"
Wed Aug 16 16:37:38 2017 : Debug: preproxy_usersfile = "/etc/raddb/mods-config/files/pre-proxy"
Wed Aug 16 16:37:38 2017 : Debug: compat = "cistron"
Wed Aug 16 16:37:38 2017 : Debug: }
Wed Aug 16 16:37:38 2017 : Debug: reading pairlist file /etc/raddb/mods-config/files/authorize
Wed Aug 16 16:37:38 2017 : Error: /etc/raddb/mods-config/files/authorize[5]: Parse error (reply) for entry test: Expected end of line or comma
Wed Aug 16 16:37:38 2017 : Error: Failed reading /etc/raddb/mods-config/files/authorize
Wed Aug 16 16:37:38 2017 : Error: /etc/raddb/mods-enabled/files[9]: Instantiation failed for module "files"
答案1
经过几个小时和大量的谷歌搜索。
我通过仔细查看授权中的行来解决此问题
bob Cleartext-Password := "hello"
Reply-Message := "Hello, %{User-Name}"
test Cleartext-Password := "test"
Reply-Message := "Hello, %{User-Name}
问题是"
我的测试用户缺少尾随。
谷歌搜索错误并没有让我得到任何有用的答案。
Error: /etc/raddb/mods-config/files/authorize[5]: Parse error (reply) for entry test: Expected end of line or comma
我刚刚添加了缺失的内容"
,%{User-Name}"
一切正常。
test Cleartext-Password := "test"
Reply-Message := "Hello, %{User-Name}"
我希望这可以在未来节省一些时间。
$ radtest "test" test 127.0.0.1 1812 testing123
Sent Access-Request Id 25 from 0.0.0.0:59986 to 127.0.0.1:1812 length 74
User-Name = "test"
User-Password = "test"
NAS-IP-Address = 127.0.1.1
NAS-Port = 1812
Message-Authenticator = 0x00
Cleartext-Password = "test"
Received Access-Accept Id 25 from 127.0.0.1:1812 to 0.0.0.0:0 length 33
Reply-Message = "Hello, test"