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 1p7HSq-0002Jp-4Z for pgsql-admin@arkaria.postgresql.org; Mon, 19 Dec 2022 14:50:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p7HSp-0007cA-0T for pgsql-admin@arkaria.postgresql.org; Mon, 19 Dec 2022 14:49:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7HSo-0007c1-Iu for pgsql-admin@lists.postgresql.org; Mon, 19 Dec 2022 14:49:58 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p7HSm-0006pn-8K for pgsql-admin@lists.postgresql.org; Mon, 19 Dec 2022 14:49:58 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1443a16b71cso11701907fac.13 for ; Mon, 19 Dec 2022 06:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=6SWw97v8ZMfBXtrvftzObH+MhhuPMcYEhbUoHP75zOc=; b=D49d8QhIBpAA4GR9nQMfJJebKvcoyXTWySd4lhgfWbg0UNrH9OrZdBNmswkXcx7a2a x1yo9cYt2s7mif78KkxPpiryYJZIKHeSEDVbJfS/rIDb2dpSXdOSzXAaSWAakO6LTC4h pMYHXla2AFVngBEyuK3oz1QYZzorsCEC5oQJerxlDZR2ld+dHfnZiEUDSqVdM7p/0vKD j05JmtU/ECgzC2eSLfaywTCAjWE1dH32sFyMOAZSF8syDkn33WxSgDAMv4omA6VgrYCV thwq9FXn0RJEoIBrwgykQephfGLmoDblNEdK2JCz/uPZK+9bwidiU3xkCU38meYRw5jQ yboQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=6SWw97v8ZMfBXtrvftzObH+MhhuPMcYEhbUoHP75zOc=; b=wukRuppVJp4YwSeArFGkQqENH462aMFyOltZllXyWbhwBn5MFNkF6nJKCPoFyCICcx XldmkwyK8fy8T/KGZUd5lLeVOjM+z4r7OiSXPPssbt/arZFkQ450h+E5xDQMkgfGGZcZ 6i3UUzwH3Nu9HbVVpROiP5kICkipvJFDa57UwwTF9BHEzIqaRWYEQu5aRsrX9LwRoeqs sHHikzZN/8pvlatQIyGtDcSThl4X0TFYRbCGpAS/gY7wiQQCXeVuEK/bg6PfD0f5bnOb 1HcTOAwLw0Yk/KIaGrmjKb15m0CkGEzCFZyAt06vPpOsTB1RLVa7u8BKjrxGj/VNkUfS 60dg== X-Gm-Message-State: ANoB5plRXjvaWKfLYKkNehFLhLdhnAcF1ATvkgS9eGAWDiZdfB0JwxHr IHhQfIoin2XbfFoKDwDSy8pRFFLlGyNcNQ== X-Google-Smtp-Source: AA0mqf51E9Ub5IypRq8Na+TZk5etgEi/pTkUrhSC3bsmsIfPIUK7WfWU7wHlmwJF20KLe4MD8uD6Hg== X-Received: by 2002:a05:6871:430b:b0:144:9ec0:7fc9 with SMTP id lu11-20020a056871430b00b001449ec07fc9mr20672823oab.11.1671461393583; Mon, 19 Dec 2022 06:49:53 -0800 (PST) Received: from [192.168.1.66] (108-250-206-84.lightspeed.nworla.sbcglobal.net. [108.250.206.84]) by smtp.googlemail.com with ESMTPSA id h4-20020a056870170400b00132741e966asm4729801oae.51.2022.12.19.06.49.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Dec 2022 06:49:52 -0800 (PST) Content-Type: multipart/alternative; boundary="------------CWNKn97mKtxIMI4yWxrbi01i" Message-ID: <63e54f32-14cb-6f77-02b2-d42f094b45c9@gmail.com> Date: Mon, 19 Dec 2022 08:49:51 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Using pgadmin as an OAuth2 proxy for PostgreSQL Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: <13f5e9d02dcf428b8e6fe25274ab6a1c@nordlb.de> From: Ron In-Reply-To: <13f5e9d02dcf428b8e6fe25274ab6a1c@nordlb.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------CWNKn97mKtxIMI4yWxrbi01i Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Why not authenticate Postgresql users directly to AD using GSSAPI? On 12/19/22 07:12, Rettstadt, Tobias wrote: > > Hi all, > > our current project has the requirement that users should get read access > to our backend databases. The users are stored in Azure AD and my first > idea was to use OAuth2 / OIDC to authenticate the users. Since pgadmin > provides OAuth2 authentication, is it possible to somehow map roles in the > access token that we get from Azure AD to a Postgres user in pgadmin, so > that the users can just log into using their Azure AD account and then get > access to a number of databases that I have configured? > > I already tried the OAuth2 login in pgadmin and it’s working fine, but I > haven’t figured out how to deploy the database credentials. I know that I > could use a password file, but it has to be located in the storage > directory of the user, where he could download it using the storage > manager. Since users should not be able to access the password, we cannot > use this. It would also be feasible if the owner of the password would > have to enter the password on the machine of each of the users, but even > if I select “Save password”, the password is not saved, even though master > passwords and password saving are activated in the config. > > We are running the latest Docker image dpage/pgadmin4 in a Kubernetes > cluster. The pgadmin version is 6.17. > > Thanks in advance for your help and best regards, > > Tobias > > **************************************************************** Die in > dieser E-Mail enthaltenen Informationen sind vertraulich. Diese E-Mail ist > ausschliesslich fuer den Adressaten bestimmt und jeglicher Zugriff durch > andere Personen ist nicht zulaessig. Falls Sie nicht einer der genannten > Empfaenger sind, ist jede Veroeffentlichung, Vervielfaeltigung, Verteilung > oder sonstige in diesem Zusammenhang stehende Handlung untersagt und unter > Umstaenden ungesetzlich. Sollte diese Nachricht nicht fuer Sie bestimmt > sein, so bitten wir Sie, den Absender unverzueglich zu informieren und die > E-Mail zu loeschen. > **************************************************************** The > information contained in this e-mail is confidential. This e-mail is > intended solely for the addressee(s) and may not be accessed by anyone > else. If you are not a named recipient, any disclosure, copying, > distribution or related action is prohibited and might be unlawful. If the > e-mail is not intended for you, please notify the sender immediately and > delete it. **************************************************************** -- Angular momentum makes the world go 'round. --------------CWNKn97mKtxIMI4yWxrbi01i Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Why not authenticate Postgresql users directly to AD using GSSAPI?

On 12/19/22 07:12, Rettstadt, Tobias wrote:

Hi all,

 

our current project has the requirement that users should get read access to our backend databases. The users are stored in Azure AD and my first idea was to use OAuth2 / OIDC to authenticate the users. Since pgadmin provides OAuth2 authentication, is it possible to somehow map roles in the access token that we get from Azure AD to a Postgres user in pgadmin, so that the users can just log into using their Azure AD account and then get access to a number of databases that I have configured?

 

I already tried the OAuth2 login in pgadmin and it’s working fine, but I haven’t figured out how to deploy the database credentials. I know that I could use a password file, but it has to be located in the storage directory of the user, where he could download it using the storage manager. Since users should not be able to access the password, we cannot use this. It would also be feasible if the owner of the password would have to enter the password on the machine of each of the users, but even if I select “Save password”, the password is not saved, even though master passwords and password saving are activated in the config.

 

We are running the latest Docker image dpage/pgadmin4 in a Kubernetes cluster. The pgadmin version is 6.17.

 

Thanks in advance for your help and best regards,

Tobias

**************************************************************** Die in dieser E-Mail enthaltenen Informationen sind vertraulich. Diese E-Mail ist ausschliesslich fuer den Adressaten bestimmt und jeglicher Zugriff durch andere Personen ist nicht zulaessig. Falls Sie nicht einer der genannten Empfaenger sind, ist jede Veroeffentlichung, Vervielfaeltigung, Verteilung oder sonstige in diesem Zusammenhang stehende Handlung untersagt und unter Umstaenden ungesetzlich. Sollte diese Nachricht nicht fuer Sie bestimmt sein, so bitten wir Sie, den Absender unverzueglich zu informieren und die E-Mail zu loeschen. **************************************************************** The information contained in this e-mail is confidential. This e-mail is intended solely for the addressee(s) and may not be accessed by anyone else. If you are not a named recipient, any disclosure, copying, distribution or related action is prohibited and might be unlawful. If the e-mail is not intended for you, please notify the sender immediately and delete it. ****************************************************************

--
Angular momentum makes the world go 'round.
--------------CWNKn97mKtxIMI4yWxrbi01i--