libreschool-pxeserver/root/etc/e-smith/templates/srv/ipxe/success_script.sh/50SSHKey
Paolo Asperti ef4e30b324
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
added a lot of images
2020-04-01 19:01:49 +02:00

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";
}