From 4855404f5ddb03d4da2df9bcf9027e7249a59769 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Fri, 17 Apr 2026 08:14:52 +0200 Subject: [PATCH] lldap: add hardening configuration --- modules/blocks/lldap.nix | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/modules/blocks/lldap.nix b/modules/blocks/lldap.nix index 2494c5f..696ec7c 100644 --- a/modules/blocks/lldap.nix +++ b/modules/blocks/lldap.nix @@ -418,6 +418,41 @@ in ) cfg.ensureUsers; }; + # Harden lldap following https://github.com/NixOS/nixpkgs/pull/487933 + systemd.services.lldap.serviceConfig = { + RemoveIPC = true; + RestrictNamespaces = true; + RestrictRealtime = true; + RestrictSUIDSGID = true; + RestrictAddressFamilies = [ + "AF_UNIX" + "AF_INET" + "AF_INET6" + ]; + SystemCallFilter = [ + "@system-service" + "~@privileged" + "~@resources" + ]; + SystemCallArchitectures = "native"; + CapabilityBoundingSet = ""; + LockPersonality = true; + NoNewPrivileges = true; + PrivateTmp = true; + PrivateDevices = true; + ProtectClock = true; + ProtectControlGroups = true; + ProtectHome = true; + ProtectHostname = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + ProtectSystem = "strict"; + ProtectProc = "invisible"; + ProcSubset = "pid"; + MemoryDenyWriteExecute = true; + }; + shb.mitmdump.instances."lldap-web" = lib.mkIf cfg.debug { listenPort = config.shb.lldap.webUIListenPort; upstreamPort = config.shb.lldap.webUIListenPort + 1;