feat: add read-only emily monitoring account
Adds a new NixOS module (greg.monitoring-access) that provisions a dedicated, SSH-key-only 'emily' user account across all managed hosts. The account is intentionally minimal-privilege: - No password set (SSH key auth only) - Not a member of wheel, no sudo/sudo-rs rules - Only extra group membership is systemd-journal, granting read access to system logs for monitoring/analysis tasks - Authorized key lives in home/ssh/emily_authorized_keys, mirroring the existing pattern used for the greg account's authorized_keys This lets the Hermes agent (emily) log in read-only to inspect logs and system state when asked, without any ability to modify configuration, escalate privileges, or run destructive commands. Module is imported unconditionally in modules/nixos/default.nix like the other nixos modules, and defaults to enabled; it can be disabled per-host via greg.monitoring-access.enable = false if ever needed.
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBUz4YsVKBERXDT9nl4lwWHoA7NkI7M1Wr3QEYtgz9hy emily-monitoring@thehellings.com
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#./kiwix-serve.nix
|
#./kiwix-serve.nix
|
||||||
./kubernetes.nix
|
./kubernetes.nix
|
||||||
./linode.nix
|
./linode.nix
|
||||||
|
./monitoring-access.nix
|
||||||
./podman.nix
|
./podman.nix
|
||||||
./print.nix
|
./print.nix
|
||||||
./proxy.nix
|
./proxy.nix
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.greg.monitoring-access;
|
||||||
|
in
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
options.greg.monitoring-access = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Create a dedicated, read-only account (`emily`) for automated
|
||||||
|
monitoring and analysis by the Hermes agent. The account is
|
||||||
|
SSH-key-only (no password set), is not added to `wheel`, and is
|
||||||
|
granted no sudo rights. It only gets read access to the systemd
|
||||||
|
journal via group membership, which is sufficient for log
|
||||||
|
inspection and health/analysis tasks without any privileged
|
||||||
|
access to the rest of the system.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
sshKeys = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = lib.strings.splitString "\n" (
|
||||||
|
builtins.readFile ../../home/ssh/emily_authorized_keys
|
||||||
|
);
|
||||||
|
description = "SSH public keys authorized to log in as the monitoring account.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
users.groups.emily = { };
|
||||||
|
|
||||||
|
users.users.emily = {
|
||||||
|
isNormalUser = true;
|
||||||
|
createHome = true;
|
||||||
|
description = "Read-only monitoring/analysis account (Hermes agent)";
|
||||||
|
group = "emily";
|
||||||
|
# No password is set on purpose: this account is SSH-key-only.
|
||||||
|
extraGroups = [
|
||||||
|
"systemd-journal" # read access to the journal for log analysis
|
||||||
|
];
|
||||||
|
shell = pkgs.bashInteractive;
|
||||||
|
openssh.authorizedKeys.keys = cfg.sshKeys;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user