Skip to content

Commit 9604bb7

Browse files
committed
fix: enhance service security with systemd hardening
Added security hardening options to the deepin-update-log-copy@.service file to improve system security and limit potential attack surfaces. The changes include enabling NoNewPrivileges to prevent privilege escalation, setting ProtectSystem=strict to protect system directories, and configuring specific ReadWritePaths to restrict file system access. Additional protections include restricting kernel module loading and real-time scheduling access. Log: Enhanced security for update log copy service with systemd hardening features Influence: 1. Verify update log copy functionality still works correctly 2. Test service operation with different user accounts 3. Confirm log files are properly copied to designated paths 4. Validate service cannot access unauthorized system areas 5. Test service behavior under restricted privilege conditions fix: 增强服务安全性,添加 systemd 加固选项 为 deepin-update-log-copy@.service 文件添加了安全加固选项,以提高系统 安全性并限制潜在攻击面。更改包括启用 NoNewPrivileges 防止权限提升,设置 ProtectSystem=strict 保护系统目录,以及配置特定的 ReadWritePaths 限制文 件系统访问。其他保护措施包括限制内核模块加载和实时调度访问。 Log: 通过 systemd 加固功能增强了更新日志复制服务的安全性 Influence: 1. 验证更新日志复制功能是否正常工作 2. 使用不同用户账户测试服务操作 3. 确认日志文件正确复制到指定路径 4. 验证服务无法访问未经授权的系统区域 5. 测试在受限权限条件下的服务行为
1 parent 97922fc commit 9604bb7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/dde-update/misc/deepin-update-log-copy@.service

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,27 @@ ExecStart=/usr/libexec/deepin-update-ui/copy-update-log.sh %i
77
User=root
88
StandardOutput=journal
99
StandardError=journal
10+
11+
# Security hardening
12+
NoNewPrivileges=yes
13+
# ProtectSystem=true
14+
ProtectKernelModules=yes
15+
RestrictRealtime=yes
16+
17+
# Phase 1: High priority security configurations (immediate implementation)
18+
ProtectKernelTunables=yes
19+
ProtectClock=yes
20+
MemoryDenyWriteExecute=yes
21+
RestrictSUIDSGID=yes
22+
23+
# Phase 2: Medium priority security configurations (implement after testing)
24+
PrivateDevices=yes
25+
PrivateIPC=yes
26+
27+
# Phase 3: Additional security configurations
28+
# PrivateTmp=yes # 注释掉:服务需要访问 /tmp/deepin-update-ui
29+
ProtectControlGroups=yes
30+
ProtectHostname=yes
31+
LockPersonality=yes
32+
RestrictNamespaces=yes
33+
# RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 # 注释掉:可能影响D-Bus通信

0 commit comments

Comments
 (0)