TMA-PGSQL-NO-TRUST-AUTH
Ensure pg_hba.conf does not use 'trust' or 'password' authentication
심각레벨 1자동postgres
설명
trust allows login without any credential and password sends the password in clear text. The CIS PostgreSQL 18 Benchmark covers pg_hba.conf only through the manual checks 5.3/5.4; this rule automates that part by reading pg_hba_file_rules (superuser). Runs psql as ${PGUSER:-postgres} against ${PGDATABASE:-postgres}; set PGHOST/PGPORT and use ~/.pgpass (not PGPASSWORD, see 1.6/1.7) when peer authentication is not available.
점검 방법
감사 방식: SQL 쿼리
sql_query
out=$(psql -X -U "${PGUSER:-postgres}" -d "${PGDATABASE:-postgres}" -tAc "SELECT count(*) FROM pg_hba_file_rules WHERE auth_method IN ('trust','password')" 2>/dev/null) || exit 1; printf '%s\n' "$out"- 예상 출력
0
조치 방법
조치 방식: 가이드 또는 인프라 패치
Replace trust/password entries in pg_hba.conf with scram-sha-256 (or peer for local administrative sockets), then SELECT pg_reload_conf();
속성
- 운영 체제
- 모두
- 태그
- postgresdatabaseauthenticationpg_hba
- 참고 자료
- CIS PostgreSQL 18 Benchmark v1.0.0 - 5.3 / 5.4 Ensure login via "local" UNIX Domain Socket / "host" TCP/IP Socket is configured correctly
이 호스트 점검하기
감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.
shell
tmaegis scan --target postgres