Skip to content

Commit

Permalink
nixos/locate: update hardening from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Dec 4, 2024
1 parent 4c9ca53 commit 578e401
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion nixos/modules/misc/locate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,32 @@ in
PRUNE_BIND_MOUNTS = if cfg.pruneBindMounts then "yes" else "no";
};
serviceConfig = {
CapabilityBoundingSet = "CAP_DAC_READ_SEARCH CAP_CHOWN";
Nice = 19;
IOSchedulingClass = "idle";
IPAddressDeny = "any";
LockPersonality = true;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateTmp = "yes";
PrivateDevices = true;
PrivateNetwork = "yes";
NoNewPrivileges = "yes";
ProtectClock = true;
ProtectControlGroups = true;
ProtectHostname = true;
RestrictAddressFamilies = "AF_UNIX";
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
ReadOnlyPaths = "/";
# Use dirOf cfg.output because mlocate creates temporary files next to
# the actual database. We could specify and create them as well,
# but that would make this quite brittle when they change something.
# NOTE: If /var/cache does not exist, this leads to the misleading error message:
# update-locatedb.service: Failed at step NAMESPACE spawning …/update-locatedb-start: No such file or directory
ReadWritePaths = dirOf cfg.output;
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service @chown";
};
};

Expand Down

0 comments on commit 578e401

Please sign in to comment.