From 1ba8689d21184c3ec750955677d0175abb5d78f8 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 11 May 2009 12:27:30 +0000 Subject: [PATCH] hostkey check must be in both the /install/postscript/hostkey and the /etc/xcat/hostkey directory git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3336 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index c802bbc73..bc2428e0b 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3859,6 +3859,40 @@ sub checkCredFiles $rsp->{data}->[0] = "Error: $dir is missing."; xCAT::MsgUtils->message("I", $rsp, $cb); } + # ssh hostkeys + my $dir = "/etc/xcat/hostkeys"; + if (-d $dir) + { + my $file = "$dir/ssh_host_key.pub"; + if (-e $file) + { + my $file2 = "$dir/*.pub"; # all public keys + my $cmd = "/bin/chmod 0644 $file2"; + my $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Error on command: $cmd"; + xCAT::MsgUtils->message("I", $rsp, $cb); + + } + } + else + { # hostkey missing + my $rsp = {}; + $rsp->{data}->[0] = "Error: $file is missing."; + xCAT::MsgUtils->message("I", $rsp, $cb); + } + } + else + { + my $rsp = {}; + $rsp->{data}->[0] = "Error: $dir is missing."; + xCAT::MsgUtils->message("I", $rsp, $cb); + } + + # ssh directory + my $dir = "/install/postscripts/_ssh"; # ssh directory my $dir = "/install/postscripts/_ssh";