0. What's it about?
-------------------------------------------------------------

This is a so called Name Service Switch (NSS) Module for use with glibc.
With it you can replace /etc/passwd, /etc/shadow, /etc/group etc. with
a PostgreSQL database. Note that you need another piece of software, a
plugin to the Pluggable Authentication Modules (PAM) that lets you
authenticate against this database. It is available from

  http://pgfoundry.org/projects/sysauth

1. Prerequisites
-------------------------------------------------------------

You will a current glibc (I tested on 2.3) and at least the PostgreSQL
client library (libpq, version 7.4 or higher) on your system to use this
module. Systems tested:

 - Gentoo GNU/Linux
   libpq MUST be compiled with thread-safety
 - Debian GNU/Linux 3.0 aka woody
   just 'apt-get install libnss-pgsql1' from unstable :)
 - Ubuntu 5.10 Breezy
   just 'apt-get install libnss-pgsql1' from universe

2. Installation
-------------------------------------------------------------

If you install from sources, follow these steps (general installation
instructions on how to use the configure script, make and such can be
found in the file INSTALL):

 - Find the place where files called libnss_*.so are installed on
   your system. In Debian this is /lib so I will use this.

 - Decide where to put the configuration file. It is called nss-pgsql.conf
   and I have it in /etc

 - Run configure. My setup looks like this (note the paths):

   ./configure --libdir=/lib --sysconfdir=/etc

 - If configure doesn't complain about anything, you can type
   'make' to compile the module

 - As root type 'make install' to install the module to whatever
   directory you gave as --libdir to configure.

 - Have a look at conf/nss-pgsql.conf, conf/nss-pgsql-root.conf
   and conf/dbschema.sql for a sample configuration.

3. Setup your System
-------------------------------------------------------------

To use this module on your system make sure your nss-pgsql.conf is
properly written. Then you can include the module in your
/etc/nsswitch.conf. Look at conf/nsswitch.conf for an example.
Don't forget to have a root console open before playing around
with NSS because you can lock yourself out of your computer!

To use shadow system, you must be create the table for shadow passwd.
Your nss-pgsql-root.conf is properly written, and you make it readable
only by root.
 # chmod 600 /etc/nss-pgsql-root.conf
 # chown root:root /etc/nss-pgsql-root.conf

4. Where to get more information
-------------------------------------------------------------

Consult the glibc documentation for more information on NSS.


2001-10-04, Joerg
2004-09-27, Russell Smith
