NSS library for ncpfs

A name switching service to extent local user's database with NDS accounts

Purpose:

  • In our environnment, Linux accounts are authenticated using the PAM_NCP authentification module and have their Unix home on Linux NFS servers. Home directories are automatically created by Perl scripts ( see for example the option -F of nds2pwd.pl) This requires that users have the very same Unix ID on every workstation and that ID matches the ID used on the NFS servers when creating the home directory.

  • Our current solution is to use the PAM module in " NDS required mode "(option -u,,r,gcds ) with eventual creation of local account (-a) but not of the home directory that must exist on the NFS server ( -n -l) and to keep in the Location attribute of NDS the two critical informations (U:UnixID and H:/path/to/linux/home)

  • To speed up "automagic account creation", all workstations runs within daily cron the script nds2pwd.pl to keep the user local database in sync with NDS; so the PAM module will only autocreate the new accounts of the day.

  • A much better solution would be to have a Name Switch Service library the will automatically append NDS accounts (under the standard Unix format) to local accounts, like nss_ldap or nss_nis do .This library do exists with the official Novell Netware client for Linux (with eDirectory) , but is not available with the previous version of NDS we are still running here.

  • This contribution is a beta version of such a service. We use it here on the Linux NFS servers for homes and and some Web Servers but not yet on every client workstation (see the TODO section).

  • Like the PAM module it honors the official NDS8 Unix attributes if present in NDS schema, else it searchs for Unix data in user's L (Location) attribute.

    Requirements:

    Usage:

    Some real life examples:

  • [root@prope ncp_nss_lib]#getent passwd should give you all local accounts, then, all NDS Unix enabled accounts (if doPasswd=1 in /etc/ncpfs.conf) and maybe all your LDAP accounts
  • [root@prope ncp_nss_lib]#getent shadow should give you all local accounts, then, all NDS Unix enabled accounts (if doShadow=1 in /etc/ncpfs.conf) and maybe all your LDAP accounts Please note that NDS password is not retrieved (it cannot be) so the PAM module is still needed for authentification. We do want central password managment and Single-Sign-On, do we ?
  • [root@prope ncp_nss_lib]#getent group should give you all local groups, then, all NDS Unix enabled groups [having a G:nnnn in NDS location attribute and eventually a Unix alias as N:unixGroupName ] (if doGroup=1 in /etc/ncpfs.conf) and maybe all your LDAP groups
  • [root@prope ncp_nss_lib]# getent passwd jdupond. No answer such user does not exist in NDS
  • [root@prope ncp_nss_lib]# getent passwd edvorakova ->edvorakova:x:11029:100:Eva Dvorakova:/cipc/eurinsa/2020931:/bin/bash
  • [root@prope ncp_nss_lib]# getent shadow edvorakova ->edvorakova:!!:12106:90:90:6:12340:12262:

    Download:

    History:

           1.00    2003, January 06        Patrick Pollet 
                    initial release
            1.01    2003, January 08        Patrick Pollet 
                    added conf structure and control group
                    added optional fallback UID and GID if none found in NDS (default is to skip user,group)
            1.02    2003, January 09        Patrick Pollet 
                    added initgroups
            1.03    2003, January 10        Patrick Pollet 
                    fixed bug in nds_user_info2 (bad structure received by nds_user_location2)
            1.04    2003, January 11        Patrick Pollet 
                    fixed setting ndsXXX=NULL trees in case of errors in _nss_ncp_setxxent()
                    made always NAME_CONTEXT=[Root] in CreateContextAndConn
                    calling NWCCloseIteration only it some errors has occured in the search
            1.05    2003, January 15        Patrick Pollet 
                    -Avoid multiple reading of conf file by removing recursive calls
                    in nss_ncp_getxxent_r in case a entry has no Unix infos in NDS
                    (replaced by a goto nextuser)
                    -Added missing free_nw_xxx_info when leaving nss_ncp_getxxent_r (fixed memory leaks)
                    -Added testing for failure in allocating tree structure in nss_ncp_setxxent_r
                    -if (id !=(uid_t)-1)  and not if (id) in getentxx if we search by UID !!!!
                    -getentbyxx give a warning in syslog if more that one entry match the name or id search criteria
            1.06    2003, January 16        Patrick Pollet 
                    -implemented reading of configuration file in /etc/nss_ncp.conf
                    -in case of fatal errors, force log in syslog by using calls to traceForce ( previously fatal
                    errors were only reported in debug mode, since the syslog file is not opened in normal mode)
            1.07    2003, January 16        Patrick Pollet 
                    Speed up the search:
                            1)config informations are stored in the internal trees structures
                            when calling nss_ncp_setxxent_r and freed by nss_ncp_endxxent_r
                            so we don't read again config file at every call to nss_ncp_getxxent_r
                            2) group infos are really slow with big groups,so we added a flag doGroup in conf file
                            to skip the search (easier that to edit /etc/nsswitch.conf AND restarting nscd daemon).
    
    TODO:


    Vous êtes notre Counter (Security) eme visiteur