Security: harden systemd unit and add event rate limiting #29
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
qwc-open/backive!29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "security/systemd-and-ratelimit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Addresses the two remaining security issues.
Commit 1 — Harden systemd service unit (closes #6)
Rewrites
systemd/backive.servicewith comprehensive sandboxing:ProtectSystem=strict— read-only filesystem except explicit pathsProtectHome=read-only— backup sources in /home are readablePrivateTmp=yes— isolated /tmpNoNewPrivileges=no— required for sudo-based script executionProtectKernelTunables,ProtectKernelModules,ProtectControlGroupsMemoryDenyWriteExecute,LockPersonality,RestrictSUIDSGID,RestrictRealtimeSystemCallFilter=@system-service @mount— only needed syscall groupsReadWritePathsfor mount points, sockets, logs, databaseWorkingDirectory, added[Install]section, restart policyCommit 2 — Add rate limiting to event handler (closes #7)
Adds a token-bucket rate limiter (10 connections/second) to
events.go:rateLimitertype with thread-safe sliding-window logicTestRateLimiter— verifies token depletion and interval resetTestRateLimiterDropsConnection— verifies connections are dropped when limit is 0All 23 tests pass, coverage at 69.4%.
Closes #6, closes #7