diff options
| author | tv <tv@krebsco.de> | 2026-11-21 02:22:33 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-21 04:08:09 +0100 |
| commit | 3be3ae00ca23ee34b7c7c32e311ea3d23fe15ca0 (patch) | |
| tree | b272d70b461a8f404de4839537495d8920aa0837 /configs | |
| parent | cac7bb96306432ebd5a012570c05e81706dbca26 (diff) | |
configs/hermes: a normal user, with a 0700 home
hermes was the module's system user, with its home group-writable and
setgid (2770), for the module's hostUsers, which aren't used here: anyone
in the group could read the Claude login and hermes.env's secrets. Now
it's a normal user (still in its group hermes), and its home is 0700:
systemd-tmpfiles takes the first line for a path and ignores the
module's (with a warning), and hermes-agent-setup undoes the module
script's chmod 2770.
Diffstat (limited to 'configs')
| -rw-r--r-- | configs/hermes.nix | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/configs/hermes.nix b/configs/hermes.nix index 3cf726a..633d804 100644 --- a/configs/hermes.nix +++ b/configs/hermes.nix @@ -152,9 +152,19 @@ in nixpkgs.config.allowUnfreePredicate = pkg: lib.getName pkg == "claude-code"; fc.home.required = true; - # /home is mounted after users get created; the module's tmpfiles create - # the home instead. - users.users.hermes.createHome = lib.mkForce false; + # A normal user, with a home like any other. /home is mounted after + # users get created, see tmpfiles below. + users.users.hermes = { + isSystemUser = lib.mkForce false; + isNormalUser = true; + createHome = lib.mkForce false; + }; + # 0700 rather than the module's 2770 (setgid, for its hostUsers, which + # aren't used here): before it, so it's the one systemd-tmpfiles takes + # (it ignores later lines for the same path, with a warning). + systemd.tmpfiles.rules = lib.mkBefore [ + "d ${config.services.hermes-agent.stateDir} 0700 hermes hermes -" + ]; systemd.services.hermes-agent-setup.unitConfig.RequiresMountsFor = config.services.hermes-agent.stateDir; systemd.services.hermes-agent.unitConfig.RequiresMountsFor = config.services.hermes-agent.stateDir; systemd.services.hermes-tmux.unitConfig.RequiresMountsFor = config.services.hermes-agent.stateDir; @@ -220,6 +230,9 @@ in # Writable for hermes, too, see HERMES_MANAGED below. chmod 0660 ${config.services.hermes-agent.stateDir}/.hermes/config.yaml + + # The module's script makes it 2770, see tmpfiles above. + chmod 0700 ${config.services.hermes-agent.stateDir} ''; }; |
