Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gob4H-00072H-Qk for pgsql-general@arkaria.postgresql.org; Tue, 29 Jan 2019 21:37:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gob4G-0007JY-Gm for pgsql-general@arkaria.postgresql.org; Tue, 29 Jan 2019 21:37:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gob4E-0007JR-Im for pgsql-general@lists.postgresql.org; Tue, 29 Jan 2019 21:37:16 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gob4A-00086t-77 for pgsql-general@postgresql.org; Tue, 29 Jan 2019 21:37:14 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5C82822236; Tue, 29 Jan 2019 16:37:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 29 Jan 2019 16:37:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=K /h+y9uk9ualgZ+KfOKrtPjJV5G+qxByswa9UOE22vw=; b=lYV2Rd9TmHTkrVQnA cnl+xhHVgpzL8kQhW6ivEJUFtWcnmu0x8xprEoQB4bxgDArc8fR9mBK74J3vpsVp tWvYzSV6qSHKFq33pbFNwaDFA1ESGiCG6St+9QiNnkvMy+F+OAyEfVWga2d3tTeC 9FujAaezG2K+yvWWRUG5NrGx8/l/pL7HsyA1rEZnYtktcu1PuEoJDkSJ2AMFOhhL JvnS0iNBgFYeIftsqQDfdIOGjz2Tuhbiqq44Zy4GPKTZ2ugKC2qmrBnEJPMykme2 32doivJii5s5/YxPHhGkpdXnxNkSxIWR0mf1u8Tf2S/PZas0sTgWYLhAc1zHPLBW 63ITg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=K/h+y9uk9ualgZ+KfOKrtPjJV5G+qxByswa9UOE22 vw=; b=T2v5k+ig/5ZDbV2VSU8/WVGNr+ALFfsjHUQ5yZNns2KywfcJ5sao6/vtL nSBQiH87XuOIJveTY/11Tknoljque8CJGZ3q07hNu01x+D0s29ztnanIb4CTIQTc FZSkgIl/hBMgUMJxHULGFa/oRXOT8PMlQaSt1RnJh5XRT+xQMpxfspUIMJl5HR7V qbqGi/Y6Bo4E357f1DavpqmN/3mfWTAynDH86EUquip61S97P9A7HVSiyLMp+NK/ TpD5QrK0uoq4Plzha8jXbtem/FhYFky5wuamXt+1355Ct25JawGMPsoDZRprAu7E gbu7k8JVFe+/BG/di5sDppBiXWs1g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjedvgdduhedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpe hfohhosggrrhdrtghomhdpphhoshhtghhrvghsqhhlrdhorhhgnecukfhppedujeegrddv uddrjeeirdduheefnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (174-21-76-153.tukw.qwest.net [174.21.76.153]) by mail.messagingengine.com (Postfix) with ESMTPA id 96588E41F3; Tue, 29 Jan 2019 16:37:07 -0500 (EST) Subject: Re: User Name Maps seem broken in 11.1 on CentOS 7 To: Viktor Berke , "pgsql-general@postgresql.org" References: From: Adrian Klaver Message-ID: <37efc320-af22-aa11-c68d-ecada155500d@aklaver.com> Date: Tue, 29 Jan 2019 13:37:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/29/19 1:11 PM, Viktor Berke wrote: > Hi, > > After some talk with the helpful folks of #postgresql I see no other > option but to ask here. I'm trying to set up proper authentication for > our corprorate users. They'll access postgres both from their > workstations via TCP, and also locally. Locally, they're authenticated > using SSSD which in turn is using LDAP to talk to our Active Directory > DCs. That's not very relevant, but I just wanted to explain precisely. > > Anyhow, we try to enforce the "user.name@company.com" login wherever we > can, so this is how I set up LDAP auth: > > hostssl all all 10.1.0.1/16 ldap ldapserver=dc2.ad.foobar.com > ldapport=636 ldapscheme=ldaps ldaptls=0 > ldapbinddn="CN=ldap,OU=Helpers,OU=Foobar,DC=ad,DC=foobar,DC=com" > ldapbindpasswd=*** ldapsearchattribute=mail > ldapbasedn="OU=Users,OU=Foobar,DC=ad,DC=foobar,DC=com" > > This works perfectly fine. I create the role, e.g.: > > CREATE ROLE "jane.doe@foobar.com" CREATEDB CREATEROLE LOGIN; > > Then she can log in fine via pgAdmin or whatever, using her email address. > > Now I want to set up peer authentication locally, so that they don't > have to enter their passwords all the time when they're already > authenticated to the OS. The idea is that I map the local "jane.doe" OS > user to the "jane.doe@foobar.com" role already present in postgres. This > way I don't have to CREATE ROLE and manage permissions both for jane.doe > and jane.doe@foobar.com. So the map would look something like this, I guess: > > foo /^(.*)$ \1@foobar\.com (or something like that?) > > And here comes the problem: user name maps seem completely > non-functional. First I suspected it's a problem with the dot in > usernames, but even if I create a local Unix user ("foobar") and set > > local all all peer map=foo > > in pg_hba.conf and > > foo foobar postgres > > In pg_ident.conf, all I see in the log is that > > 2019-01-29 21:44:45.095 CET [41929] LOG:  no match in usermap "foo" for > user "foobar" authenticated as "foobar" > 2019-01-29 21:44:45.095 CET [41929] FATAL:  Peer authentication failed > for user "foobar" > 2019-01-29 21:44:45.095 CET [41929] DETAIL:  Connection matched > pg_hba.conf line 79: "local all all peer map=foo" > > Bummer. I also tried various regexes, even the likes of /^(.*)$, but the > log ALWAYS says no match. The weird thing is that this is the log > content even if there's nothing in pg_ident.conf, so it's like postgres > doesn't even care about what's in there. Is ident_file set to something else?: https://www.postgresql.org/docs/11/runtime-config-file-locations.html#GUC-IDENT-FILE > > Any ideas? > > Regards, > > Viktor -- Adrian Klaver adrian.klaver@aklaver.com