TMAegisBeta
Thêm quy tắc cho nginx

NGINX

TMA-NGINX-2.2.2

Ensure the NGINX service account is locked

Trung bìnhCấp 1Tự độngnginx

Mô tả

The NGINX service account must not have a usable password and should be explicitly locked in the system's shadow file to prevent direct login or password-based privilege escalation. Reads the account from the user directive and expects passwd -S to report L or LK (run as root). Evaluated on the merged configuration printed by `nginx -T` (all included files; needs permission to read them). CIS marks this recommendation Manual; the automated check implements its audit procedure.

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
out=$(nginx -T 2>/dev/null) || exit 1; u=$(printf '%s\n' "$out" | awk '$1=="user"{x=$2; sub(/;$/,"",x); print x; exit}'); [ -n "$u" ] || { echo noncompliant; exit 0; }; s=$(passwd -S "$u" 2>/dev/null) || exit 1; printf '%s\n' "$s" | awk '{print ($2=="L"||$2=="LK")?"compliant":"noncompliant"}'
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

Lock the account: passwd -l <nginx user>.

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
nginxaccounts
Tham chiếu
CIS NGINX Benchmark v3.0.0 - 2.2.2 Ensure the NGINX service account is locked

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target nginx