On Nov 22, 2007 2:10 PM, Gilles Chehade <[EMAIL PROTECTED]> wrote: > > On Thu, Nov 22, 2007 at 05:35:00PM +0100, Alexander Schrijver wrote: > > Hi everybody, > > > > I am trying to configure a virtual hosting system on OpenBSD, and I am > > currently looking at the authentication and user lookup. I have > > already normalized a PostgreSQL database which stores the users > > amongst others. And i would like to use these users in OpenBSD. > > > > As I understand their really is only one possibility to configure such > > a setup and that is to select all the users from the PostgreSQL > > database and create a bdb hash using pwd_mkdb (or any other compatible > > tool). PostgreSQL has support for asynchronous notifications > > (http://www.postgresql.org/docs/8.2/interactive/sql-listen.html) thus > > it is possible to create a bdb whenever the user database is updated. > > I was thinking about running the following scripts when postgreql > > sends such an asynchronous notification. > > $ script | pwd_mkdb /dev/stdin /etc/master.passwd > > > > The script will output all the users in the same format as master.passwd. > > > > Are there any other methods for doing this, or are there things I am > > overlooking with this configuration? > > > > Thanks, > > > > Alexander Schrijver > > > > Hi Alexander, > > I am not sure i understand exactly what you want, but if it involves > authenticating the users against the pgsql database, you may want to > take a look at this: > > http://www.evilkittens.org/~gilles/loginpgsql.tar.gz > > as well as to login.conf(5). I wrote this auth module for myself so > you'll need to edit the authenticate() function to set the proper > database informations. > > I have another piece of code which updates master.passwd whenever > the accounts table is updated but it would need a lot of cleanup > before it is useable outside of my configuration ;-) > > Gilles > > -- > Gilles Chehade > http://www.evilkittens.org/ > http://www.evilkittens.org/blog/gilles/ >
Oops, I meant to sent this to [EMAIL PROTECTED] Hi Gilles, This is exactly what I was looking for thanks :) ! didnt even know this was possible. Also, I would like to have the functions getpwnam and getgrname etc. working with the users from postgres. Is this best method for doing this to simply update the master.passwd with the records from PostgreSQL? thanks, Alexander