Skip to content

Commit

Permalink
ops/{security,service}: Usage about systemd-analyze security
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Oct 9, 2024
1 parent 564beb4 commit 628bad2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions docs/ops/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,7 @@ Passkey(通行密钥)则是目前最新的「无密码登录」技术,在
- root/sudo/IPMI 的权限不随意提供给运维无关人员。
- 这也包括了诸如 `docker` 的情况。
- 服务(包括容器在内)不随意暴露端口(特别是无限制 bind 到所有接口的情况),容器运行不随意提供 `--privileged`,运行的服务需要有自己的用户。
- 对于 systemd 服务,考虑使用 systemd 提供的安全加固功能。
<!-- TODO: 服务部分需要介绍 -->
- 对于 systemd 服务,考虑使用 systemd 提供的安全加固功能。详见[服务与日志管理中对 `systemd-analyze security` 的介绍](./service.md#service)

#### 使用扫描器检查已知的安全问题 {#scanner-known-vulnerabilities}

Expand Down
12 changes: 11 additions & 1 deletion docs/ops/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,17 @@ Service 也就是我们最常见的服务,它的配置文件中有一个 `[Ser

!!! tip

如果你有额外的安全需求,可以参考 [Sandboxing][systemd.exec.5#Sandboxing] 一节使用 systemd 提供的高级隔离功能。
如果你有额外的安全需求,可以参考 [Sandboxing][systemd.exec.5#Sandboxing] 一节使用 systemd 提供的高级隔离功能。可以使用 `systemd-analyze security` 命令检查整个系统的服务安全性配置情况,与单个服务的具体配置是否安全。该命令会根据服务配置计算 "exposure level" 分数,并且提供相关配置以及解释,类似如下:

```console
$ systemd-analyze security --no-pager caddy.service
NAME DESCRIPTION EXPOSURE
✗ RemoveIPC= Service user may leave SysV IPC objects aro… 0.1
✗ RootDirectory=/RootImage= Service runs within the host's root directo… 0.1
✓ User=/DynamicUser= Service runs under a static non-root user i…
✗ CapabilityBoundingSet=~CAP_SYS_TIME Service processes may change the system clo… 0.2
(以下省略)
```

#### Service Type {#service-type}

Expand Down

0 comments on commit 628bad2

Please sign in to comment.