通过Freeradius使用我们自己的2FA应用程序执行2FA

问题描述 投票:0回答:1

某些数据触发:

  • Freeradius v3.0.17
  • 作为LDAP的Active Directory
  • 由我们自己开发的OTP应用程序

我们想要通过Freeradius实现2FA。我们正在针对MS AD使用ntlm_auth进行身份验证,另一方面,我们拥有自己的OTP脚本(正在另一种解决方案中工作)。首先,我们有一个将USER和Token分开的策略,例如-> username:OTP。可以了在“默认站点”上的“授权”部分的顶部调用此过程。

on policy.d/pol_usernamemultiotp.authorize:

pol_usernamemultiotp.authorize {
if ( &User-Name =~ /^(.*):([0-9]{6})$/) {
                update request {
                        Stripped-User-Name := "%{1}"
                        User-OTP := "%{2}"
                }
        }
}

ntlm_auth运行正常。当我们在“默认”的“授权”部分中添加下一个代码时,身份验证将跳至Auth-Type:= LDAP,并且不会通过ntlm_auth进行操作。

    update control {
          Auth-Type := `/bin/bash /etc/freeradius/3.0/otpIB.sh '%{Stripped-User-Name}' '%{User-OTP}' '%{Client-IP-Address}'`
   }

   (this script returns "Accept" or "Reject" depending if the OTP is correct.)

我们也尝试将此更新控件放在“默认”的“验证后”部分。但是,这是问题所在。让我们向您展示de Freeradius -X日志

(0) mschap: Program returned code (0) and output 'NT_KEY: C1964544A5B93877F0D3FE7D9E5791D0'
(0) mschap: Adding MS-CHAPv2 MPPE keys
(0)     [mschap] = ok
(0)   } # authenticate = ok
(0) # Executing section post-auth from file /etc/freeradius/3.0/sites-enabled/default
(0)   post-auth {
(0)     update control {
(0)       Executing: /bin/bash /etc/freeradius/3.0/otpIB.sh '%{Stripped-User-Name}' '%{User-OTP}' '%{Client-IP-Address}':
(0)       EXPAND %{Stripped-User-Name}
(0)          --> fdelfranco
(0)       EXPAND %{User-OTP}
(0)          --> 770355
(0)       EXPAND %{Client-IP-Address}
(0)          --> 10.40.9.3
(0)       Program returned code (0) and output 'Reject'
(0)       Auth-Type := Reject
(0)     } # update control = noop
(0)     update {
(0)       No attributes updated
(0)     } # update = noop
(0)     policy remove_reply_message_if_eap {
(0)       if (&reply:EAP-Message && &reply:Reply-Message) {
(0)       if (&reply:EAP-Message && &reply:Reply-Message)  -> FALSE
(0)       else {
(0)         [noop] = noop
(0)       } # else = noop
(0)     } # policy remove_reply_message_if_eap = noop
(0)   } # post-auth = noop
(0) Sent Access-Accept Id 195 from 10.40.9.99:1812 to 10.40.9.3:21481 length 0
(0)   MS-CHAP2-Success 0xf9533d36433832463034413330323043344533314246333736383533364234324641453142383843383145
(0)   MS-MPPE-Recv-Key = 0x66e467b713b84475fa5ed19d93207ef3
(0)   MS-MPPE-Send-Key = 0x75f6cbee712186fe6ebeca98ea9ab063
(0)   MS-MPPE-Encryption-Policy = Encryption-Allowed
(0)   MS-MPPE-Encryption-Types = RC4-40or128-bit-Allowed
(0) Finished request

NTLM_AUTH可以正常工作,并且给出和Access-Accept,完全忽略脚本和Auth-Type:=拒绝返回!

为什么半径忽略脚本中的“拒绝”状态并授权用户?

一些建议?

编辑:

[今天,我们成功地使这件事情毫无挑战地工作了,但是却在努力。我们像创建一种新的Auth Type一样创建新的Auth Type,并在其中放置策略,当我们创建Authorize参与者时,它将在Defaul文件的Authenticate部分中调用此伪Auth Type,然后在调用它之后对我们的自己的政策,我们已经指出了我们自己的shell脚本,该脚本可以正确进行一次性密码验证。

与Cisco VPN客户端,Forti客户端和IPSEC的Mac OS本机客户端配合使用时效果很好。

一些数据激发:Freeradius v3.0.17 Active Directory作为我们自己开发的LDAP OTP应用程序,我们想要实现的是通过Freeradius实现2FA。我们正在使用针对MS AD的ntlm_auth身份验证...

freeradius one-time-password
1个回答
0
投票

[Auth-Type必须设置为reply,而不是control

© www.soinside.com 2019 - 2024. All rights reserved.