我已成功针对 Samba 4.5.8 AD 域控制器设置了带有 NTLM-Auth 的 Freeradius 3.0.12。Radtest 在每个用户和正确密码下都能正常工作。当我尝试针对 Freeradius 服务器对 pfSense 上的 OpenVPN 用户进行身份验证时,它很难找到适合该用户的正确 Auth-Type。Freeradius -X 产生以下结果:
(8) Received Access-Request Id 186 from 10.100.0.254:25983 to 10.100.0.32:1812 length 115
(8) NAS-IP-Address = 192.168.1.25
(8) NAS-Identifier = "openVPN"
(8) NAS-Port-Type = Virtual
(8) NAS-Port = 1194
(8) Called-Station-Id = "192.168.1.25:1194"
(8) User-Name = "[email protected]"
(8) User-Password = "XXXXXX"
(8) # Executing section authorize from file /etc/freeradius/3.0/sites-enabled/default
(8) authorize {
(8) policy filter_username {
(8) if (&User-Name) {
(8) if (&User-Name) -> TRUE
(8) if (&User-Name) {
(8) if (&User-Name =~ / /) {
(8) if (&User-Name =~ / /) -> FALSE
(8) if (&User-Name =~ /@[^@]*@/ ) {
(8) if (&User-Name =~ /@[^@]*@/ ) -> FALSE
(8) if (&User-Name =~ /\.\./ ) {
(8) if (&User-Name =~ /\.\./ ) -> FALSE
(8) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/)) {
(8) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/)) -> FALSE
(8) if (&User-Name =~ /\.$/) {
(8) if (&User-Name =~ /\.$/) -> FALSE
(8) if (&User-Name =~ /@\./) {
(8) if (&User-Name =~ /@\./) -> FALSE
(8) } # if (&User-Name) = notfound
(8) } # policy filter_username = notfound
(8) [preprocess] = ok
(8) [chap] = noop
(8) [mschap] = noop
(8) [digest] = noop
(8) suffix: Checking for suffix after "@"
(8) suffix: Looking up realm "samdom.example.com" for User-Name = "[email protected]"
(8) suffix: No such realm "samdom.example.com"
(8) [suffix] = noop
(8) eap: No EAP-Message, not doing EAP
(8) [eap] = noop
(8) [files] = noop
(8) [expiration] = noop
(8) [logintime] = noop
(8) pap: WARNING: No "known good" password found for the user. Not setting Auth-Type
(8) pap: WARNING: Authentication will fail unless a "known good" password is available
(8) [pap] = noop
(8) } # authorize = ok
(8) ERROR: No Auth-Type found: rejecting the user via Post-Auth-Type = Reject
(8) Failed to authenticate the user
(8) Using Post-Auth-Type Reject
(8) # Executing group from file /etc/freeradius/3.0/sites-enabled/default
(8) Post-Auth-Type REJECT {
(8) attr_filter.access_reject: EXPAND %{User-Name}
(8) attr_filter.access_reject: --> [email protected]
(8) attr_filter.access_reject: Matched entry DEFAULT at line 11
(8) [attr_filter.access_reject] = updated
(8) [eap] = noop
(8) policy remove_reply_message_if_eap {
(8) if (&reply:EAP-Message && &reply:Reply-Message) {
(8) if (&reply:EAP-Message && &reply:Reply-Message) -> FALSE
(8) else {
(8) [noop] = noop
(8) } # else = noop
(8) } # policy remove_reply_message_if_eap = noop
(8) } # Post-Auth-Type REJECT = updated
(8) Delaying response for 1.000000 seconds
我尝试了用户名中包含和不包含域的情况,结果日志没有变化。freeradius 服务器的配置如下所述:http://deployingradius.com/documents/configuration/active_directory.html
我读到设置默认 Auth-Type 不是一个好主意,因为它会破坏任何其他形式的身份验证。我还想使用服务器进行 WiFi 身份验证,因此至少需要 PEAP-MSCHAPv2 才能工作。
答案1
在上面的例子中,您使用的是 PAP 而不是 PEAP。没有模块会自动将 ntlm_auth 设置为身份验证类型,因此您需要在策略语言中执行此操作,即
authorize {
if (&User-Password) {
update control {
Auth-Type := ntlm_auth
}
}
eap
}