* Sat Apr 13 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme

- fix script to recomment keys [SME: 12612]
  now comments rsa, dsa, ecdsa,ed25519. dropped rsa1
This commit is contained in:
2024-04-13 00:09:44 -04:00
parent 0d6a3cc276
commit eb410e3e74
2 changed files with 14 additions and 9 deletions

View File

@@ -84,14 +84,15 @@ SKIP: {
my $db = esmith::ConfigDB->open_ro or die "Could not open config db";
# Recomment the key in case the SystemName or DomainName changed.
my @change = (-f "/etc/ssh/ssh_host_key") ? ("-c", "-P", "")
for my $typek (qw(dsa rsa ecdsa ed25519)) {
# Recomment the key in case the SystemName or DomainName changed.
my @change = (-f "/etc/ssh/ssh_host_${typek}_key") ? ("-c", "-P", "")
: ("-q", "-N", "");
esmith::util::backgroundCommand (0,
"/usr/bin/ssh-keygen", @change, "-t", "rsa1",
"-f", "/etc/ssh/ssh_host_key",
"-C", "root@" . $db->get('SystemName')->value . "." . $db->get('DomainName')->value);
esmith::util::backgroundCommand (0,
"/usr/bin/ssh-keygen", @change, "-t", "$typek",
"-f", "/etc/ssh/ssh_host_key",
"-C", "root@" . $db->get('SystemName')->value . "." . $db->get('DomainName')->value);
}
exit (0);