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

Can SSSD authenticate via LDAP with anonymous binding either forbidden in ACLs and with 'olcRequires: authc' enforced?

· 52CE 我爱测

I manage a LAN with a list of users accessing their NFS-shared homes while being auhtenticated via NIS/YP (CentOS/Fedora-based clients and servers). I'm in the painful process of migrating out of NIS/YP (which is slowly but irrev…

问题原文

原帖链接 · Francesco · CC BY-SA 4.0

I manage a LAN with a list of users accessing their NFS-shared homes while being auhtenticated via NIS/YP (CentOS/Fedora-based clients and servers).

I'm in the painful process of migrating out of NIS/YP (which is slowly but irreversibily being phased out on Red Hat and the like) to what seemed the least-difficult-to-setup replacement for the authenticating part, SSSD (for the clients) and LDAP (for the user database on the servers).

After a number of trials, I've reached what seems an acceptably working setup and started considering a hardening of security but there is something that keeps eluding me.

Mostly everywhere, standard ACLs for querying an LDAP database in order to authenticate users that are logging in are something of this sort:

olcAccess: {0}to attrs=userPassword by self write by anonymous auth by * none
olcAccess: {1}to attrs=shadowLastChange by self write by * read
olcAccess: {2}to * by * read

and everything works without problems.

Since I'd rather not let users peek into each other's records, I modified the last one to:

olcAccess: {2}to * by * none

Then I found the 'olcRequires: authc' that should disable anonymous bindings to LDAP (seems an improvement in security, no?) and enabled it, and everything seems to keep working.

Then again, looking at the first ACL, you see that anonymous authentication against a user password is still authorized (which seems redundant if the previous rule is in effect) and I tried removing it:

olcAccess: {0}to attrs=userPassword by self =wx by * none

and nothing works anymore.

Keeping on reading, I found the catch to be that SSSD must be able to minimally query the database in order to retrieve enough structure to convert an username like 'foo' into an LDAP Distinguished Name as 'uid=foo,ou=People,dc=example,dc=com' that LDAP is then able to process.

I understand that SSSD is able to use a 'proxy user' to do just that, so I added such a user in my database, configured SSSD to use it:

ldap_default_bind_dn = cn=autobind,dc=example,dc=com
ldap_default_authtok = verysecretpassword

and, I thought, I added the necessary ACLs to let it just do its work:

olcAccess: {0}to attrs=userPassword by self =wx by dn="cn=autobind,dc=example,dc=com" =x by * none
olcAccess: {1}to attrs=shadowLastChange by self write by dn="cn=autobind,dc=example,dc=com" read by * none
olcAccess: {2}to * by dn="cn=autobind,dc=example,dc=com" read by * none

Needless to say, it does not work - not only to login, which could very well be SSSD being misconfigured, but the database itself becomes unqueriable returning error 49 (Invalid credentials) even via ldapsearch.

Re-adding by anonymous auth makes it work again; obviously, there is something I'm not getting correctly.

I understand it does not seem like a big deal, apart from that 'anonymous' appearing within my ACLs that irks me very much but does not appear to be able to access anything of importance.

So, my questions are: is it a more secure configuration one where 'anonymous' access is completely removed in the ACLs for my LDAP user database, eventually replacing its necessary functions with those of a proxy user specific to SSSD usage? If not, what would you do to further harden security?

已采纳解答

原帖链接 · u1686_grawity · CC BY-SA 4.0

one where 'anonymous' access is completely removed in the ACLs for my LDAP user database, eventually replacing its necessary functions with those of a proxy

In this case, no. You can disallow all read/search operations for anonymous connections and have SSSD bind to the machine account before it performs the user search (I use Kerberos for this, SSSD automatically picks up /etc/krb5.keytab), but anonymous clients still need auth rights at minimum.

More specifically, by anonymous auth is necessary in OpenLDAP ACLs for the initial "simple" bind to work, because the connection performing the bind is, still, in anonymous state until after the bind succeeds.

So if you define a "proxy" account, you're just shifting the problem a bit but not actually changing it – an anonymous connection still needs 'auth' rights in order to bind as the proxy account. Or in other words, if you require the client to be already authenticated in order to authenticate, then how is it going to authenticate as the proxy account in the first place?


Also, I wouldn't usually use olcRequires: authc globally for the reason that it prevents reading of the rootDSE entry (null DN), which is how clients discover what authentication mechanisms are available on the server, as well as whether StartTLS is available (if port 636 isn't being used). By preventing anonymous connections from reading attributes on the null DN you're likely to break SASL authentication (e.g. Kerberos/GSSAPI) and limit yourself to password-based 'simple bind' only.

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

资料来源与适用范围

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

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

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