From 8256685f8692dc99e4cca8575b4da68cf80799a3 Mon Sep 17 00:00:00 2001 From: Kurt H Maier Date: Fri, 25 Mar 2022 10:24:44 -0700 Subject: [PATCH] xcatconfig: add ed25519 host key support --- xCAT-server/sbin/xcatconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index f1b1c2a71..1d0b5877b 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1011,6 +1011,21 @@ sub genSSHNodeHostKey else{ push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_ecdsa_key"; } + + # see if this system supports the ed25519 + xCAT::Utils->runcmd('rm -rf /tmp/ed25519_key >/dev/null 2>&1 ; /usr/bin/ssh-keygen -t ed25519 -f /tmp/ed25519_key -P "" &>/dev/null', 0); + if ($::RUNCMD_RC == 0) { + xCAT::MsgUtils->message('I', "Generating SSH2 ed25519 Key..."); + $cmd = +"/usr/bin/ssh-keygen -t ed25519 -f /etc/xcat/hostkeys/ssh_host_ed25519_key -C '' -N ''"; + $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message('E', "Could not generate SSH2 ed25519 key."); + } + else{ + push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_ed25519_key"; + } } if(@sshkeylist){