mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-07-30 17:49:43 +00:00
fix: Fix certificate and hostkey generation for EL10
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -2218,7 +2218,7 @@ sub CheckVersion
|
||||
Returns the os and version of the System you are running on
|
||||
Arguments:
|
||||
$type: which type of os infor you want. Supported values are:
|
||||
all,os,version,release
|
||||
all,os,version,release,platform
|
||||
Returns:
|
||||
0 - ok
|
||||
Globals:
|
||||
@@ -2228,7 +2228,7 @@ sub CheckVersion
|
||||
Example:
|
||||
my $os=(xCAT::Utils->osver{ ...}
|
||||
Comments:
|
||||
none
|
||||
type=all does not return platform for backward compatibility reasons
|
||||
|
||||
=cut
|
||||
|
||||
@@ -2246,6 +2246,7 @@ sub osver
|
||||
my $ver = '';
|
||||
my $rel = '';
|
||||
my $line = '';
|
||||
my $platform = '';
|
||||
my @lines;
|
||||
my $relfile;
|
||||
|
||||
@@ -2286,6 +2287,9 @@ sub osver
|
||||
if ($line =~ /^\s*PRETTY_NAME=\"?(.*)/) {
|
||||
$prettyname = $1;
|
||||
}
|
||||
if ($line =~ /^\s*PLATFORM_ID=\"?platform:(el\d+)/) {
|
||||
$platform = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2446,6 +2450,8 @@ sub osver
|
||||
return ($ver);
|
||||
} elsif ($type and $type =~ /release/) {
|
||||
return ($rel);
|
||||
} elsif ($type and $type =~ /platform/) {
|
||||
return ($platform);
|
||||
} else {
|
||||
return ("$os" . "$ver");
|
||||
}
|
||||
|
||||
+13
-10
@@ -1005,16 +1005,19 @@ sub genSSHNodeHostKey
|
||||
}
|
||||
|
||||
|
||||
xCAT::MsgUtils->message('I', "Generating SSH2 DSA Key...");
|
||||
$cmd =
|
||||
"/usr/bin/ssh-keygen -t dsa -f /etc/xcat/hostkeys/ssh_host_dsa_key -C '' -N ''";
|
||||
$outref = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message('E', "Could not generate SSH2 DSA key.");
|
||||
}
|
||||
else{
|
||||
push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_dsa_key";
|
||||
# Skip DSA generation in EL10+
|
||||
if (xCAT::Utils->osver("platform") =~ /el(\d+)/ and $1 < 10) {
|
||||
xCAT::MsgUtils->message('I', "Generating SSH2 DSA Key...");
|
||||
$cmd =
|
||||
"/usr/bin/ssh-keygen -t dsa -f /etc/xcat/hostkeys/ssh_host_dsa_key -C '' -N ''";
|
||||
$outref = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message('E', "Could not generate SSH2 DSA key.");
|
||||
}
|
||||
else{
|
||||
push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_dsa_key";
|
||||
}
|
||||
}
|
||||
|
||||
# see if this system supports the ecdsa
|
||||
|
||||
@@ -70,9 +70,9 @@ mkdir -p $USERHOME/.xcat
|
||||
cd $USERHOME/.xcat
|
||||
openssl genrsa -out client-key.pem 2048
|
||||
if [ $FORCE -eq 0 ]; then
|
||||
openssl req -config $XCATCADIR/openssl.cnf -new -key client-key.pem -out client-req.pem -extensions usr_cert -subj "/CN=$CNA"
|
||||
openssl req -config $XCATCADIR/openssl.cnf -new -key client-key.pem -out client-req.pem -subj "/CN=$CNA"
|
||||
else
|
||||
openssl req -config $XCATCADIR/openssl.cnf -new -key client-key.pem -out client-req.pem -extensions usr_cert -subj "/CN=$CNA" -batch
|
||||
openssl req -config $XCATCADIR/openssl.cnf -new -key client-key.pem -out client-req.pem -subj "/CN=$CNA" -batch
|
||||
fi
|
||||
cp client-req.pem $XCATDIR/ca/root.csr
|
||||
cd - >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user