#3193 [RFE] Support aliases in the memory cache
Opened 2 years ago by sbose. Modified 2 years ago

Name based NSS lookup will consult the memory cache before connecting to SSSD. The can be seen by looking for the connect() call with strace:

[root@sssd-devel ~]# systemctl stop sssd.service ; rm -f /var/lib/sss/db/* ; rm -f /var/log/sssd/* ; systemctl start sssd 
[root@sssd-devel ~]# strace -e connect -f getent passwd cu1@ChIlD.ad.devel
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
cu1@ChIlD.ad.devel:*:1296801104:1296800513:c u:/home/ChIlD.ad.devel/cu1:/bin/bash
+++ exited with 0 +++
[root@sssd-devel ~]# strace -e connect -f getent passwd cu1@ChIlD.ad.devel
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
cu1@ChIlD.ad.devel:*:1296801104:1296800513:c u:/home/ChIlD.ad.devel/cu1:/bin/bash
+++ exited with 0 +++

In this first run SSSD is connected via /var/lib/sss/pipes/nss while the second run gets the data from the memory cache without connecting to SSSD.

Currently the entry in the memory cache can be found by the name which is returned by getpwnam() (this first component in the getent passwd output). It has to be exactly this name otherwise the name will not be found. E.g. if the backend is case-insensitive like e.g. AD requests which differ in case always have to connect to SSSD:

[root@sssd-devel ~]# strace -e connect -f getent passwd cu1@child.ad.devel                                                                                                                                                                    
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
cu1@ChIlD.ad.devel:*:1296801104:1296800513:c u:/home/ChIlD.ad.devel/cu1:/bin/bash
+++ exited with 0 +++
[root@sssd-devel ~]# strace -e connect -f getent passwd cu1@child.ad.devel
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
cu1@ChIlD.ad.devel:*:1296801104:1296800513:c u:/home/ChIlD.ad.devel/cu1:/bin/bash
+++ exited with 0 +++

Additionally lookups by UPNs, email address or aliases cannnot use the memory cache either:

[root@sssd-devel ~]# strace -e connect -f getent passwd cu1@alt.alt
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
cu1@ChIlD.ad.devel:*:1296801104:1296800513:c u:/home/ChIlD.ad.devel/cu1:/bin/bash
+++ exited with 0 +++
[root@sssd-devel ~]# strace -e connect -f getent passwd cu1@alt.alt
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
cu1@ChIlD.ad.devel:*:1296801104:1296800513:c u:/home/ChIlD.ad.devel/cu1:/bin/bash
+++ exited with 0 +++

Lukas had an idea how to solve the case sensitivity issue with memcache, but it would be good to wait with the implementation until we have PAM wrapper, because there are some special operations with memcache that we do during user authentication and it would be good to cover it with upstream tests when we do significant changes to memcache.

pam_wrapper patches are on the list, they "just" need some fixing and more review. But since we already plan on looking at the memory cache code in 1.16 to implement by-SID cache, I think it makes sense to file this ticket into the same milestone.

milestone: NEEDS_TRIAGE => SSSD 1.16

Fields changed

rhbz: => todo

Fields changed

milestone: SSSD 1.16 => SSSD Future releases (no date set yet)

Metadata Update from @sbose:
- Issue set to the milestone: SSSD Future releases (no date set yet)

2 years ago

Login to comment on this ticket.

Metadata