Files
.pouch/skills/host-sec-check/references/cleanup.md
T
2026-09-04 11:54:07 +08:00

60 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 处置(用户同意之后)
## 顺序
1. 证据已落盘(collect 输出、关键 ls/hexdump/docker inspect)
2. 停进程 / 停容器
3. 删或占位文件
4. 关公网端口
5. 最后才重启(卸已加载的隐藏库)
## 占位
对矿机路径(`/usr/bin/perfcc`、`/tmp/javavm64`、隐藏 docker 根名等):
```bash
chattr -i "$path" 2>/dev/null
rm -f "$path"
: > "$path"
chmod 000 "$path"
chattr +i "$path"
```
`/etc/ld.so.preload` 占空文件,权限 `644` + immutable,让动态链接器能读到「没有库」。
目录型隐藏根:停进程并卸挂载后删除,再在同名路径放 immutable 空文件,阻止再 `mkdir`。
改 immutable 时用容器自带 `chattr` 操作 `/host/...`,不要 `chroot` 到宿主机再跑 chattr。见 access.md。
## 容器
```bash
docker stop NAME && docker rm NAME
docker rmi IMAGE
```
不要 `docker system prune -a`。
## 端口
- 入口在本机 loopback → `127.0.0.1:PORT:CONTAINER`
- 入口走 Tailscale 主机名 → 必须绑 **当前 Tailscale IPv4**,不能只绑 127.0.0.1
- 可同时绑 loopback + Tailscale,禁止 `0.0.0.0` / `[::]`
改 compose 后 force-recreate,再从公网 IP 和业务域名两边探测。
## rpcbind
```bash
systemctl disable --now rpcbind.socket rpcbind.service
systemctl mask rpcbind.socket rpcbind.service
```
无对外 NFS 再做。确认 `:111` 消失。
## 重启
重启前确认业务是 `restart: always`,并告知会短暂中断。
重启后:`grep -l <so名> /proc/*/maps` 为 0;若已清 hugepage 则 `HugePages_Total` 为 0;域名 200。