From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9B8AC72B44 for ; Tue, 13 Apr 2021 14:17:22 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 21AC02A701 for ; Tue, 13 Apr 2021 14:16:52 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 17C452A6C8 for ; Tue, 13 Apr 2021 14:16:51 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D59DE45A74 for ; Tue, 13 Apr 2021 14:16:50 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Tue, 13 Apr 2021 14:16:28 +0200 Message-Id: <20210413121640.3602975-11-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210413121640.3602975-1-f.gruenbichler@proxmox.com> References: <20210413121640.3602975-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [remoteconfig.pm] Subject: [pve-devel] [PATCH cluster 4/4] get_remote_info: also return FP if available X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 12:17:22 -0000 Signed-off-by: Fabian Grünbichler --- data/PVE/RemoteConfig.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/data/PVE/RemoteConfig.pm b/data/PVE/RemoteConfig.pm index 563e5c1..c4b8499 100644 --- a/data/PVE/RemoteConfig.pm +++ b/data/PVE/RemoteConfig.pm @@ -191,7 +191,8 @@ sub get_remote_info { port => 8006, }; - if (my $fp = $api_node->{fingerprint}) { + my $fp; + if ($fp = $api_node->{fingerprint}) { $conn_args->{cached_fingerprints} = { uc($fp) => 1 }; } else { # FIXME add proper parameter to APIClient @@ -207,14 +208,24 @@ sub get_remote_info { my $conn = PVE::APIClient::LWP->new(%$conn_args); - my $args = {}; $args->{cidr} = $network_cidr if $network_cidr; - print "Request IP information of node '$node'\n"; - my $res = $conn->get("/nodes/$node/addr", $args); + print "Requesting IP information of node '$node'\n"; + my $ips = $conn->get("/nodes/$node/addr", $args); + + if ($host ne $node) { + print "Requesting certificate information of node '$node'\n"; + my $cert_info = $conn->get("/nodes/$node/certificates/info"); + foreach my $cert (@$cert_info) { + $fp = $cert->{fingerprint} if $cert->{filename} ne 'pve-root-ca.pem'; + last if $cert->{filename} eq 'pveproxy-ssl.pem'; + } + } + + $fp = uc($fp) if $fp; - return ($res, $conn_args); + return ($ips, $fp, $conn_args); } sub complete_remote_cluster { -- 2.20.1