@@ -250,12 +250,26 @@ in
250250 Type = "simple";
251251 Restart = "on-failure";
252252 PIDFile = "/run/fail2ban/fail2ban.pid";
253−
254− ReadOnlyDirectories = "/";
255− ReadWriteDirectories = "/run/fail2ban /var/tmp /var/lib";
256− PrivateTmp = "true";
253+ # Capabilities
254+ CapabilityBoundingSet = [ "CAP_AUDIT_READ" "CAP_DAC_READ_SEARCH" "CAP_NET_ADMIN" "CAP_NET_RAW" ];
255+ # Security
256+ NoNewPrivileges = true;
257+ # Directory
257258 RuntimeDirectory = "fail2ban";
258− CapabilityBoundingSet = "CAP_DAC_READ_SEARCH CAP_NET_ADMIN CAP_NET_RAW";
259+ RuntimeDirectoryMode = "0750";
260+ StateDirectory = "fail2ban";
261+ StateDirectoryMode = "0750";
262+ LogsDirectory = "fail2ban";
263+ LogsDirectoryMode = "0750";
264+ # Sandboxing
265+ ProtectSystem = "strict";
266+ ProtectHome = true;
267+ PrivateTmp = true;
268+ PrivateDevices = true;
269+ ProtectHostname = true;
270+ ProtectKernelTunables = true;
271+ ProtectKernelModules = true;
272+ ProtectControlGroups = true;
259273 };
260274 };
261275