Closed harada-toshi closed 7 years ago
Thank you for the report!
even after reloading with the parameter set to off, the connection audit log was output.
Does it mean that pgaudit emits these logs regardless of parameter value even if the user can set these parameters to off by reloading and SHOW log_connections
return off? Or pgaudit disallows the user to change these parameters during running?
I've pushed a change to resolve this issue. The idea is changing the contexts of these three GUC parameter to PGC_POSTMASTER when starting up. That way we can guarantee that these parameter cannot be changed during server running. This idea is convenience to resolve this issue but at the same time it can be a restriction for the user who don't want to log the connection log. So I think we should check and change these parameter at starting up only when connection log is required (i.g. there is the rule section specifying CONNECT class). Thought?
Anyway commit bf6bb09d977ccf5653ad1ecb84e32de630988ed3 should fix it, please confirm it.
Thank you very much. We confirmed that each parameter (log_connections, log_disconnections, log_replication_commands) can not be changed after starting pgaudit.
$ psql -U postgres
psql (9.6.2)
Type "help" for help.
postgres=# SET log_disconnections = off;
ERROR: parameter "log_disconnections" cannot be changed without restarting the server
postgres=# SET log_connections = off;
ERROR: parameter "log_connections" cannot be changed without restarting the server
postgres=# SET log_replication_commands = off;
ERROR: parameter "log_replication_commands" cannot be changed without restarting the server
postgres=#
Thanks! Close.
Overview
When log_connections or log_disconnections is turned off and reloaded, connection audit logs are no longer output. In the advanced branch, these parameters were forced to be on. For this reason, even after reloading with the parameter set to off, the connection audit log was output.
We think that it is undesirable to be able to change the output of the audit log by reloading.
log
The log_connections and log_disconnections of postgresql.conf in the off, reload.
Turn on log_connections and log_disconnections in postgresql.conf and reload. The connection audit log is output again.
Even if you connect from the client (eg psql) in this state, the audit log is not output.