freeradius 测试用户失败 条目测试的解析错误(回复):预期行尾或逗号

freeradius 测试用户失败 条目测试的解析错误(回复):预期行尾或逗号

我正在尝试使用文件顶部的以下内容授权在默认配置上测试新的 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"

相关内容