public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH http-server] fix #4802: reduce CA lookups while proxying
@ 2023-07-03  7:18 Fabian Grünbichler
  2023-07-03  7:42 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2023-07-03  7:18 UTC (permalink / raw)
  To: pve-devel; +Cc: Roland Kletzing

openssl as packaged in Debian bookworm now ships a compat symlink for the
"combined" CA certificates file (CAfile) as managed by update-ca-certificates.
this symlink is in addition to the CApath one that has been around for a file.
the new symlink in turn gets picked up by openssl-using code that uses the
default values for the trust store.

every TLS context initialization now reads the full combined file, even if no
TLS is actually employed on a connection. we do such an initialization for
every proxied connection (where our HTTP server is the client).

by specifying an explicit CA path (that is identical to the default one), the
old behaviour of looking up each CA certificate individually iff needed is
enabled again.

for an API endpoint where HTTP request handling is the bottle neck (as opposed
to the actual API handler), this improves performance of proxied requests to be
back in line with unproxied ones handled directly by the unprivileged daemon.
for all proxied requests, CPU usage is decreased as well.

the default CAfile and CApath contain the same certificates, so there should be
no change in trusted certificates. additionally, certificate fingerprints are
pinned in this context and verified against the cache of pinned fingerprints.

Reported-by: Roland Kletzing <roland.kletzing@cybercon.de>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    CA cert access was verified using strace

 src/PVE/APIServer/AnyEvent.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 1fd7a74..07d8f20 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -767,6 +767,7 @@ sub proxy_request {
 	    sslv2 => 0,
 	    sslv3 => 0,
 	    verify => 1,
+	    ca_path => '/usr/lib/ssl/certs', # to avoid loading the combined CA cert file
 	    verify_cb => sub {
 		my (undef, undef, undef, $depth, undef, undef, $cert) = @_;
 		# we don't care about intermediate or root certificates
-- 
2.39.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-03  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03  7:18 [pve-devel] [PATCH http-server] fix #4802: reduce CA lookups while proxying Fabian Grünbichler
2023-07-03  7:42 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal