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 1s1VyE-00CqrO-G1 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Apr 2024 18:43:22 +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 1s1VyB-001M0A-KD for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Apr 2024 18:43:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1VyB-001M02-9e for pgsql-hackers@lists.postgresql.org; Mon, 29 Apr 2024 18:43:20 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s1Vy8-000eBY-Bt for pgsql-hackers@lists.postgresql.org; Mon, 29 Apr 2024 18:43:18 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-69b59c10720so11783676d6.3 for ; Mon, 29 Apr 2024 11:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1714416195; x=1715020995; 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=TVSCfUXIXOO62Ba9EXobFh4RZJVjBS0M88MCLr8bLXA=; b=YvdGSxeCVFogy26byOLeQG+dlm5b7w/vfCMAUCnxE+5rZ3W4JmhtOFvy9d5nEUz3Bw YTPycvKSiNz0XPooszAbA1fhKhlI6/MYKJJA4MQTXIgEWX8lQhYiGFNC6hVjBGH3OyuF pw2i+XH5TIuCePpviAkkioq9HBX9D+KLcBAujVNvszLEr/duLLTnjKoLsmgug/pnjNrc nRIV9RKGM9Gi0eHVXiwdpSRJXZbe/O7mmL+xzdEVK9PcZGlSgWncuynBovYZg93YSVwU PAYpWAXGI47/aXDvNN/kSwLaJoZ4d8r5iFXqWMkDwfqw7FE+QhYHKKOZiq0kQhLPMCje xBuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714416195; x=1715020995; 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=TVSCfUXIXOO62Ba9EXobFh4RZJVjBS0M88MCLr8bLXA=; b=aa4ylkUa+hLGeZXOFa2U03UkgidRt8WbJW+v5fk58mkepl2AksTKUO6sKpMcJXpeem 5FXZyD4RTpbcq29qTa++jse5oK9i8OI4K9Gp6JtkybwjvYDP0WrtiYURq7Yd4qUnIVOu 3v9XEihyTyo5WlT04jHmLhv3sTK1W7Ygh7RA0iCM7tRARk2EAOREaI/wFNcLtfl1hamo LorjswyfnG5t7rxzUxczv6wq8IyCwfU/MCW/rEmynligASg2jIRCLSyxZe5xjuzZzZyH fRcrEfKEeNHNAO2hPF0hcAX/F+hH6BgyOROL58BlSLxQCHlm0WQTe6Booia0VOONeZnn fJDA== X-Forwarded-Encrypted: i=1; AJvYcCXozivIfjWhy6paSuAM8vRw5hxAYOXsUmXuxt25OFT/ZSb3l2W1iNt/2em6I0qaCtzKS35zqCTWfFErJGTPypddgMB1ZYcyhOH4zBWdDcrfdppO X-Gm-Message-State: AOJu0Ywync5doUaKql/vrRdoE0uEnda4u9kaNzVwnh9YTMnYCd00IOIT SqUIYogocEM0Wgo0oD6Q2jCFiOdelAlXdkeKWf8aLCwDixfh60Z+L/2UEaZ2t+SPuVxqWvgdWu+ sff3k5CC+d5UPkn+uC9FPy4dTzKVcxI5oiTRi X-Google-Smtp-Source: AGHT+IFWnAp12f1DPH+dlkZIrcmNpN4ZA0dLbufriNza4gkYtoJ4FV1fWvOc0HjljmB+teJR3Dv9EjTx1pP8gGqaZLk= X-Received: by 2002:ad4:5966:0:b0:6a0:7a42:128a with SMTP id eq6-20020ad45966000000b006a07a42128amr11466397qvb.0.1714416195243; Mon, 29 Apr 2024 11:43:15 -0700 (PDT) MIME-Version: 1.0 References: <5a79ed71-b365-4b20-80bc-9c2bf97bf84b@iki.fi> <3a6f126c-e1aa-4dcc-9252-9868308f6cf0@iki.fi> In-Reply-To: <3a6f126c-e1aa-4dcc-9252-9868308f6cf0@iki.fi> From: Jacob Champion Date: Mon, 29 Apr 2024 11:43:04 -0700 Message-ID: Subject: Re: Direct SSL connection with ALPN and HBA rules To: Heikki Linnakangas Cc: Robert Haas , Michael Paquier , 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 Mon, Apr 29, 2024 at 1:38=E2=80=AFAM Heikki Linnakangas wrote: > Sure, we'd try to fix them ASAP. But we've had the SSLRequest > negotiation since time immemorial. If a new vulnerability is found, it's > unlikely that we'd need to disable the SSLRequest negotiation altogether > to fix it. We'd be in serious trouble with back-branches in that case. > There's no sudden need to have a kill-switch for it. I'm not really arguing that you'd need the kill switch to fix a problem in the code. (At least, I'm not arguing that in this thread; I reserve the right to argue that in the future. :D) But between the point of time that a vulnerability is announced and a user has upgraded, it's really nice to have a switch as a mitigation. Even better if it's server-side, because then the DBA can protect all their clients without requiring action on their part. > Taking that to the extreme, you could argue for a kill-switch for every > feature, just in case there's a vulnerability in them. I agree that > authentication is more sensitive so reducing the surface of that is more > reasonable. And but nevertheless. I mean... that would be extreme, yeah. I don't think anyone's proposed that= . > If you only > have v17 servers in your environment, so you know all servers support > direct negotiation if they support SSL at all, but a mix of servers with > and without SSL, sslnegotiation=3Ddirectonly would reduce roundtrips with > sslmode=3Dprefer. But if you're in that situation, what does the use of directonly give you over `sslnegotiation=3Ddirect`? You already know that servers support direct, so there's no additional performance penalty from the less strict mode. > Making requiredirect to imply sslmode=3Drequire, or error out unless you > also set sslmode=3Drequire, feels like a cavalier way of forcing SSL. We > should have a serious discussion on making sslmode=3Drequire the default > instead. That would be a more direct way of nudging people to use SSL. > It would cause a lot of breakage, but it would also be a big improvement > to security. > > Consider how sslnegotiation=3Drequiredirect/directonly would feel, if we > made sslmode=3Drequire the default. If you explicitly set "sslmode=3Dpref= er" > or "sslmode=3Ddisable", it would be annoying if you would also need to > remove "sslnegotiation=3Drequiredirect" from your connection string. That's similar to how sslrootcert=3Dsystem already works. To me, it feels great, because I don't have to worry about nonsensical combinations (with the exception of GSS, which we've touched on above). libpq complains loudly if I try to shoot myself in the foot, and if I'm using sslrootcert=3Dsystem then it's a pretty clear signal that I care more about security than the temporary inconvenience of editing my connection string for one weird server that doesn't use SSL for some reason. > I think the best way forward for those is something like a new > "require_proto" parameter that you suggested upthread. Perhaps call it > "encryption", with options "none", "ssl", "gss" so that you can provide > multiple options and libpq will try them in the order specified. For > example: > > encryption=3Dnone > encryption=3Dssl, none # like sslmode=3Dprefer > encryption=3Dgss > encryption=3Dgss, ssl # try GSS first, then SSL > encryption=3Dssl, gss # try SSL first, then GSS > > This would make gssencmode and sslmode=3Ddisable/allow/prefer/require > settings obsolete. sslmode would stil be needed to distinguish between > verify-ca/verify-full though. But sslnegotiation would be still > orthogonal to that. I will give this some more thought. Thanks, --Jacob