pg.ddx.io pgaudit/pgaudit GitHub issues and pull requests
help / color / mirror / Atom feed[pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
5+ messages / 2 participants
[nested] [flat]
* [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
@ 2026-10-09 04:48 "TheOtherBrian1 (@TheOtherBrian1)" <noreply+TheOtherBrian1@github.com>
0 siblings, 0 replies; 5+ messages in thread
From: TheOtherBrian1 (@TheOtherBrian1) @ 2026-10-09 04:48 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
### Description
When `pgaudit.log` is set to `misc` at the role or global level, it should log all `SET config = 'so-and-so'` commands.
However, it fails to log statements that disable `pgaudit.log`:
```sql
ALTER ROLE postgres SET pgaudit.log = 'misc';
SET statement_timeout = '10s'; -- logged
SET pgaudit.log = 'none'; -- not logged (should be logged) <------
SET statement_timeout = '1s'; -- not logged (disabled for the session)
```
Any adversary can start their session by executing `SET pgaudit.log = 'none';` and, as an administrator, I'd have no way of knowing that my monitoring system was disabled. I don't expect logging to continue once the session variable is set to `none`, but I definitely would want to know that someone put in an effort to hide their activity.
For comparison, PostgreSQL's built-in `log_statement = 'all'` does record the statement that disables it:
```sql
ALTER ROLE postgres SET log_statement = 'all';
SELECT 1; -- logged
SET log_statement = 'none'; -- logged
SELECT 1; -- not logged (disabled for the session)
```
### Expected behavior
`SET pgaudit.log = 'none'` should be logged, since it runs while auditing is still active. Statements after it don't need to be.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
@ 2026-10-25 18:12 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-10-25 18:12 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
@dwsteele assigned @dwsteele.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
@ 2026-10-25 18:12 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-10-25 18:12 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
@dwsteele applied label "question".
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
@ 2026-10-25 18:14 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-10-25 18:14 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
This has come up before in #78. We decided not to do it then and I think that still makes sense.
The `pgaudit.*` settings can only be changed by a superuser. A superuser has many ways to disable or work around pgAudit, and logging the `SET` would only catch the most obvious one. For example, the same setting can be passed as a connection option:
```sh
psql "dbname=postgres options='-c pgaudit.log=none'"
```
No statement is executed so there is nothing for pgAudit to log. Some other options are `SELECT set_config('pgaudit.log', 'none', false)`, which is only logged when the `read` class is enabled, or `ALTER ROLE ... SET pgaudit.log = 'none'` followed by a reconnect.
If we logged `SET pgaudit.log = 'none'` it would give a false sense of security. The absence of a `SET pgaudit.log` entry in the log would not mean that auditing was left enabled for the session.
As noted in the [Caveats](https://github.com/pgaudit/pgaudit#caveats) section of the README, it is not possible to reliably audit superusers with pgAudit. Our recommendation is to restrict access to superuser accounts and use the [set_user](https://github.com/pgaudit/set_user) extension to escalate privileges when required. set_user logs the escalation, sets `log_statement = 'all'` for the escalated session and blocks `SET log_statement`, `ALTER SYSTEM` and `COPY PROGRAM` by default.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
@ 2026-11-09 12:20 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-11-09 12:20 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
@dwsteele closed this.
^ permalink raw [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-11-09 12:20 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 04:48 [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled "TheOtherBrian1 (@TheOtherBrian1)" <noreply+TheOtherBrian1@github.com>
2026-10-25 18:12 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-10-25 18:12 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-10-25 18:14 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-11-09 12:20 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox