weewx: harden systemd service
This commit is contained in:
parent
a27dd3c3dd
commit
3c3dd10fca
2 changed files with 22 additions and 0 deletions
|
@ -170,6 +170,7 @@
|
||||||
|
|
||||||
perSystem = { config, pkgs, inputs', ... }: {
|
perSystem = { config, pkgs, inputs', ... }: {
|
||||||
treefmt = {
|
treefmt = {
|
||||||
|
package = pkgs.treefmt1;
|
||||||
inherit (config.flake-root) projectRootFile;
|
inherit (config.flake-root) projectRootFile;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
|
|
@ -41,6 +41,27 @@ in
|
||||||
Group = "weewx";
|
Group = "weewx";
|
||||||
ExecStart = "${pkg}/bin/weewxd --config=${config.age.secrets.weewx-config.path}";
|
ExecStart = "${pkg}/bin/weewxd --config=${config.age.secrets.weewx-config.path}";
|
||||||
ExecStopPost = "-!${lib.getExe pkgs.umount} ${home}/weewx-data";
|
ExecStopPost = "-!${lib.getExe pkgs.umount} ${home}/weewx-data";
|
||||||
|
|
||||||
|
CapabilityBoundingSet = [ "" ];
|
||||||
|
DeviceAllow = [ "" ];
|
||||||
|
LockPersonality = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateUsers = true;
|
||||||
|
ProcSubset = "pid";
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ProtectHome = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectProc = "invisible";
|
||||||
|
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallFilter = [ "@system-service" "~@privileged" "~@resources" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue