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
Как исправляется
Метод исправления: Рекомендация или патч инфраструктуры
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