1
0
mirror of synced 2026-05-01 22:26:08 +00:00

Fix 70-install-ssh in debian, print RSA fingerprint

This will fix 70-install-ssh, allowing it complete postinst by
generating host SSH keys for it. The resulting RSA host key
fingerprint is printed in an Installation summary at the end
of isntall. Next step is to apply the same change to the remaining
70-install-ssh's.
This commit is contained in:
Dmitry Nedospasov
2010-06-02 23:51:36 +02:00
parent 9c6f708a0d
commit 8cf4c83936
3 changed files with 62 additions and 23 deletions

View File

@@ -3933,12 +3933,22 @@ sub unMountImage
sub END
{
my $host_rsa_key = '';
#
# Unmount the image if it is still mounted.
#
if ( defined($MOUNT_POINT) )
{
#
# Before we unmount get the host's RSA key
#
my $key_path .= $MOUNT_POINT;
$key_path .= '/etc/ssh/ssh_host_rsa_key.pub';
if ( `ssh-keygen -lf $key_path` =~ /^(\S+)\s+(\S+)/ ) {
$host_rsa_key = $2;
} else {
$host_rsa_key = "N/A";
}
unMountImage($MOUNT_POINT);
}
@@ -3961,6 +3971,8 @@ sub END
# Did we fail? If so then we should remove the broken installation,
# unless "--keep" was specified.
#
# If we didn't fail, then we assume we succeeded, print a summary
#
if ( ($FAIL == 1) && ( !$CONFIG{ 'keep' } ) )
{
@@ -3971,5 +3983,22 @@ sub END
logprint("Removing failed install: $CONFIG{'hostname'}\n");
system("xen-delete-image --hostname=$CONFIG{'hostname'}");
} else {
#
# Assume success
#
logprint("\nInstallation Summary\n");
logprint("---------------------\n");
logprint("Hostname : $CONFIG{'hostname'}\n");
logprint("Distribution : $CONFIG{'dist'}\n");
logprint("IP-Address : ");
if ( $CONFIG{ 'dhcp' } ) {
logprint("dynamic");
} elsif( $CONFIG{ 'ip' } ) {
logprint( $CONFIG{ 'ip' } );
}
logprint("\n");
logprint("RSA Fingerprint : $host_rsa_key");
logprint("\n\n");
}
}