fix(nixos): add operator to homelab-operators and configure daemon systemd sandbox
Core Architecture & Invariant CI / validate (pull_request) Failing after 1m2s
Core Architecture & Invariant CI / validate (pull_request) Failing after 1m2s
Closes #4
This commit is contained in:
1 parent
0b5ba58ecf
commit
2668dcc5a8
3 files changed
+11
-6
No files matched your search
@@ -63,9 +63,10 @@
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICAVPPMk+WApUd/fo78+lsRGnLKSlY4GDZiNGKwBAifD"
|
||||
];
|
||||
extraGroups = [
|
||||
"wheel" # sudo access
|
||||
"docker" # run docker without sudo
|
||||
"networkmanager" # modify network settings
|
||||
"wheel" # sudo access
|
||||
"docker" # run docker without sudo
|
||||
"homelab-operators" # access /run/homelab/appctl.sock
|
||||
"networkmanager" # modify network settings
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = config.homelab.operatorUser;
|
||||
SupplementaryGroups = [ "docker" ];
|
||||
SupplementaryGroups = [ "docker" "homelab-operators" ];
|
||||
WorkingDirectory = config.homelab.coreDir;
|
||||
ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [
|
||||
{
|
||||
@@ -137,12 +137,13 @@
|
||||
ReadWritePaths = [
|
||||
config.homelab.sitesDir
|
||||
"/home/${config.homelab.operatorUser}/.local/state/homelab"
|
||||
"/run/homelab"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Declarative Users and Groups for Control Plane Service Identity
|
||||
users.groups.homelab-operators = {};
|
||||
users.groups.homelab-operators.members = [ config.homelab.operatorUser ];
|
||||
users.users.homelab-appctl = {
|
||||
isSystemUser = true;
|
||||
group = "homelab-operators";
|
||||
@@ -168,6 +169,9 @@
|
||||
];
|
||||
|
||||
environment = {
|
||||
HOME = "/var/lib/homelab/appctl";
|
||||
DOCKER_CONFIG = "/var/lib/homelab/appctl/.docker";
|
||||
HOMELAB_DOMAIN = config.homelab.domain;
|
||||
APPCTL_SOCKET_PATH = "/run/homelab/appctl.sock";
|
||||
APPCTL_HTTP_HOST = "127.0.0.1";
|
||||
APPCTL_HTTP_PORT = "9001";
|
||||
|
||||
@@ -484,7 +484,7 @@ class AppctlDaemon:
|
||||
try:
|
||||
os.chmod(self.socket_path, 0o660)
|
||||
except OSError as e:
|
||||
logger.warning("Could not set mode 0660 on socket %s: %e", self.socket_path, e)
|
||||
logger.warning("Could not set mode 0660 on socket %s: %s", self.socket_path, e)
|
||||
|
||||
# 2. Prepare and bind TCP listener
|
||||
self.tcp_server = ThreadingHTTPServer((self.http_host, self.http_port), AppctlHTTPHandler)
|
||||
|
||||
Reference in new issue
Block a user