Add guest user with same ssh keys as root and fix nodeinfo not waiting for clightning to warm up

This commit is contained in:
Jonas Nick
2018-11-23 15:49:13 +00:00
parent eca9864cf3
commit ac2be00c7f
4 changed files with 33 additions and 10 deletions

View File

@@ -52,6 +52,8 @@ in {
{ description = "Run clightningd";
path = [ pkgs.clightning pkgs.bitcoin ];
wantedBy = [ "multi-user.target" ];
requires = [ "bitcoind.service" ];
after = [ "bitcoind.service" ];
preStart = ''
mkdir -p ${home}/.lightning
ln -sf ${configFile} ${home}/.lightning/config
@@ -61,6 +63,7 @@ in {
ExecStart = "${pkgs.clightning}/bin/lightningd";
User = "clightning";
Restart = "on-failure";
RestartSec = "10s";
PrivateTmp = "true";
ProtectSystem = "full";
NoNewPrivileges = "true";

View File

@@ -51,12 +51,31 @@ in {
systemd.services.nodeinfo = {
description = "Get node info";
wantedBy = [ "multi-user.target" ];
after = [ "clightning.service" "tor.service" ];
path = [ pkgs.clightning pkgs.jq pkgs.sudo ];
serviceConfig = {
ExecStart = "${pkgs.bash}/bin/bash -c ${pkgs.nodeinfo}/bin/nodeinfo";
ExecStart="${pkgs.bash}/bin/bash ${pkgs.nodeinfo}/bin/nodeinfo";
User = "root";
Type = "simple";
RemainAfterExit="yes";
Restart = "on-failure";
RestartSec = "10s";
};
};
# Define a user account. Don't forget to set a password with passwd.
users.users.guest = {
isNormalUser = true;
};
systemd.services.copy-root-authorized-keys = {
description = "Copy root authorized keys";
wantedBy = [ "multi-user.target" ];
path = [ ];
serviceConfig = {
ExecStart = "${pkgs.bash}/bin/bash -c \"mkdir -p ${config.users.users.guest.home}/.ssh && cp ${config.users.users.root.home}/.vbox-nixops-client-key ${config.users.users.guest.home}/.ssh/authorized_keys && chown -R guest ${config.users.users.guest.home}/.ssh\"";
user = "root";
type = "oneshot";
};
};
};
}