feat: enhance security and resource limits#187
Conversation
- Harden systemd service with restrictive security settings - Add memory limits, IO weight, and OOM protection - Restrict file system access with ProtectSystem and ProtectHome - Define explicit read/write/exec paths and capabilities Log: enhance security and resource limits for diskmanager service.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR hardens the diskmanager systemd service unit by tightening security-related directives and adding resource limits such as memory constraints, IO weight, and OOM protection, while also adjusting .gitignore to account for the updated service asset. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review我来对这个diff进行详细审查:
+.auto-claude/这只是一个简单的添加,用于忽略.auto-claude/目录,没有明显问题。
安全相关改进:
性能相关:
建议改进:
具体改进建议: # 限制权限到最小必要集合
CapabilityBoundingSet=CAP_SYS_RAWIO CAP_MKNOD CAP_CHOWN CAP_FOWNER CAP_DAC_OVERRIDE
AmbientCapabilities=CAP_SYS_RAWIO CAP_MKNOD CAP_CHOWN CAP_FOWNER CAP_DAC_OVERRIDE
# 启用内核模块保护
ProtectKernelModules=true
# 限制网络访问
RestrictAddressFamilies=AF_UNIX
# 限制系统调用
SystemCallFilter=@system-service
# 限制可写路径
ReadWritePaths=/var/log/deepin /media /mnt这些修改可以在保证功能的同时,提高系统的安全性和稳定性。 |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- With the added ProtectSystem/ProtectHome and explicit ReadWritePaths/ReadOnlyPaths, double-check that all paths the daemon needs at runtime (e.g., under /run, /var, or device nodes) are explicitly allowed so the service doesn’t fail on less common code paths (e.g., error logging, tmp usage, or rare disk operations).
- Consider making the new memory/IO/OOM limit values configurable via environment or drop-in overrides rather than hardcoding them in the main unit, so operators can tune limits for different deployment sizes without forking the unit file.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- With the added ProtectSystem/ProtectHome and explicit ReadWritePaths/ReadOnlyPaths, double-check that all paths the daemon needs at runtime (e.g., under /run, /var, or device nodes) are explicitly allowed so the service doesn’t fail on less common code paths (e.g., error logging, tmp usage, or rare disk operations).
- Consider making the new memory/IO/OOM limit values configurable via environment or drop-in overrides rather than hardcoding them in the main unit, so operators can tune limits for different deployment sizes without forking the unit file.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, re2zero The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
|
This pr cannot be merged! (status: unstable) |
Log: enhance security and resource limits for diskmanager service.
Summary by Sourcery
Strengthen the diskmanager systemd service with stricter security hardening and resource limits.
Enhancements: