大网数据广告活动
服务器运维问答

SSSD with e-mail address LDAP usernames

· 52CE 我爱测

I have a small SFTP server setup using SSSD to authenticate users via LDAP using SSH keys. This works completely fine for basic usernames (i.e "ausername") but I've been requested to make a change so users login with their email …

问题原文

原帖链接 · Ashley Kell · CC BY-SA 4.0

I have a small SFTP server setup using SSSD to authenticate users via LDAP using SSH keys. This works completely fine for basic usernames (i.e "ausername") but I've been requested to make a change so users login with their email addresses instead, these could be from any domain.

On first login attempt as "[email omitted]"; SSSD fetches the email address user just fine and drops it in the local database along with the public key, originalDn and everything else. Now my issue is that the login then fails and the user can't login. In the logs I get the error:

AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys [email omitted] failed, status 1

If I try run the command manually on the host I get:

Error looking up public keys

A "getent passwd [email omitted]" returns what I'd expect to see.

I guess its something to do with the local DN for the user being set to "[email omitted]@ldap" and SSSD is failing to fetch the sshPublicKey from its own DB? But attempting to login as "[email omitted]@ldap" or use the above commands to test manually also fails. I'm stumped as to how to get past this.

Here's my SSSD config

[sssd]
config_file_version = 2
services = nss, pam, ssh, sudo
# Number of times services should attempt to reconnect in the event of a Data Provider crash
reconnection_retries = 3

domains = LDAP
full_name_format = %1$s

###########
### NSS ###
###########
[nss]
override_homedir = LDAP_HOMEDIR
homedir_substring = /

memcache_timeout = 600

###########
### PAM ###
###########
[pam]

###################
### LDAP DOMAIN ###
###################
[domain/LDAP]
id_provider = ldap
auth_provider = ldap
ldap_tls_reqcert = allow
debug_level = 10
ldap_uri = LDAP_URI
ldap_search_base = LDAP_BASE_ROOT
ldap_user_ssh_public_key = sshPublicKey
cache_credentials = true

ldap_id_use_start_tls = true

Any help appreciated.

已采纳解答

原帖链接 · Ashley Kell · CC BY-SA 4.0

If anyone comes across this in the future I managed to solve this about 10 minutes after posting which was about 10 hours into trying to figure this one out. Under your domain config in sssd.conf add:

re_expression = (?P<name>.+)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-01-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。