TMAegis
postgres のその他のルール

PostgreSQL

TMA-POSTGRES-5.5

Ensure per-account connection limits are used

低レベル 1自動postgres

説明

Limiting concurrent connections to a PostgreSQL server can be used to reduce the risk of Denial of Service (DoS) attacks. Counts login roles with an unlimited (-1) connection limit. 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_roles WHERE rolname !~ '^pg_' AND rolcanlogin AND rolconnlimit = -1" 2>/dev/null) || exit 1; printf '%s\n' "$out"
期待される出力
0

修正方法

修正方法: ガイダンスまたは IaC パッチ

ALTER ROLE <dbuser> CONNECTION LIMIT <reasonable concurrent connection count>; for every login role reported (SELECT rolname FROM pg_roles WHERE rolcanlogin AND rolconnlimit = -1).

プロパティ

オペレーティングシステム
すべて
タグ
postgresdatabaseauthentication
参照
CIS PostgreSQL 18 Benchmark v1.0.0 - 5.5 Ensure per-account connection limits are used

このホストをチェック

監査が許可されているマシンで実行してください。スキャンは読み取り専用です。

shell
tmaegis scan --target postgres