23 lines
527 B
Plaintext
23 lines
527 B
Plaintext
|
#
|
||
|
# 50SSHKey
|
||
|
#
|
||
|
{
|
||
|
use esmith::ConfigDB;
|
||
|
my $configdb = esmith::ConfigDB->open();
|
||
|
|
||
|
$keyfile = $configdb->get('client-manager')->prop('ManagementKeyFile')
|
||
|
or die "cannot get ManagementKeyFile value";
|
||
|
my $sshkey;
|
||
|
open(my $fh, '<', $keyfile) or die "cannot open file $keyfile";
|
||
|
{
|
||
|
local $/;
|
||
|
$sshkey = <$fh>;
|
||
|
}
|
||
|
close($fh);
|
||
|
|
||
|
$OUT .= "mkdir -p /root/.ssh\n";
|
||
|
$OUT .= "cat >/root/.ssh/authorized_keys <<EOF\n$sshkey\nEOF\n";
|
||
|
$OUT .= "chmod -R go-rwx /root/.ssh\n";
|
||
|
}
|
||
|
|