Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDK4w-0000WO-A9 for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2016 23:18:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bDK4v-0002Tj-TD for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2016 23:18:33 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bDK3Y-0000F6-Bo for pgsql-hackers@postgresql.org; Wed, 15 Jun 2016 23:17:08 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bDK3T-0006pj-Sc for pgsql-hackers@postgresql.org; Wed, 15 Jun 2016 23:17:07 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5EFF0C05681C; Wed, 15 Jun 2016 23:17:00 +0000 (UTC) Received: from localhost (vpn-239-48.phx2.redhat.com [10.3.239.48]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5FNGx9g025069; Wed, 15 Jun 2016 19:17:00 -0400 From: Robbie Harwood To: PostgreSQL mailing lists Cc: Michael Paquier , Tom Lane , Stephen Frost Subject: Re: [PATCH v12] GSSAPI encryption support In-Reply-To: References: <20160406112105.GG10850@tamriel.snowman.net> <1530.1459977031@sss.pgh.pa.us> <5486.1459984857@sss.pgh.pa.us> User-Agent: Notmuch/0.22 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 15 Jun 2016 19:16:56 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 15 Jun 2016 23:17:00 +0000 (UTC) X-Pg-Spam-Score: -8.3 (--------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --=-=-= Content-Type: text/plain Michael Paquier writes: > On Thu, Apr 7, 2016 at 8:20 AM, Tom Lane wrote: >> Robbie Harwood writes: >>> Tom Lane writes: >>> >>>> Wait a second. So the initial connection-request packet is >>>> necessarily unencrypted under this scheme? >> >>> Yes, by necessity. The username must be sent in the clear, even if >>> only as part of the GSSAPI handshake (i.e., the GSSAPI username will >>> appear in plantext in the GSSAPI blobs which are otherwise >>> encrypted). GSSAPI performs authentication before it can start >>> encryption. >> >> Ugh. I had thought we were putting work into this because it >> represented something we could recommend as best practice, but now >> you're telling me that it's always going to be inferior to what we >> have already. > > It does not seem necessary to have an equivalent of > pqsecure_open_client, just some extra handling in fe-connect.c to set > up the initial context with a proper message handling... Not that > direct anyway. So should the patch be marked as returned with feedback > at this stage? I think in order to satisfy Tom's (valid) concern, there does need to be a separate handshake - i.e., GSSAPI support in pqsecure_open_client(). If I were to continue as I have been - using the plaintext connection and auth negotiation path - then at the time of startup the client has no way of knowing whether to send connection parameters or not. Personally, I would be in favor of not frontloading these connection parameters over insecure connections, but it is my impression that the project does not want to go this way (which is fine). The way I'm seeing this, when a connection comes in, we take the 'G' character for GSSAPI much as for SSL. At that time, we need to perform an *authentication* handshake (because GSSAPI will not do encryption before authenticating). I expect to use a consistent format for all GSSAPI packets - four bytes for length, and a payload. (I would prefer tagging them, but previously preference for not doing this has been expressed.) Once GSSAPI authentication is complete, the normal handshake process can be tunneled through a GSSAPI encryption layer, as is done with TLS. The server will need to retain some of the earlier authentication data (e.g., to check that the presented user-name matches GSSAPI credentials), but there will be no authentication packets exchanged (more specifically, it will resemble the anonymous case). Authorization will be checked as normal, and we then proceed in the usual fashion, all over the GSSAPI tunnel. On the server, I'll need to implement `hostgss` (by analogy to `hostssl`), and we'll want to lock authentication on those connections to GSSAPI-only. Clients will explicitly probe for GSSAPI support as they do for TLS support (I look forward to the bikeshed on the order of these) and should have a parameter to require said support. One thing I'm not clear on is what our behavior should be when the user doesn't explicitly request GSSAPI and doesn't have a ccache - do we prompt? Skip probing? I'm not sure what the best option there is. Before I implement this design, does anyone have any additional concerns or feedback on it? Thanks, --Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXYeHpAAoJECUy+RdqlaRCDSoP/AjdgyhEBN6xhpEcLj/PzK3R OX36duig9mwQDcxpAl9LmWC45IJJdMqdwKQk0STlWZs42Kl3vBkEBkjeCFXC0pNF 8qV1xzOlJ9Rhao15cfFhUmfWgF7ZB2eTgoOpQdRgMQBy1WmFNNomffNkIZJNKpQy +B6XkjAnWB2Pr+b2ErYbMWilUd4rPQDct1g4xgdT/IcjeYRjonYgtYBr8WXCe858 zHZ0MmfqEF8uFGYDiANjyhnhvTiq2p4N9gHL3JI3AkfVdr8fze6umYJCK9DIzW2T lQiTAE9VTQ8WqfjMD6EDcvGT3K6k3GYAIVw8WW+ML8BtJMzw7r4izS0nKivT+CFG KsyCtA0rrK7/ywCIjQgp0USnA8pBUSm3spKLt80W9wSAmGTRJuBM+pRe3KbAXnkO xXMYd7F9SQiNzV0gAHnkYSisl6E5+pjg6eUxhjzt0olpIX7EyztGmxoBi9Du6piW OQM1ZgOjocoQHhbcwFQlmM9wJYucFpDzg5eo42bgf2BBj/JMixZXL5nogGAcSzRu eYqQF806TnoocEnVVb0EVIjxds5ul+7Nfmyz7C3pIJezU32MAzniRc0BJw8vrOyC ANVhUKmqTyH4cAyfbZ0U1t0uaL0BTi4PTIkGjajVHyMnITatSBwcFPIPvV83QWat u228LEcdL/QXYwR7B/qU =g9sC -----END PGP SIGNATURE----- --=-=-=--