TMAegis베타
nginx 관련 규칙 더 보기

NGINX

TMA-NGINX-4.1.3

Ensure private key permissions are restricted

높음레벨 1자동nginx

설명

The server's and potentially its vhost's private keys should be protected from unauthorized access by limiting access based on the principle of least privilege. Every ssl_certificate_key and every *.key file under /etc/nginx must have mode 400 or stricter (relative paths are resolved against /etc/nginx; variables and engine: keys are skipped). 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.

점검 방법

감사 방식: 셸 명령

shell
out=$(nginx -T 2>/dev/null) || exit 1; { printf '%s\n' "$out" | awk '$1=="ssl_certificate_key"{v=$2; sub(/;$/,"",v); gsub(/["\047]/,"",v); print v}'; find /etc/nginx -name '*.key' 2>/dev/null; } | sort -u | { bad=0; while IFS= read -r k; do case "$k" in data:*|engine:*|store:*|*'$'*) continue;; /*) ;; *) k=/etc/nginx/$k;; esac; [ -e "$k" ] || continue; [ -z "$(find -L "$k" -perm /377)" ] || bad=1; done; [ "$bad" = 0 ] && echo compliant || echo noncompliant; }
예상 출력
compliant

조치 방법

조치 방식: 가이드 또는 인프라 패치

find /etc/nginx/ -name '*.key' -exec chmod u-wx,go-rwx {} + (and the same for keys stored elsewhere).

속성

운영 체제
모두
태그
nginxtlspermissions
참고 자료
CIS NGINX Benchmark v3.0.0 - 4.1.3 Ensure private key permissions are restricted

이 호스트 점검하기

감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.

shell
tmaegis scan --target nginx