Commit 5420ae11 authored by Alex Martens's avatar Alex Martens Committed by Pascal Bach
Browse files

nixos/minio: harden service

parent 8f5972c5
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -135,6 +135,44 @@ in
                (legacyCredentials cfg)
              else
                null;

            # hardening
            DevicePolicy = "closed";
            CapabilityBoundingSet = "";
            RestrictAddressFamilies = [
              "AF_INET"
              "AF_INET6"
              "AF_NETLINK"
              "AF_UNIX"
            ];
            DeviceAllow = "";
            NoNewPrivileges = true;
            PrivateDevices = true;
            PrivateMounts = true;
            PrivateTmp = true;
            PrivateUsers = true;
            ProtectClock = true;
            ProtectControlGroups = true;
            ProtectHome = true;
            ProtectKernelLogs = true;
            ProtectKernelModules = true;
            ProtectKernelTunables = true;
            MemoryDenyWriteExecute = true;
            LockPersonality = true;
            RemoveIPC = true;
            RestrictNamespaces = true;
            RestrictRealtime = true;
            RestrictSUIDSGID = true;
            SystemCallArchitectures = "native";
            SystemCallFilter = [
              "@system-service"
              "~@privileged"
            ];
            ProtectProc = "invisible";
            ProtectHostname = true;
            UMask = "0077";
            # minio opens /proc/mounts on startup
            ProcSubset = "all";
          };
          environment = {
            MINIO_REGION = "${cfg.region}";