From dad35bb816b14cde64b782718e13ed9666437814 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 22 Jul 2014 07:22:55 -0400 Subject: [PATCH] defect 4231 --- xCAT/postscripts/aixremoteshell | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/xCAT/postscripts/aixremoteshell b/xCAT/postscripts/aixremoteshell index f81d46cbe..7db4cb038 100755 --- a/xCAT/postscripts/aixremoteshell +++ b/xCAT/postscripts/aixremoteshell @@ -201,11 +201,31 @@ sub setupSSH $msg = "aixremoteshell: Could not get ssh_host_rsa_key file.\n"; `logger -t xcat -p local4.err $msg`; } - if ( $nodetype eq "service") { + # is there is a ecdsa host key on the node, then get the one from the MN/SN + my $filename = "/etc/ssh/ssh_host_ecdsa_key"; + if (-e $filename) { + my $response=&getresponse("ssh_ecdsa_hostkey"); + if (defined ($response) ) { + my $fd; + &runcmd("mkdir -p /etc/ssh"); + open($fd, '>',$filename); + print $fd $response; + close($fd); + + # set the permissions + my $cmd = "chmod 600 $filename > /dev/null 2>&1"; + &runcmd($cmd); + } + else { + $msg = "aixremoteshell: Could not get ssh_host_ecdsa_key file.\n"; + `logger -t xcat -p local4.err $msg`; + } + } + if ( $nodetype eq "service") { &runcmd("mkdir -p /etc/xcat/hostkeys; cp /etc/ssh/ssh* /etc/xcat/hostkeys/. > /dev/null 2>&1"); } - # Decide whether to enable ssh between the nodes - if ($enablesshbetweennodes eq "YES") { + # Decide whether to enable passwordless ssh between the nodes + if ($enablesshbetweennodes eq "YES") { my $response=&getresponse("ssh_root_key"); if (defined ($response) ) { my $fd; @@ -216,7 +236,6 @@ sub setupSSH close($fd); # set the permissions -#TODO - what perms are needed??? my $cmd = "chmod 600 $filename > /dev/null 2>&1"; &runcmd($cmd); @@ -227,8 +246,8 @@ sub setupSSH else { $msg = "aixremoteshell: Could not get id_rsa file.\n"; `logger -t xcat -p local4.err $msg`; - } - } + } + } return 0; }