This commit is contained in:
Motiejus Jakštys 2023-09-23 22:56:23 +03:00
parent 70e5230611
commit 95c4f94a25
5 changed files with 53 additions and 14 deletions

View File

@ -14,6 +14,8 @@ rec {
borgstor = 504;
jakstpub = 505;
certget = 506;
};
ports = {

View File

@ -72,6 +72,12 @@
silenceLogs = true;
};
certget = {
enable = true;
uidgid = myData.uidgid.certget;
sshKeys = [myData.hosts."vno1-oh2.servers.jakst".publicKey];
};
borgstor = {
enable = true;
dataDir = "/data/borg";

View File

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.mj.services.certget;
in {
options.mj.services.certget = with lib.types; {
enable = lib.mkEnableOption "receive acme certs from somewhere";
uidgid = lib.mkOption {type = int;};
sshKeys = lib.mkOption {type = listOf str;};
};
config = lib.mkIf cfg.enable {
users.users.certget = {
description = "Cert Getter";
home = "/var/lib/certget";
shell = "/bin/sh";
group = "certget";
isSystemUser = true;
createHome = true;
uid = cfg.uidgid;
openssh.authorizedKeys.keys =
map (
k: "command=\"${pkgs.rrsync}/bin/rrsync /var/lib/certget\",restrict ${k}"
)
cfg.sshKeys;
};
users.groups.certget.gid = cfg.uidgid;
};
}

View File

@ -6,6 +6,7 @@
}: {
imports = [
./borgstor
./certget
./deployerbot
./friendlyport
./gitea

View File

@ -118,20 +118,18 @@ in {
cfg = config.mj.services.deployerbot.follower;
in
lib.mkIf cfg.enable {
users.users = {
deployerbot-follower = {
description = "Deployerbot Follower";
home = "/var/lib/deployerbot-follower";
shell = "/bin/sh";
group = "deployerbot-follower";
extraGroups = ["wheel"];
isSystemUser = true;
createHome = true;
uid = cfg.uidgid;
openssh.authorizedKeys.keys = let
restrictedPubKey = "from=\"${builtins.concatStringsSep "," cfg.sshAllowSubnets}\" " + cfg.publicKey;
in [restrictedPubKey];
};
users.users.deployerbot-follower = {
description = "Deployerbot Follower";
home = "/var/lib/deployerbot-follower";
shell = "/bin/sh";
group = "deployerbot-follower";
extraGroups = ["wheel"];
isSystemUser = true;
createHome = true;
uid = cfg.uidgid;
openssh.authorizedKeys.keys = let
restrictedPubKey = "from=\"${builtins.concatStringsSep "," cfg.sshAllowSubnets}\" " + cfg.publicKey;
in [restrictedPubKey];
};
users.groups.deployerbot-follower.gid = cfg.uidgid;
nix.settings.trusted-users = ["deployerbot-follower"];