Re: LDAP: Auto user creation and role membership

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Daniel Scott <djscott(at)mit(dot)edu>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: LDAP: Auto user creation and role membership
Date: 2010-05-05 20:59:12
Message-ID: k2o9837222c1005051359n1b08c6ccy3ef48bf3a5bc824a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 5, 2010 at 22:49, Daniel Scott <djscott(at)mit(dot)edu> wrote:
> Hi,
>
> I have Postgres 8.4.3 running with gss authentication against Fedora's
> FreeIPA (Integrated Kerberos, LDAP and some other services).
>
> I would like to auto-create users and auto-map postgres roles with
> users and groups within the FreeIPA LDAP directory. Can anyone tell me
> if this is available in Postgres? Looking through the docs, it appears
> that it is not, and I have to manage user creation and role membership
> manually.
>
> I found this post from 5 years ago:
>
> http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg58156.html
>
> But I haven't found anything mentioning this functionality since.
>
> Is anyone else attempting to do this? I could probably write a script
> or something to auto create postgres users from the LDAP directory
> (and remove users who have been deleted from LDAP) and then
> synchronise the roles with LDAP groups, but I don't want to repeat
> this work if someone's already done it.
>
> I'd also appreciate any hints or suggestions for ways to do this.

I've written scripts to do this several times using both python and
perl. It's pretty simple. I haven't made them generic though, so it's
not something I can share. But just a tool that compares the list of
users and issues the appropriate CREATE USER or DROP USER commands is
pretty trivial. Granting role permissions adds a bit of complexity,
but not much. Trying to do them generic will make it a lot more
complex though, so if you jus tneed it for this one case, a quick
one-off script is probably the easiest way to go.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pgsql 2010-05-05 21:19:16 Re: Please help me debug regular segfaults on 8.3.10
Previous Message sunpeng 2010-05-05 20:50:43 when to update pg_statistic relation?