Skip to content

Commit

Permalink
feat(appvm module): limit the user agent by UID
Browse files Browse the repository at this point in the history
- add condition to limit the user session for appvm module to the
  specified UID only. Prevents running multiple instances, e.g.,
  for admin account. Service does not run anyway as the address
  is already bound.

Signed-off-by: Manuel Bluhm <[email protected]>
  • Loading branch information
mbssrc committed Jan 10, 2025
1 parent 0780b02 commit ec8125a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nixos/modules/appvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ in
];
};

user = mkOption {
description = "Limit running this agent only in session of user with this UID.";
type = types.int;
default = 1000;
};

socketProxy = mkOption {
description = ''
Optional socket proxy module. If not provided, the module will not use a socket proxy.
Expand Down Expand Up @@ -141,6 +147,7 @@ in
after = [ "sockets.target" ];
wants = [ "sockets.target" ];
wantedBy = [ "default.target" ];
unitConfig.ConditionUser = "${cfg.user}";
serviceConfig = {
Type = "exec";
ExecStart = "${givc-agent}/bin/givc-agent";
Expand Down

0 comments on commit ec8125a

Please sign in to comment.