通过REST + MSCHAPv2进行的Freeradius身份验证

问题描述

我正在尝试配置Freeradius进行REST调用以验证内部隧道中的用户

在没有REST调用的情况下,我在bob文件中有用户users和条目

bob    Cleartext-Password := "test"

当测试用户尝试进行身份验证时,它本身可以按预期工作。

现在,我已配置REST端点以返回json:

{
  "Cleartext-Password": "test"
}

并且我已经更改了内部隧道中的配置:

authorize {
  ...
  rest
  # files
  ...
}

authenticate {
  ...
  Auth-Type MS-CHAP {
    mschap
  }
  Auth-Type rest {
    rest
  }
  ...

此操作失败,相关日志为:

2020-09-22T16:14:30.698-04:00   (7) rest: Status : 200 (OK)
2020-09-22T16:14:30.698-04:00   (7) rest: Type : json (application/json)
2020-09-22T16:14:30.698-04:00   (7) rest: Parsing attribute "Cleartext-Password"
2020-09-22T16:14:30.698-04:00   (7) rest: EXPAND test
2020-09-22T16:14:30.698-04:00   (7) rest: --> test
2020-09-22T16:14:30.698-04:00   (7) rest: Cleartext-Password := "test"
2020-09-22T16:14:30.703-04:00   (7) [rest] = updated
2020-09-22T16:14:30.703-04:00   (7) [expiration] = noop
2020-09-22T16:14:30.703-04:00   (7) [logintime] = noop
2020-09-22T16:14:30.703-04:00   (7) [pap] = noop
2020-09-22T16:14:30.703-04:00   (7) } # authorize = updated
2020-09-22T16:14:30.703-04:00   (7) Found Auth-Type = mschap
2020-09-22T16:14:30.703-04:00   (7) # Executing group from file /etc/freeradius/sites-enabled/inner-tunnel
2020-09-22T16:14:30.703-04:00   (7) authenticate {
2020-09-22T16:14:30.703-04:00   (7) mschap: WARNING: No Cleartext-Password configured. Cannot create NT-Password

我敢肯定,我在这里想念的很简单,但是我是一个半径菜鸟,这是我通过摆弄得到的。

解决方法

发现了问题!显然,返回的json需要细微调整。

代替:

{
    "Cleartext-Password": "test",}

应该是:

{
    "control:Cleartext-Password": "test",}

我发现这隐藏在对相关问题(https://stackoverflow.com/a/57662829/2345647)的回答中

如果有人可以指出我的文件,甚至可以解释原因,那么我会努力地支持您。