mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
nebula: Configure ssh server
This commit is contained in:
parent
94ac7bbca3
commit
b4191c56aa
2 changed files with 39 additions and 3 deletions
|
|
@ -61,11 +61,11 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
sops.secrets."nebula/host-key" = {
|
sops.secrets."nebula/host-key" = {
|
||||||
owner = config.users.users.nebula-main.name;
|
owner = config.users.users.nebula-mesh.name;
|
||||||
restartUnits = [ "nebula@main.service" ];
|
restartUnits = [ "nebula@mesh.service" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nebula.networks.main = {
|
services.nebula.networks.mesh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
ca = ./ca.crt;
|
ca = ./ca.crt;
|
||||||
|
|
@ -106,5 +106,7 @@ in
|
||||||
logging.level = "warning";
|
logging.level = "warning";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networking.firewall.trustedInterfaces = [ "nebula.mesh" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
modules/system/services/nebula/sshd.nix
Normal file
34
modules/system/services/nebula/sshd.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.custom.services.nebula.node;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.custom.services.nebula.node.sshd = {
|
||||||
|
enable = lib.mkEnableOption "" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 22;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf (cfg.enable && cfg.sshd.enable) {
|
||||||
|
meta.ports.tcp = [ cfg.sshd.port ];
|
||||||
|
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = false;
|
||||||
|
ports = [ ];
|
||||||
|
listenAddresses = lib.singleton {
|
||||||
|
addr = cfg.address;
|
||||||
|
inherit (cfg.sshd) port;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.sshd = {
|
||||||
|
requires = [ "nebula@mesh.service" ];
|
||||||
|
after = [ "nebula@mesh.service" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue