我有一个PostgreSQL数据库和我们的内部漏洞工具抱怨Default Unpassworded Account 。 我无法知道哪个帐户没有被盗用的问题。 我创build了几个帐户,但每个人都有密码。 postgres帐户也有密码。
当我执行: psql template1 -c '\du'我有以下输出:
List of roles Role name | Attributes | Member of --------------+------------------------------------------------+----------- account1 | Superuser, Create role, Create DB | {} account2 | | {} postgres | Superuser, Create role, Create DB, Replication | {} account3 | Password valid until infinity | {} account4 | Password valid until infinity | {}
任何build议如何解决这个问题? 谢谢。
好吧,看起来我已经find了解决scheme,感谢这个SO主题: https : //stackoverflow.com/questions/23641823/check-if-a-role-in-postgresql-has-a-password-set
当我发出select * from pg_shadow;
usename | usesysid | usecreatedb | usesuper | usecatupd | userepl | passwd | valuntil | useconfig --------------+----------+-------------+----------+-----------+---------+-------------------------------------+----------+----------- postgres | 16384 | f | f | f | f | | infinity | account1 | 17513 | f | f | f | f | | infinity | account2 | 17679 | f | f | f | f | 11111111111111111111111111111111111 | | account3 | 10 | t | t | t | t | 11111111111111111111111111111111111 | | account4 | 16385 | t | t | t | f | 11111111111111111111111111111111111 | | (5 rows)
所以, postgres和account1angular色确实没有密码。
更新这些帐户的密码: ALTER ROLE postgres WITH PASSWORD 'mysuperstrongpasswordhere';
现在看起来一切正常。