git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/mastodon: enable sandbox mode
commitf3a032dee5d2da64b0e925bf81293dd42d58e7fc authorIzorkin <izorkin@elven.pw> dateSun 14 Feb 2021, 22:07 (6 years ago) parent5db15c1
1 file changed+24
nixos/modules/services/web-apps/mastodon.nix+24
nixos/modules/services/web-apps/mastodon.nix+24
@@ -43,8 +43,32 @@ let
4343 LogsDirectoryMode = "0750";
4444 # Access write directories
4545 UMask = "0027";
46+ # Capabilities
47+ CapabilityBoundingSet = "";
48+ # Security
49+ NoNewPrivileges = true;
4650 # Sandboxing
51+ ProtectSystem = "strict";
52+ ProtectHome = true;
4753 PrivateTmp = true;
54+ PrivateDevices = true;
55+ PrivateUsers = true;
56+ ProtectClock = true;
57+ ProtectHostname = true;
58+ ProtectKernelLogs = true;
59+ ProtectKernelModules = true;
60+ ProtectKernelTunables = true;
61+ ProtectControlGroups = true;
62+ RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" "AF_NETLINK" ];
63+ RestrictNamespaces = true;
64+ LockPersonality = true;
65+ MemoryDenyWriteExecute = false;
66+ RestrictRealtime = true;
67+ RestrictSUIDSGID = true;
68+ PrivateMounts = true;
69+ # System Call Filtering
70+ SystemCallArchitectures = "native";
71+ SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @reboot @resources @setuid @swap";
4872 };
4973
5074 envFile = pkgs.writeText "mastodon.env" (lib.concatMapStrings (s: s + "\n") (