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 1kyx2U-0006MF-V2 for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jan 2021 13:15:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kyx2T-0005Wn-Rg for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jan 2021 13:15:17 +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 1kyx2T-0005Wg-ML for pgadmin-hackers@lists.postgresql.org; Mon, 11 Jan 2021 13:15:17 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kyx2Q-0000Re-Mw for pgadmin-hackers@postgresql.org; Mon, 11 Jan 2021 13:15:16 +0000 Received: by mail-lf1-x12f.google.com with SMTP id m12so37638309lfo.7 for ; Mon, 11 Jan 2021 05:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=MkGkSzTXgf7eMvZu6wIkaTr6HPixZ3ok71ihkp7yITw=; b=NaMBvfkZw1x539zyALWOZWk4SGP5S0xFgNypIVyWCXrPVBW/OfNbDJUJErISHXjDKO om+3lupyqyS9OlmFUpg2w7gZ4o5oghVJSe6GHZOoKuudFQ01LW10Ey+3Be45cpooO4Le 8guUHjw7sbVVaaZs9vwCGcXLN47PMD+w5SHsD6Ida7BX3qm8KW4JY8cqOlxsK69lL9e0 6l9gRW8CoKGNxi6gVmsHrL1q16nyZIo6RXBXwKzbUtoVaBgU/vQ7PdyxG7l6A0bF+9uN gBeatZz2rm6EvKXImT8mGkhA/WwTXf5RQ3sqzThPpQt1PvmTyTlTSfnmGUWLoLvpx8hf iCkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=MkGkSzTXgf7eMvZu6wIkaTr6HPixZ3ok71ihkp7yITw=; b=aPBzZNqRRqEI1wXsD4kB1LuWma4HtBPvNa0K0VcNzi08lefLaZXvMOfpTc+369iyIT QS5MlbYjSyI3G1H1viaMAEmCaaAvWidusIy6QlpTss2eseLrZSfNTziMky95XR8lb+3t 4Mb57ypBXm7OQX41CWS5ARrpxDoFHNR7/jYPJD/Xs5VQ0DPjptVZFuZlZ9KFTEW0JEs9 LqtkGcO7aQQVl0nMekHFxha2l+LT9ngLb+Vkj2DG0bLT9dugIAMgXyOET0/hZO5a1zI9 7X0P1YmQ7Ff1LYU217o2IXpIB0ebcki4veayleR64+/KWX3pEheo8pxNIc0YDYFKTH1T jATg== X-Gm-Message-State: AOAM533fO6ozOhc20U1YTzDhKD8oP4+CjLB8T1iOKzn49JOzpCc8KvQ6 +VFe9cCBFE1Cr7ADWv0R+FSZeRb7veXIApFQC7bubw== X-Google-Smtp-Source: ABdhPJyXkFWqw8iDLgXe/uLmOkCZcMoRquhacUA/x9EDBhXktAtt2Qpgh7xcQdr4Y4/brzTkt//2nf0wb8ihTL8Xnjs= X-Received: by 2002:a05:6512:20c1:: with SMTP id u1mr7438737lfr.549.1610370911797; Mon, 11 Jan 2021 05:15:11 -0800 (PST) MIME-Version: 1.0 References: <20210102154130.GO27507@tamriel.snowman.net> <20210102155947.GQ27507@tamriel.snowman.net> <20210103173112.GR27507@tamriel.snowman.net> In-Reply-To: <20210103173112.GR27507@tamriel.snowman.net> From: Magnus Hagander Date: Mon, 11 Jan 2021 14:15:00 +0100 Message-ID: Subject: Re: [pgAdmin4][Patch] - RM 5457 - Kerberos Authentication - Phase 1 To: Stephen Frost Cc: Dave Page , Khushboo Vashi , pgadmin-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Jan 3, 2021 at 6:31 PM Stephen Frost wrote: > > Greetings, > > * Dave Page (dpage@pgadmin.org) wrote: > > On Sat, 2 Jan 2021 at 15:59, Stephen Frost wrote: > > > * Dave Page (dpage@pgadmin.org) wrote: > > > > On Sat, 2 Jan 2021 at 15:41, Stephen Frost wro= te: > > > > > * Khushboo Vashi (khushboo.vashi@enterprisedb.com) wrote: > > > > > > Please find the attached patch to support Kerberos Authenticati= on in > > > > > > pgAdmin RM 5457. > > > > > > > > > > > > The patch introduces a new pluggable option for Kerberos > > > authentication, > > > > > > using SPNEGO to forward kerberos tickets through a browser whic= h will > > > > > > bypass the login page entirely if the Kerberos Authentication > > > succeeds. > > > > > > > > > > I've taken a (very short) look at this as it's certainly somethin= g that > > > > > I'm interested in and glad to see work is being done on it. > > > > > > > > > > I notice that 'delegated_creds' is being set but it's unclear to = me how > > > > > they're actually being used (if at all), which is a very importan= t part > > > > > of Kerberos. > > > > > > > > > > What's commonly done with mod_auth_kerb/mod_auth_gss is that the > > > > > delegated credentials are stored on the filesystem in a temporary > > > > > directory and then an environment variable is set to signal to li= bpq / > > > > > the Kerberos libraries that the delegated credentials can be foun= d in > > > > > the temporary file. I don't see any of that happening in this pa= tch- > > > is > > > > > that already handled in some way? If not, what's the plan for ma= king > > > > > that work? Also important is to make sure that this approach wil= l work > > > > > for constrainted delegation implementations. > > > > > > > > Phase 1 of this project (which this patch aims to implement) is to = handle > > > > Kerberos logins to pgAdmin when running in server mode (as we=E2=80= =99ve already > > > > done for LDAP, except KRB authenticated users don=E2=80=99t see a l= ogin page of > > > > course). Phase 2 will add support for logging into the PostgreSQL > > > servers - > > > > I believe that is where we=E2=80=99ll need to handle delegated cred= entials, > > > correct? > > > > > > Yes, though I sure hope there isn't a plan to release just 'phase 1' > > > since that would imply that the user is still sending their password = to > > > pgAdmin in some form that pgAdmin then turns around and impersonates = the > > > user, basically completely against how Kerberos auth should be workin= g > > > in this kind of a intermediate service arrangement. > > > > > > In other words, if just 'phase 1' is released, it'd probably be CVE > > > worthy right out of the gate... > > > > It wouldn=E2=80=99t impersonate the user at all, it would just work as = it does now, > > requiring the user to supply a username/password for scram/md5/ldap etc= , or > > a cert for SSL auth. Connection to a PostgreSQL server which required g= ss > > or sspi simply wouldn=E2=80=99t work (unless the service account under = which the > > pgAdmin server is running has a valid ticket through other means). > > That *is* impersonating the user.. > > Kerberized services really should *not* be accepting a cleartext > password to use to authenticate as the user against another service, > which is why I'd strongly recommend against releasing with just > 'phase 1' done.. or at least heavily caveat'ing it that this isn't > actually real Kerberos support but is just an intermediate step that no > one should really deploy... AIUI that's not what's being proposed. Correct me if I'm wrong, but I think what's said is that this phase would: 1. Allow kerberos login *to pgadmin*. 2. Do exactly *nothing* to logins to the database server. So per (2) logins to the db server would work exactly the same as it does today, and bear no connection to the actual KRB login at all. One question around that though -- when I click "save password" on a database connection in pgadmin, it gets stored on the pgadmin server. Isn't the key used to encrypt that derived from my password? If I'm logging into pgadmin without a password (using kerberos),what would that key be derived from? --=20 Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/