TMAegis
postgres のその他のルール

TMA-POSTGRES-1.6

Verify That 'PGPASSWORD' is Not Set in Users' Profiles

中レベル 1自動postgres

説明

PostgreSQL can read a default database password from an environment variable called PGPASSWORD. Run as root; counts Bash login scripts in /home/*, /root and /etc/environment that mention PGPASSWORD (other shells need manual review).

チェック方法

監査方法: シェルコマンド

shell
[ "$(id -u)" -eq 0 ] || exit 1; n=$(grep -ls PGPASSWORD /home/*/.bashrc /home/*/.profile /home/*/.bash_profile /root/.bashrc /root/.profile /root/.bash_profile /etc/environment 2>/dev/null | wc -l); echo "$n"
期待される出力
0

修正方法

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

Remove PGPASSWORD from the listed login scripts and use ~/.pgpass (mode 0600), a service file without passwords, or certificate/peer authentication instead.

プロパティ

オペレーティングシステム
すべて
タグ
postgresdatabasecredentials
参照
CIS PostgreSQL 18 Benchmark v1.0.0 - 1.6 Verify That 'PGPASSWORD' is Not Set in Users' Profiles

このホストをチェック

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

shell
tmaegis scan --target postgres