Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzLuC-003L2u-8h for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 19:34:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rzLuA-00ABTX-O2 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 19:34:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzLuA-00ABTP-DW for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 19:34:14 +0000 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rzLu7-002ZRm-Bi for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 19:34:13 +0000 Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-69b4454e2f1so25798626d6.0 for ; Tue, 23 Apr 2024 12:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1713900849; x=1714505649; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZU2//6cPzaN3vLKMphV0xNvkwdQ3HR51fF6mfk7AdEo=; b=RSc87FJEfnMmy4+U3Pe7aT7vHvu9Y0vBjSpEzSnfCIlqS7QG7E3ZY1tKqHycM1uf1c qksaiRiys2VONvxSkmM5Ot+01mtDwc7PQMSwrHV/xbVGpB//nlwkAyGO5usHED3xsniJ es4JBvazAdYiQsROSPn/bXhYxl/zhMr3+ofFirbutfklV902ehtWYMFt1i9QjeoI44uZ 7Ngvx6n46XrvdquBZt0ou9jcSUigRtTeNJZ1/Fxk7K37MUbRBdLHXJuuV/1z07VBD7jT yB2ouqcPl8DLs9kvF4NjQNVjCaDTIrFRTz1x93YQO1Dp0eTEG9EUSeS/k73oyY1kvnG8 iCnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713900849; x=1714505649; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZU2//6cPzaN3vLKMphV0xNvkwdQ3HR51fF6mfk7AdEo=; b=SmqD3liYsvlZaBDuQyz5jDc5aIZsRATWI7hBX2Jiel72Esu5g/SUQMBpOwR0VlTLkQ 7TKYged2VROKEx3xJ5lopHXxV3+L65lLYVVKMmPjeXq8N+nK23qYZWPBvAvfyxeZjjvA XpJ+CPGcgvDUQokX4zk2YUWry0siDNskuy7FQK+3eDxEpTajKOHvsfLEviJFs/fJPLuN 7jecfGQa8nStwtW9Ai75k7kt8XaXz6hPGylesD/J0x7fLLyPZCdQPJjmzW3vDKnpO9U4 bJs3ybptDLu1aEY0VW13benG1Kh1loWAoIISSXIYhy4kZzbr6LoNV2rCUiKDW17X1FRu 2wAQ== X-Forwarded-Encrypted: i=1; AJvYcCVWDQ2DWOetBkYEq+caGOrF7tis79K/AgbUQCj4uzx4x8ezBkrzbdiOV8fruEpU6wcS6W4044IFNYkEV2nerfig3Cs2T9Zh4WI/DLvg8QCSa71I X-Gm-Message-State: AOJu0YxtaOTEuLPtXcGrdumZnC4mQNcq7iV2MDpFG8pDagItswoh3dYV sTRHSIf+KYnDKudIsdeO5TuoNzLBW0WusoSoPr/GOP5M3QK237QevkypOOznzE5m6yiCzkvqVvm 9d5NDS94p4yAX+Ng2/m6x9ohfFzi+FCoyZcSq X-Google-Smtp-Source: AGHT+IGVt/XQVaDfTEC/G9DGWldk8bcpe2aR5FGvyxxgluTzFhmmeJneRqdQHZA7+bW3Y/G8zjxvfvqNiYbB3+hBrWY= X-Received: by 2002:a05:6214:21ec:b0:6a0:5103:44a9 with SMTP id p12-20020a05621421ec00b006a0510344a9mr534667qvj.35.1713900849124; Tue, 23 Apr 2024 12:34:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jacob Champion Date: Tue, 23 Apr 2024 12:33:58 -0700 Message-ID: Subject: Re: Direct SSL connection with ALPN and HBA rules To: Robert Haas Cc: Michael Paquier , Heikki Linnakangas , Postgres 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: Archived-At: Precedence: bulk On Tue, Apr 23, 2024 at 10:43=E2=80=AFAM Robert Haas wrote: > I've not followed this thread closely enough to understand the comment > about requiredirect maybe not actually requiring direct, but if that > were true it seems like it might be concerning. It may be my misunderstanding. This seems to imply bad behavior: > If the server rejects GSS encryption, SSL is > negotiated over the same TCP connection using the traditional postgres > protocol, regardless of sslnegotiation. As does this comment: > + /* > + * If enabled, try direct SSL. Unless we have a valid TCP connection = that > + * failed negotiating GSSAPI encryption or a plaintext connection in = case > + * of sslmode=3D'allow'; in that case we prefer to reuse the connecti= on with > + * negotiated SSL, instead of reconnecting to do direct SSL. The poin= t of > + * direct SSL is to avoid the roundtrip from the negotiation, but > + * reconnecting would also incur a roundtrip. > + */ but when I actually try those cases, I see that requiredirect does actually cause a direct SSL connection to be done, even with sslmode=3Dallow. So maybe it's just misleading documentation (or my misreading of it) that needs to be expanded? Am I missing a different corner case where requiredirect is ignored, Heikki? I still question the utility of allowing sslmode=3Dallow with sslnegotiation=3Drequiredirect, because it seems like you've made both the performance and security characteristics actively worse if you choose that combination. But I want to make sure I understand the current behavior correctly before I derail the discussion too much... Thanks, --Jacob