How to setup PostgreSQL to work with libpam-pgsql/libnss-pgsql2?

Lists: pgsql-general
From: PMC OS <pmcos-support(at)freenet(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: How to setup PostgreSQL to work with libpam-pgsql/libnss-pgsql2?
Date: 2010-08-24 19:02:06
Message-ID: 3e435fb6602e2f39ddcee9f439d10ccc@email.freenet.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello,

I am new to Linux and setup 6 Computers with Debian:

1) 2 Workstations
2) 2 Intranet Servers
3) PostgreSQL Server
4) Router

The two Intranet Servers are now working with NFSv4/TCP, Apache2 with suphp and php5, courier-imap/mta/mlm

My Router is working to and use IPT, bind9 and apache2 with mod_proxy forwarding traffic to the two Intranet Servers.

Also the Workstations are working fine.

Now I like to switch with the authentification to libpam-pgsql/libnss-pgsql2 but I hit a problem with the PostgreSQL, because it refuse any connections from the network.

I have setup in the postgresql.conf

listen_addresses = '192.168.0.3'

and in the pg_hba.conf

local all postgres ident sameuser
host system root 192.168.0.0/24 md5

now restarted postgresql and "system" with the psql commandline tool. Then imported the SQL Scheme from libpam-pgsql.

OK, now on a workstation I installed libpam-pgsql and libnss-pgsql2 leave a terminal open to revert the PAM/NSS files if something goes wrong and setup the files

/etc/pam.d/common-account
/etc/pam.d/common-auth
/etc/pam.d/common-password

to use the PostgreSQL database and now I was XXXX! nothing is working anymore. I can not even connect to the PostgreSQL server.

Can someone tell me please, how to setup PostgreSQL so I can use it with libpam-pgsql and libnss-pgsql2?

Thanks
PCMOS

freenetMail mobil – Alle E-Mails auf Ihrem Handy versenden und empfangen.
Jetzt kinderleicht und kostenlos einrichten. http://tls.freenet.de/tipp/handymail/index.html


From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: PMC OS <pmcos-support(at)freenet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to setup PostgreSQL to work with libpam-pgsql/libnss-pgsql2?
Date: 2010-08-25 02:01:11
Message-ID: 4C747967.4030807@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 25/08/2010 3:02 AM, PMC OS wrote:
> I am new to Linux

[snip]

> Now I like to switch with the authentification to libpam-pgsql/libnss-pgsql2

Honestly, in most cases you'll be much better off managing
authentication with LDAP. It's a better design for the nature of
authentication and user data management, where it has to handle lots of
small read queries and only very rare writes. It also has better
replication.

Even if you're not using Samba, the smbldap-tools provide handy commands
to manage users in the LDAP directory, and the debian ldap-auth-client
package provides a convenient way to configure a client to authenticate
against the directory.

Initial setup takes a little learning, but is well worth it.

If you later find that you need to store user data in a relational
database for some reason, you can even configure slapd to use the
database as a backend, so you're using PostgreSQL behind the scenes but
your clients still talk LDAP. I've never found the need, though; I run
the network at the business I'm sysadmin at with pure LDAP
authentication (slapd, berkely db backend) quite happily.

> to use the PostgreSQL database and now I was XXXX! nothing is working anymore. I can not even connect to the PostgreSQL server.

Even via "psql -h 192.168.0.3" ?

Can you ping it?

If you run "ps aux | grep postgres" on the server, are there any
postgresql processes running?

If you run "psql" on the server, can it connect? If not, what's the
error message?

If you look at /var/log/postgresql on the server, what are the last few
lines in the logs?

--
Craig Ringer