如何避免将 YubiKey 用户身份硬编码到 PAM 堆栈中?

如何避免将 YubiKey 用户身份硬编码到 PAM 堆栈中?

Yubico PAM 模块似乎需要对每个使用 YubiKey 进行身份验证的用户的 PAM 堆栈进行更改。具体来说,似乎必须先将每个用户的客户端身份添加到正确的 PAM 配置文件中,然后才能对用户进行身份验证。

虽然将授权密钥添加到身份验证数据库(例如/etc/yubikey_mappings或 )是有意义的~/.yubico/authorized_yubikeys,但为每个用户编辑 PAM 堆栈本身似乎是一种不好的做法。我绝对希望避免以这种方式将用户身份硬编码到 PAM 堆栈中。

那么,是否有可能避免硬编码IDpam_yubico.so 模块本身的参数?如果没有,是否有其他 PAM 模块可以利用 YubiKey 身份验证而无需对堆栈进行硬编码?

答案1

这个问题在 SuperUser 上没有得到任何答案。然而,下列答案在 Yubico 支持论坛上收到了:

The id parameter to the PAM module indicates the API key ID, not the
user ID. This ID is returned with the key you get from the "Get API Key"
form if you're using the public service, or it's in the "clients" table
for your internal validation server, along with the API key.

To clarify, when documentation talks about a "client", that's a piece
of software requesting authentication services from the API -- a user
submits an OTP to the client, which submits it to the server in a request
signed with the API key.

答案2

您可以使用 LDAP 来实现这一点,并使用特定的 yubikey 属性或使用现有属性将用户映射到其公共 ID。Yubico PAM 模块可以检查此属性,如果映射验证成功并且已发送正确的 OTP,则模块返回 OK。示例:

# Fetch LDAP password + OTP, verify OTP and move on ('required' control value).
# LDAP password is stripped and passed on.
auth required pam_yubico.so id=1234 ldap_uri=ldaps://fqdn.of.ldap.server:port [ldapdn=ou=People,DC=example,DC=com] user_attr=uid yubi_attr=yubikeyid

您可以yubi_attr使用不同的属性。

相关内容