[Service] # Reload configuration with --force flag for reliability ExecReload= ExecReload=/usr/bin/caddy reload --config {{ caddy_config_file }} --force {% if caddy_systemd_security | default(true) %} # Enhanced security hardening beyond base service NoNewPrivileges=true CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE RemoveIPC=true # Filesystem restrictions (upgrade from ProtectSystem=full) ProtectSystem=strict ProtectHome=true ReadWritePaths={{ caddy_data_dir }} {{ caddy_log_dir }} BindReadOnlyPaths={{ caddy_config_dir }} ProtectKernelTunables=true ProtectKernelModules=true ProtectKernelLogs=true ProtectClock=true # Network and namespace restrictions RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX RestrictNamespaces=true RestrictRealtime=true RestrictSUIDSGID=true # Process restrictions LimitNPROC=1048576 MemoryDenyWriteExecute=true SystemCallFilter=@system-service SystemCallErrorNumber=EPERM # Logging (explicit configuration) StandardOutput=journal StandardError=journal SyslogIdentifier=caddy {% endif %}