Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/locate: update hardening from upstream #362126

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading