X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 54C56D1B8A9 for ; Sat, 16 Aug 2003 23:55:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 47619-03 for ; Sat, 16 Aug 2003 20:55:19 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 46212D1B8B7 for ; Sat, 16 Aug 2003 20:55:15 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h7GNt5S14440; Sat, 16 Aug 2003 19:55:05 -0400 (EDT) From: Bruce Momjian Message-Id: <200308162355.h7GNt5S14440@candle.pha.pa.us> Subject: Re: [GENERAL] pam-linux, /etc/shadow : HOW-TO In-Reply-To: To: ahoward Date: Sat, 16 Aug 2003 19:55:05 -0400 (EDT) Cc: PostgreSQL-documentation X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/50 X-Sequence-Number: 1910 Would someone merge this into our CVS docs and submit a patch? --------------------------------------------------------------------------- ahoward wrote: > > note: i'm no sysad, nor do i even pretend to understand pam, the linux kernel, > or postgresql, but this setup is a safe, working, postgresql/linux/pam setup. > > 0) configure postgresql for pam, for example > > [root@omega tmp]# grep pam /usr/local/pgsql/data/pg_hba.conf > host all all 137.75.0.0 255.255.0.0 pam > > 1) create a /etc/pam.d/postgresql entry, here's how i did mine > > [root@omega tmp]# cp /etc/pam.d/passwd /etc/pam.d/postgresql > > i don't know if it's the best setup, but it works! mine looks like this > > [root@omega tmp]# cat /etc/pam.d/postgresql > #%PAM-1.0 > auth required /lib/security/pam_stack.so service=system-auth > account required /lib/security/pam_stack.so service=system-auth > password required /lib/security/pam_stack.so service=system-auth > > 2) create a shadow group which will be used for user's needing read-access to > /etc/shadow, and add postgres (or whatever user the postmaster runs as) to > this entry. i used vi to add this entry to /etc/group > > [root@omega tmp]# grep shadow /etc/group > shadow:*:4002:root,postgres > > root probably does not *need* to be added. > > note the '*' v.s. an 'x' in the password field. if you place an 'x' there > you will also have to set up /etc/gshadow - i did not want to do this. if > you don't set up /etc/gshadow pam will NOT work if an 'x' is in the password > field - at least with my linux system. > > 3) make /etc/shadow group shadow > > [root@omega tmp]# chgrp shadow /etc/shadow > > 4) chmod 0440 /etc/shadow > > > essentially, pam will not work with postgres since the daemon needs at some > point, no matter how many library calls deep, to open and read /etc/shadow > (assuming this is how your system is using pam). you must have some solution > which allows postgres, but not everyone, to read /etc/shadow. others probably > exist. > > -a > > -- > ==================================== > | Ara Howard > | NOAA Forecast Systems Laboratory > | Information and Technology Services > | Data Systems Group > | R/FST 325 Broadway > | Boulder, CO 80305-3328 > | Email: ara.t.howard@fsl.noaa.gov > | Phone: 303-497-7238 > | Fax: 303-497-7259 > ==================================== > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073