We are planning to use the foreign data wrapper feature in PostgreSQL. As part of the foreign data wrapper configuration, a user mapping has to be created. The problem is the password of the remote user is stored in clear text and is retrievable by selecting from the gp_user_mappings system view
Both the local mapped user and the superuser can see the password in clear text. So, we want to audit any select statement by the superuser to this view. Is this possible?
Note: pgPass file is not an option
You cannot audit the actions of a superuser in a way that the superuser cannot tamper with.
If you are security conscious, the best solution is the one you exclude: don't use a password and set
password_requiredtooff. That does not mean that you have to use a password file: you could for example use certificate authentication.If you have no control over the database server, then security seems to be a secondary concern. In that case, you could use
trustauthentication.