Commit 7fffb3f1 authored by Leigh B Stoller's avatar Leigh B Stoller

Move the host keys contruction from ssh into this separate script.

parent bcfd18fd
#
# The template
#
use strict;
use libinstall;
use installvars;
sub Install($$$)
{
my ($server, $isupdate, $impotent) = @_;
# Replace if this script does an update for ip/domain.
return 0
if ($isupdate);
#
# Create a set of hostkeys for the images.
#
Phase "imagekeysdir", "Creating $IMAGEKEYS_DIR", sub {
DoneIfExists($IMAGEKEYS_DIR);
mkdir $IMAGEKEYS_DIR,0775 or
PhaseFail("Unable to create $IMAGEKEYS_DIR : $!");
ExecQuietFatal("$CHGRP tbadmin $IMAGEKEYS_DIR");
};
my %keytypes = (
"rsa1" => "ssh_host_key",
"rsa" => "ssh_host_rsa_key",
"dsa" => "ssh_host_dsa_key");
Phase "imagekeys", "Creating host keys for images", sub {
foreach my $type (keys(%keytypes)) {
my $name = $keytypes{$type};
Phase $type, "Creating $type host key", sub {
DoneIfExists("$IMAGEKEYS_DIR/$name");
ExecQuietFatal("$SSH_KEYGEN -t $type -N '' ".
" -f $IMAGEKEYS_DIR/$name");
};
}
};
return 0;
}
# Local Variables:
# mode:perl
# End:
...@@ -19,28 +19,6 @@ sub Install($$$) ...@@ -19,28 +19,6 @@ sub Install($$$)
ExecQuietFatal("$SSH_KEYGEN -t rsa -P '' -f $ROOT_PRIVKEY"); ExecQuietFatal("$SSH_KEYGEN -t rsa -P '' -f $ROOT_PRIVKEY");
}; };
# #
# Create a set of hostkeys for the images.
#
Phase "imagekeysdir", "Creating $IMAGEKEYS_DIR", sub {
DoneIfExists($IMAGEKEYS_DIR);
mkdir $IMAGEKEYS_DIR,0775 or
PhaseFail("Unable to create $IMAGEKEYS_DIR : $!");
ExecQuietFatal("$CHGRP tbadmin $IMAGEKEYS_DIR");
};
my %keytypes = (
"rsa1" => "ssh_host_key",
"rsa" => "ssh_host_rsa_key",
"dsa" => "ssh_host_dsa_key");
Phase "imagekeys", "Creating host keys for images", sub {
foreach my $type (keys(%keytypes)) {
my $name = $keytypes{$type};
ExecQuietFatal("$SSH_KEYGEN -t $type -N '' ".
" -f $IMAGEKEYS_DIR/$name");
}
};
#
# Stick it into the DB. # Stick it into the DB.
# WARNING: This sitevar (node/ssh_pubkey) is referenced in tmcd.c # WARNING: This sitevar (node/ssh_pubkey) is referenced in tmcd.c
# #
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment