0

我想用密码 + google_otp 登录到我的 vpn 服务。freeradius 作为身份验证服务器,ldap 作为 backend_database。

我已经完成了以下工作:</p>

  1. 在 /etc/raddb/sites-enabled/default 中启用 pam 身份验证模块
  2. 在 /etc/raddb/users 添加一行“DEFAULT Auth-Type := PAM”
  3. 启用 ldap 模块并将 ldap 站点添加到 freeradis,我确认 raidus 使用 ldap 数据库工作正常。
  4. 覆盖 /etc/pam.d/radiusd 的内容
验证必需 pam_google_authenticator.so secret=/tmp/.google_authenticator user=root forward_pass
需要验证 pam_unix.so use_first_pass  

运行测试cmd:(testpa是我的密码,271082是otp)

radtest perlingzhao testpa271082 localhost 1812 testing123

半径日志:

(0)     [pap] = noop
(0)   } # authorize = updated
(0) Found Auth-Type = pam
(0) # Executing group from file /etc/raddb/sites-enabled/default
(0)   authenticate {
(0) pam: Using pamauth string "radiusd" for pam.conf lookup
(0) pam: ERROR: pam_authenticate failed: User not known to the underlying authentication module
(0)     [pam] = reject
(0)   } # authenticate = reject
(0) Failed to authenticate the user
(0) Using Post-Auth-Type Reject

登录 /var/log/secure:

radiusd(pam_google_authenticator)[11728]: Accepted google_authenticator for perlingzhao
pam_unix(radiusd:auth): check pass; user unknown
pam_unix(radiusd:auth): authentication failure; logname=root uid=0 euid=0 tty= ruser= rhost=

我知道这是因为没有本地用户,用户信息在 ldap 中。

任何人都可以帮助我,告诉我如何配置可以解决这个问题,谢谢。

4

1 回答 1

1

我可以建议使用 PHP 脚本进行 OTP 验证而不是 PAM 模块,它不会创建真正的本地用户,而只会验证 TOTP 本身。PHP 也有 LDAP 功能。

authorize{
    update control { 
        Auth-Type := `/usr/bin/php -f /etc/raddb/yourscript.php '%{User-Name}' '%{User-Password}' '%{Client-IP-Address}'`
    }

有一种商业产品似乎可以完全满足您的要求。

PS我隶属于#1

于 2018-12-28T12:30:30.430 回答