public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster 4/4] pvecm: stop merging SSH known hosts by default
Date: Thu, 11 Jan 2024 11:51:18 +0100	[thread overview]
Message-ID: <20240111105123.370028-5-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20240111105123.370028-1-f.gruenbichler@proxmox.com>

and allow explicitly unmerging to remove the symlink altogether.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/PVE/CLI/pvecm.pm     | 10 ++++++++--
 src/PVE/Cluster/Setup.pm |  9 ++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
index 0005e4b..0e8ca8f 100755
--- a/src/PVE/CLI/pvecm.pm
+++ b/src/PVE/CLI/pvecm.pm
@@ -567,12 +567,18 @@ __PACKAGE__->register_method ({
 		type => 'boolean',
 		optional => 1,
 	    },
+	    'unmerge-known-hosts' => {
+		description => "Unmerge legacy SSH known hosts.",
+		type => 'boolean',
+		optional => 1,
+		default => 0,
+	    },
 	},
     },
     returns => { type => 'null' },
     code => sub {
 	my ($param) = @_;
-	my ($force_new_cert, $silent) = $param->@{qw(force silent)};
+	my ($force_new_cert, $silent, $unmerge) = $param->@{qw(force silent unmerge-known-hosts)};
 
 	# pveproxy's ExecStartPre calls this, and as we do IO (on /etc/pve) that can hang
 	# (uninterruptible D state) we could fail the whole service, rendering the API guaranteed
@@ -585,7 +591,7 @@ __PACKAGE__->register_method ({
 		usleep(100 * 1000);
 	    }
 
-	    PVE::Cluster::Setup::updatecerts_and_ssh($force_new_cert, $silent);
+	    PVE::Cluster::Setup::updatecerts_and_ssh($force_new_cert, $silent, $unmerge);
 	    PVE::Cluster::prepare_observed_file_basedirs();
 	});
 	if ($got_timeout) {
diff --git a/src/PVE/Cluster/Setup.pm b/src/PVE/Cluster/Setup.pm
index 4b6f013..42dff85 100644
--- a/src/PVE/Cluster/Setup.pm
+++ b/src/PVE/Cluster/Setup.pm
@@ -816,7 +816,7 @@ sub generate_local_files {
 }
 
 sub updatecerts_and_ssh {
-    my ($force_new_cert, $silent) = @_;
+    my ($force_new_cert, $silent, $unmerge_ssh) = @_;
 
     my $p = sub { print "$_[0]\n" if !$silent };
 
@@ -834,9 +834,12 @@ sub updatecerts_and_ssh {
     $p->("generate new node certificate") if $force_new_cert;
     gen_pve_node_files($nodename, $local_ip_address, $force_new_cert);
 
-    $p->("merge authorized SSH keys and known hosts");
+    $p->("merge authorized SSH keys");
     ssh_merge_keys();
-    ssh_merge_known_hosts($nodename, $local_ip_address, 1);
+    if ($unmerge_ssh) {
+	$p->("unmerge SSH known hosts");
+	ssh_unmerge_known_hosts();
+    }
     ssh_create_node_known_hosts($nodename);
     gen_pve_vzdump_files();
 }
-- 
2.39.2





  parent reply	other threads:[~2024-01-11 10:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 10:51 [pve-devel] [PATCH cluster/manager/storage/docs 0/9] fix #4886: improve SSH handling Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH cluster 1/4] fix #4886: write node SSH hostkey to pmxcfs Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH cluster 2/4] fix #4886: SSH: pin node's host key if available Fabian Grünbichler
     [not found]   ` <mailman.431.1705316883.335.pve-devel@lists.proxmox.com>
2024-01-15 11:51     ` Fabian Grünbichler
     [not found]       ` <mailman.436.1705329114.335.pve-devel@lists.proxmox.com>
2024-01-16  9:00         ` Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH cluster 3/4] ssh: expose SSH options on their own Fabian Grünbichler
2024-01-11 10:51 ` Fabian Grünbichler [this message]
2024-01-11 10:51 ` [pve-devel] [PATCH docs 1/2] ssh: make pitfalls a regular section instead of block Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH docs 2/2] ssh: document PVE-specific setup Fabian Grünbichler
     [not found]   ` <mailman.409.1705062826.335.pve-devel@lists.proxmox.com>
2024-01-12 12:40     ` Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH manager 1/2] vnc: use SSH command helper Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH manager 2/2] pvesh: " Fabian Grünbichler
2024-01-11 10:51 ` [pve-devel] [PATCH storage 1/1] upload: use SSH helper to get ssh/scp options Fabian Grünbichler
2024-01-12 12:12 ` [pve-devel] [PATCH cluster/manager/storage/docs 0/9] fix #4886: improve SSH handling Fabian Grünbichler
2024-01-15 15:53 ` Hannes Dürr
2024-01-16 10:34   ` Thomas Lamprecht
2024-01-16 10:40     ` Fabian Grünbichler
2024-01-16 10:49       ` Thomas Lamprecht
2024-01-16 11:58     ` Hannes Dürr
2024-04-19  7:11 ` [pve-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240111105123.370028-5-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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