From: Paul Förster <paul.foerster@gmail.com>
To: Magnus Hagander <magnus@hagander.net>
Cc: " <pgsql-general@postgresql.org>
Subject: Re: Using more than one LDAP?
Date: Wed, 6 Jan 2021 16:39:35 +0100
Message-ID: <B2AEC5C8-D89C-46F3-83FF-8BA3A6008ACE@gmail.com> (raw)
In-Reply-To: <CABUevEySDnhqeaKRBkkGUeDYEvVSm6-a6TSQztrMib8nZmjNdw@mail.gmail.com>
References: <08D7C808-63E6-4482-A753-9F3E0DF8ABB5@gmail.com>
<CABUevEySDnhqeaKRBkkGUeDYEvVSm6-a6TSQztrMib8nZmjNdw@mail.gmail.com>
Hi Magnus,
> On 06. Jan, 2021, at 15:48, Magnus Hagander <magnus@hagander.net> wrote:
>
> Only if you can create rules in your pg_hba.conf file that knows where
> the users are. You can specify multiple servers on one line, but that
> only balances across servers that don't work. If a server replies "no"
> to a response, PostgreSQL will not move on to the next one. So you
> have to make it initially pick the correct rule.
that unfortunately is not an option, partly because LDAP and AD use different options and also, as you already mentioned it, if one server says no, it's no.
> And what would you do if user5 exists in both the two ldap servers?
that wouldn't matter as long as user5 exists on the database and can be authenticated by either LDAP.
> One hacky way you could do it is create a group role for each server,
> maintained by some cron job, that indicates with LDAP server the user
> is on. You can then use group matching to pick the correct rule in
> pg_hba. It's kind of an ugly hack though..
that sounds really hacky. ;-)
> You'd probably be better off to have a federated ldap server that has
> a view of both servers, and use that.
can't do that either. I have no control over both LDAP services. PostgreSQL is just a consumer and I can't make any of the two LDAPs to sync onto each other.
> Or even better, since one of your nodes is AD, it speaks Kerberos.
> Setting up a Kerberos trust between the two environments would make it
> possible to do things like regexp matching on the realm in
> pg_ident.conf, and as a bonus you get Kerberos which is a lot more
> secure than ldap for auth.. It might have a slightly higher barrier
> of entry, but could probably pay off well in a case like this.
that'd require me to recompile and redistribute the PostgreSQL software. I only have openLDAP compiled into it but no GSSAPI. While this could be possible, it would also mean service interruption, almost not possible in a 24x7 environment. Also, and I'm no expert on this, it would require me to get certificates and configure them, and so on, right?
I thought of a pg_ident.conf configuration. In fact, it's more of a prefix change. The complete situation is like this:
ldap1 knows aaa-u1, aaa-u2, and so on
ldap2 knows bbb-u1, bbb-u2, and so on
So, I thought, I could create a pg_ident.conf like this:
mymap /^aaa-(.*)$ bbb-\1
Then pg_ctl reload of course. But that doesn't seem to work. Maybe I'm trying something wrong here.
Cheers,
Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: paul.foerster@gmail.com, magnus@hagander.net
Subject: Re: Using more than one LDAP?
In-Reply-To: <B2AEC5C8-D89C-46F3-83FF-8BA3A6008ACE@gmail.com>
References: <08D7C808-63E6-4482-A753-9F3E0DF8ABB5@gmail.com> <CABUevEySDnhqeaKRBkkGUeDYEvVSm6-a6TSQztrMib8nZmjNdw@mail.gmail.com> <B2AEC5C8-D89C-46F3-83FF-8BA3A6008ACE@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox