Hi everybody,
this post is similar to a previous one that I had started in the past and that hadn't been answered: http://forums.freebsd.org/showthread.php?t=2978
This time it's more generic. /etc/nsswitch.conf claims to support a 'database -> sources [-> criterion] [->action]' syntax. Entries are given in the following form:
In this example (which is the setup that troubles me, by the way), in the first line the system is instructed to read groups (the group database) from the cache (nscd), if the entry is found there it should stop, otherwise it should continue searching in ldap, if the entry is found it should stop, otherwise it should continue the search in files (usually /etc/group). The same procedure is expected for the passwd database, but for the shells database the system should search only in files.
My problem is that no matter what criteria I use and what actions I perform based on those criteria, some queries are always asked on my ldap backend regardless of the fact that the search was successful on some previous resource. The same applies to files as well; this is not an ldap-centric question. The additional queries asked are related to the groups the user in question belongs to.
For example, if I write:
I get that mamalos belongs to group 513 (whose name and gidNumber are stored in ldap), and to groups 0 and 814 that do not resolve to a group name. The latter groups are stored in my local /etc/group file. What's funny, is that even though nsswitch finds that mamalos belongs to these groups, it somehow refuses to resolve their names...even though the appropriate information is stored in the exact same file 
Now, what troubles me is that I am not sure how to make the search stop in the resource I wish, and hence, how to ensure that nscd will be in charge for answering cached queries and how will I ensure that nsswitch will stop asking further resources for those queries. At the moment, using the aforementioned configuration, when I ask twice about mamalos' id, my ldap.log reads:
which, to my understanding, shows that even though the system should have stopped asking information about mamalos (since the query should have been cached), it doesn't. This way I am not able to minimize ldap traffic by local caching of nsswitch information, which is what I desire.
nscd is running with default configuration, ldap, kerberos, sasl/gssapi support all work like a charm, nss_ldap does its job (thanks to your help guys!), and the only thing that doesn't work -at the moment- is nsswitch.
Thank you all for your time and help in advance,
mamalos
this post is similar to a previous one that I had started in the past and that hadn't been answered: http://forums.freebsd.org/showthread.php?t=2978
This time it's more generic. /etc/nsswitch.conf claims to support a 'database -> sources [-> criterion] [->action]' syntax. Entries are given in the following form:
Code:
group: cache [success=return notfound=continue unavail=continue tryagain=continue] ldap [success=return notfound=return unavail=return tryagain=return] files
passwd: cache [success=return notfound=continue unavail=continue tryagain=continue] ldap [success=return notfound=return unavail=return tryagain=return] files
shells: files
My problem is that no matter what criteria I use and what actions I perform based on those criteria, some queries are always asked on my ldap backend regardless of the fact that the search was successful on some previous resource. The same applies to files as well; this is not an ldap-centric question. The additional queries asked are related to the groups the user in question belongs to.
For example, if I write:
$ id mamalos
Code:
uid=1000(mamalos) gid=513(Domain Users) groups=513(Domain Users),0,814
Now, what troubles me is that I am not sure how to make the search stop in the resource I wish, and hence, how to ensure that nscd will be in charge for answering cached queries and how will I ensure that nsswitch will stop asking further resources for those queries. At the moment, using the aforementioned configuration, when I ask twice about mamalos' id, my ldap.log reads:
Code:
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 fd=23 ACCEPT from IP=192.168.50.29:27734 (IP=0.0.0.0:389)
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=0 BIND dn="" method=163
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=0 RESULT tag=97 err=14 text=SASL(0): successful result:
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=1 BIND dn="" method=163
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=1 RESULT tag=97 err=14 text=SASL(0): successful result:
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=2 BIND dn="" method=163
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=2 BIND authcid="mamalos@EXAMPLE.COM" authzid="mamalos@EXAMPLE.COM"
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=2 BIND dn="uid=mamalos,ou=people,dc=example,dc=com" mech=GSSAPI sasl_ssf=56 ssf=56
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=2 RESULT tag=97 err=0 text=
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=3 SRCH base="ou=Groups,dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup))"
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=3 SRCH attr=cn userPassword memberUid uniqueMember gidNumber
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=3 SEARCH RESULT tag=101 err=0 nentries=21 text=
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=4 SRCH base="ou=Groups,dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup)(gidNumber=0))"
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=4 SRCH attr=cn userPassword memberUid uniqueMember gidNumber
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=4 SEARCH RESULT tag=101 err=0 nentries=0 text=
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=5 SRCH base="ou=Groups,dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup)(gidNumber=814))"
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=5 SRCH attr=cn userPassword memberUid uniqueMember gidNumber
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 op=5 SEARCH RESULT tag=101 err=0 nentries=0 text=
Mar 21 18:57:50 ldap slapd[33005]: conn=1383 fd=23 closed (connection lost)
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 fd=23 ACCEPT from IP=192.168.50.29:53894 (IP=0.0.0.0:389)
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=0 BIND dn="" method=163
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=0 RESULT tag=97 err=14 text=SASL(0): successful result:
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=1 BIND dn="" method=163
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=1 RESULT tag=97 err=14 text=SASL(0): successful result:
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=2 BIND dn="" method=163
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=2 BIND authcid="mamalos@EXAMPLE.COM" authzid="mamalos@EXAMPLE.COM"
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=2 BIND dn="uid=mamalos,ou=people,dc=example,dc=com" mech=GSSAPI sasl_ssf=56 ssf=56
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=2 RESULT tag=97 err=0 text=
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=3 SRCH base="ou=Groups,dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup))"
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=3 SRCH attr=cn userPassword memberUid uniqueMember gidNumber
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=3 SEARCH RESULT tag=101 err=0 nentries=21 text=
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=4 SRCH base="ou=Groups,dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup)(gidNumber=0))"
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=4 SRCH attr=cn userPassword memberUid uniqueMember gidNumber
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=4 SEARCH RESULT tag=101 err=0 nentries=0 text=
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=5 SRCH base="ou=Groups,dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup)(gidNumber=814))"
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=5 SRCH attr=cn userPassword memberUid uniqueMember gidNumber
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 op=5 SEARCH RESULT tag=101 err=0 nentries=0 text=
Mar 21 18:57:53 ldap slapd[33005]: conn=1384 fd=23 closed (connection lost)
nscd is running with default configuration, ldap, kerberos, sasl/gssapi support all work like a charm, nss_ldap does its job (thanks to your help guys!), and the only thing that doesn't work -at the moment- is nsswitch.
Thank you all for your time and help in advance,
mamalos