PostgreSQL
TMA-POSTGRES-5.5
Ensure per-account connection limits are used
ThấpCấp 1Tự độngpostgres
Mô tả
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.
Cách kiểm tra
Phương pháp kiểm tra: Truy vấn 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"- Đầ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
ALTER ROLE <dbuser> CONNECTION LIMIT <reasonable concurrent connection count>; for every login role reported (SELECT rolname FROM pg_roles WHERE rolcanlogin AND rolconnlimit = -1).
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- postgresdatabaseauthentication
- Tham chiếu
- CIS PostgreSQL 18 Benchmark v1.0.0 - 5.5 Ensure per-account connection limits are used
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 postgres