Skip to content

Commit

Permalink
nixos/ebusd: fix device access
Browse files Browse the repository at this point in the history
  • Loading branch information
Birdy2014 committed Dec 11, 2024
1 parent 79a7ad1 commit 0c1feac
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions nixos/modules/services/home-automation/ebusd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ in

config =
let
usesDev = lib.hasPrefix "/" cfg.device;
usesDev = lib.any (prefix: lib.hasPrefix prefix cfg.device) [
"/"
"ens:/"
"enh:/"
];
in
lib.mkIf cfg.enable {
systemd.services.ebusd = {
Expand Down Expand Up @@ -200,12 +204,14 @@ in

# Hardening
CapabilityBoundingSet = "";
DeviceAllow = lib.optionals usesDev [ cfg.device ];
DeviceAllow = lib.optionals usesDev [
(lib.removePrefix "ens:" (lib.removePrefix "enh:" cfg.device))
];
DevicePolicy = "closed";
LockPersonality = true;
MemoryDenyWriteExecute = false;
NoNewPrivileges = true;
PrivateDevices = usesDev;
PrivateDevices = !usesDev;
PrivateUsers = true;
PrivateTmp = true;
ProtectClock = true;
Expand Down

0 comments on commit 0c1feac

Please sign in to comment.