nixos-container: Add command show-host-key
This is used by nixops.
This commit is contained in:
parent
ddd8f0cf66
commit
b18f503f1a
@ -27,6 +27,7 @@ Usage: nixos-container list
|
||||
nixos-container run <container-name> -- args...
|
||||
nixos-container set-root-password <container-name> <password>
|
||||
nixos-container show-ip <container-name>
|
||||
nixos-container show-host-key <container-name>
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
@ -169,7 +170,7 @@ my $confFile = "/etc/containers/$containerName.conf";
|
||||
if (!-e $confFile) {
|
||||
if ($action eq "destroy") {
|
||||
exit 0;
|
||||
} else {
|
||||
} elsif ($action eq "status") {
|
||||
print "gone\n";
|
||||
}
|
||||
die "$0: container ‘$containerName’ does not exist\n" ;
|
||||
@ -264,6 +265,12 @@ elsif ($action eq "show-ip") {
|
||||
print "$1\n";
|
||||
}
|
||||
|
||||
elsif ($action eq "show-host-key") {
|
||||
my $fn = "$root/etc/ssh/ssh_host_ecdsa_key.pub";
|
||||
exit 1 if ! -f $fn;
|
||||
print read_file($fn);
|
||||
}
|
||||
|
||||
else {
|
||||
die "$0: unknown action ‘$action’\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user