Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kxAuU-00008x-3p for pgsql-general@arkaria.postgresql.org; Wed, 06 Jan 2021 15:39:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kxAuS-0007TY-F2 for pgsql-general@arkaria.postgresql.org; Wed, 06 Jan 2021 15:39:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kxAuS-0007TR-4p for pgsql-general@lists.postgresql.org; Wed, 06 Jan 2021 15:39:40 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kxAuP-0000eW-VO for pgsql-general@postgresql.org; Wed, 06 Jan 2021 15:39:39 +0000 Received: by mail-wm1-x336.google.com with SMTP id y23so2990825wmi.1 for ; Wed, 06 Jan 2021 07:39:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=If8C6W+1MxOna7FwrT8cpF+NFZ2YViTL6m6aFJxRTDU=; b=XnSdK+ZIk2JLAWTelUSEKHy9iadIH7XxY7n0GXv21kcHyqpkrPSGctnkxJriidK4pT 7sfdHiklMCD6TXxbL5tXXnePNh3xCqpyPNRSI02NzGyv+O10G1coJ6p/F9+O5YNEByJA KaZkEByGgWQqgU4NF0UYt1Enl1O8dQdtepRREDaoWJSAzurMuzpGgMiRYUEJFjwR3qnf nwB2hfNXTBTc2BD+0It15QPKFNLHVrh1//ZNGCwMLcOJsRYjVa5wWyEV1skIyeeo6kax NJ2LS9xL0GVBBlc54d6hBjOpWT68mydS63YBt0KREka3eaZ4PJlWHtWOOkindQ3yaiDV 6ETg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=If8C6W+1MxOna7FwrT8cpF+NFZ2YViTL6m6aFJxRTDU=; b=gq0i7BonkQJpwOHTuK4lgFJfdBwJ4tCHtWaaaq+qhzqoYx4hrPMn4+alilY41AJkvn lxU73rIjgKaEBVAySkv2PjW28EkajnL927gRayBK9eAqLOcR9IqGqUHlX/gAXeh/LYyF HufMI0FiXJFuxtlM7rziAFaw/BuMj/prujfE20s4bidoczz1/GJ9VxPu09CwAxAEBZO7 Rec0B0SkFuwpt29kxP67QPCZfEd+wX0vE/JZ4sYOrRiwtb1OtrDo/2/On7m94paLJRHJ bNDcbNANgXcOoQYmutNUlOm4GUNqbMP0FZFzJzcVgB+bD25uX7rUOJnySFjRnWtcMiTK AeHg== X-Gm-Message-State: AOAM531QPnRnfnn4ZcfWUNTOxEiGQC1NymsnWhnNQzt42p7cFg7GDcCw qyTxSe34es9/ujIPT0BS8YU= X-Google-Smtp-Source: ABdhPJztcb8/E2SvUgvtCBhS/lxLBmgGyXBItevp6Gcg3xY3lt/4d9H4MUo5dUDsNgXx19FrYBHCyw== X-Received: by 2002:a05:600c:40ca:: with SMTP id m10mr4169723wmh.54.1609947576194; Wed, 06 Jan 2021 07:39:36 -0800 (PST) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id q143sm3475342wme.28.2021.01.06.07.39.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jan 2021 07:39:35 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: Using more than one LDAP? From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: Date: Wed, 6 Jan 2021 16:39:35 +0100 Cc: "pgsql-general@postgresql.org >> PG-General Mailing List" Content-Transfer-Encoding: quoted-printable Message-Id: References: <08D7C808-63E6-4482-A753-9F3E0DF8ABB5@gmail.com> To: Magnus Hagander X-Mailer: Apple Mail (2.3654.40.0.2.32) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Magnus, > On 06. Jan, 2021, at 15:48, Magnus Hagander = wrote: >=20 > 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=