From c4368dc065efcbe059db764d805e70d04c477abd Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 19 Mar 2013 13:25:12 +0000 Subject: [PATCH] Support per-node ssh host keys if detected - Thanks to Frank Schwichtenberg git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15578 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/credentials.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index 78d117e0e..9d3d48615 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -137,19 +137,23 @@ sub process_request $tfilename = "$root/.xcat/client-cred.pem"; } elsif (/ssh_dsa_hostkey/) { - unless (-r "/etc/xcat/hostkeys/ssh_host_dsa_key") { + if (-r "/etc/xcat/hostkeys/$client/ssh_host_dsa_key") { + $tfilename="/etc/xcat/hostkeys/$client/ssh_host_rsa_key"; + } elsif (-r "/etc/xcat/hostkeys/ssh_host_dsa_key") { + $tfilename="/etc/xcat/hostkeys/ssh_host_dsa_key"; + } else { push @{$rsp->{'error'}},"Unable to read private DSA key from /etc/xcat/hostkeys"; next; } - $tfilename="/etc/xcat/hostkeys/ssh_host_dsa_key"; - } elsif (/ssh_rsa_hostkey/) { - unless (-r "/etc/xcat/hostkeys/ssh_host_rsa_key") { + if (-r "/etc/xcat/hostkeys/$client/ssh_host_rsa_key") { + $tfilename="/etc/xcat/hostkeys/$client/ssh_host_rsa_key"; + } elsif (-r "/etc/xcat/hostkeys/ssh_host_rsa_key") { + $tfilename="/etc/xcat/hostkeys/ssh_host_rsa_key"; + } else { push @{$rsp->{'error'}},"Unable to read private RSA key from /etc/xcat/hostkeys"; next; } - $tfilename="/etc/xcat/hostkeys/ssh_host_rsa_key"; - } elsif (/xcat_cfgloc/) { unless (-r "/etc/xcat/cfgloc") { push @{$rsp->{'error'}},"Unable to read xCAT database location";