TMAegis
Thêm quy tắc cho nginx

NGINX

TMA-NGINX-2.3.2

Ensure access to NGINX directories and files is restricted

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

Mô tả

The NGINX configuration directory (/etc/nginx or equivalent) and its contents should have restrictive permissions to enforce the principle of least privilege. Directories should be accessible only by the root user and the root group (and potentially read/execute by the group), but not by others. Files should be readable/writable by root and readable by the group, but inaccessible to others. Counts directories under /etc/nginx more permissive than 750 and files more permissive than 640; expects 0. 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
[ -d /etc/nginx ] || exit 1; { find /etc/nginx -type d -perm /027 -print; find /etc/nginx -type f -perm /137 -print; } 2>/dev/null | wc -l
Đầu ra mong đợi
0

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

find /etc/nginx -type d -exec chmod 750 {} + ; find /etc/nginx -type f -exec chmod 640 {} + (keep private keys at 400).

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
nginxpermissions
Tham chiếu
CIS NGINX Benchmark v3.0.0 - 2.3.2 Ensure access to NGINX directories and files is restricted

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