| 1 | [Unit] |
| 2 | Description=Deepin Log Viewer Daemon |
| 3 | Wants=dbus.socket |
| 4 | After=dbus.socket |
| 5 | |
| 6 | [Service] |
| 7 | Type=dbus |
| 8 | BusName=com.deepin.logviewer |
| 9 | ExecStart=/usr/lib/deepin-daemon/log-view-service |
| 10 | # cap能力不能填为空,否则日志收集工具启动卡,并且不能查看/var/log下日志,建议cap能力不能为dbus必查项 |
| 11 | #CapabilityBoundingSet=~CAP_NET_RAW |
| 12 | # 非root有阻塞,deepin-daemon启动后不能通过/proc/pid/exe获取启动进程全路径,下一阶段再按deepin-dameon启动 |
| 13 | #User=deepin-daemon |
| 14 | User=root |
| 15 | ProtectSystem=strict |
| 16 | # exportOpsLog 需要在 /var/log 下创建临时导出目录,须显式放开写权限 |
| 17 | ReadWritePaths=/var/log |
| 18 | MemoryMax=2G |
| 19 | IOWeight=200 |
| 20 | OOMScoreAdjust=-500 |
| 21 | Nice=-5 |
| 22 | |
| 23 | InaccessiblePaths=-/etc/shadow |
| 24 | InaccessiblePaths=-/etc/NetworkManager/system-connections |
| 25 | InaccessiblePaths=-/etc/pam.d |
| 26 | InaccessiblePaths=-/etc/security/ |
| 27 | InaccessiblePaths=-/etc/selinux/ |
| 28 | InaccessiblePaths=-/etc/deepin-elf-verify/ |
| 29 | InaccessiblePaths=-/etc/filearmor.d/ |
| 30 | InaccessiblePaths=-/etc/crypttab |
| 31 | InaccessiblePaths=-/etc/fstab |
| 32 | InaccessiblePaths=-/sysroot/ostree/repo/ |
| 33 | InaccessiblePaths=-/persistent/ostree/repo/ |
| 34 | InaccessiblePaths=-/usr/share/uadp |
| 35 | InaccessiblePaths=-/etc/sudoers |
| 36 | InaccessiblePaths=-/etc/sudoers.d |
| 37 | InaccessiblePaths=-/root |
| 38 | InaccessiblePaths=-/var/cache |
| 39 | InaccessiblePaths=-/var/spool |
| 40 | |
| 41 | NoNewPrivileges=true |
| 42 | # 传参需要/home,比如导出日志到/home路径下,读取/home/$user/.cache下应用日志 |
| 43 | #ProtectHome=false |
| 44 | ProtectProc=default |
| 45 | ProtectKernelTunables=true |
| 46 | ProtectKernelModules=true |
| 47 | ProtectControlGroups=true |
| 48 | ProtectClock=true |
| 49 | PrivateMounts=true |
| 50 | # 用于接收 ops log |
| 51 | #PrivateTmp=true |
| 52 | ReadWritePaths=/var/log/deepin |
| 53 | ReadWritePaths=/tmp /var/tmp /media /mnt /home |
| 54 | PrivateDevices=true |
| 55 | # V25: PrivateIPC recommended, but not effective for AF_UNIX (D-Bus uses AF_UNIX) |
| 56 | #PrivateIPC=true |
| 57 | PrivateNetwork=true |
| 58 | RestrictNamespaces=true |
| 59 | LockPersonality=true |
| 60 | RestrictRealtime=true |
| 61 | # RemoveIPC=false: Polkit authorization requires IPC/D-Bus communication |
| 62 | RemoveIPC=false |
| 63 | MemoryDenyWriteExecute=true |
| 64 | RestrictSUIDSGID=true |
| 65 | LimitMEMLOCK=infinity |
| 66 | |
| 67 | # V25: Restrict executable paths (recommended for security) |
| 68 | # Business requirement: Service needs to execute various system commands for log collection |
| 69 | # Commands used: cat, chmod, cp, mkdir, dmesg, journalctl, coredumpctl, readelf, |
| 70 | # udisksctl, apt, uname, lspci, lscpu, df, free, hwfirmware, dmidecode, etc. |
| 71 | # Paths from main.cpp: PATH includes /usr/bin, /usr/sbin, /sbin |
| 72 | ExecPaths=/usr/bin /usr/sbin /sbin /usr/lib /usr/lib/deepin-daemon |
| 73 | NoExecPaths=/var/tmp |
| 74 | |
| 75 | # 需要device权限,可能导出日志到U盘等外部设备 |
| 76 | #DeviceAllow=/dev/loop-control |
| 77 | # 需要使用network,进行埋点上报 |
| 78 | #RestrictFileSystems=~@network |