Linux

freeradius 測試使用者失敗 進入測試的解析錯誤(回复):預期的行尾或逗號

  • April 2, 2019

我正在嘗試在我的文件頂部使用以下內容授權在預設配置上測試新的半徑安裝。

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"

經過幾個小時和大量的Google搜尋。

我通過更仔細地查看我的授權中的行來解決這個問題

bob Cleartext-Password := "hello"
   Reply-Message := "Hello, %{User-Name}"

test    Cleartext-Password := "test"
   Reply-Message := "Hello, %{User-Name}

"問題是我的測試使用者缺少尾隨。

Google搜尋錯誤並沒有讓我得到任何有用的答案。

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"

引用自:https://unix.stackexchange.com/questions/386487