GUC --- prevent non-super user changes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: GUC --- prevent non-super user changes
Date: 2003-06-11 05:01:15
Message-ID: 200306110501.h5B51Fc14049@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> The recent change to make log_min_messages SUSET provokes the following
> behavior:
>
> $ export PGOPTIONS="-d 5"
> $ psql
> psql: FATAL: 'log_min_messages': permission denied
> $
>
> Considering that I *am* superuser, this is quite unacceptable.
> If you don't want to revert the change, propose another solution.

Here is a proposed fix for the new SUSET of various variables. The
solution is to create a new GUC context called PGC_USERLIMIT, which
limits changes by non-super users. For example, non-super users can
turn on logging, but can't turn it off, and log_min_* logging can have
added output, but not less output.

The first part of the patch prevent client PGOPTIONS from lowering the
debug level. The second part adds this new GUC context, then allows it
to be set properly. The tests are in two parts --- the first prevents
non-super users from changing the value inappropriately, and the second
allows postgresql.conf changes to apply to existing backends, i.e. if
postgresql.conf turns logging off via SET, turning it on via
postgresql.conf should propogate to the client, because the client can't
turn something off that the admin wants turned on --- that is the tricky
part that we have to be able to handle the settings in any order.

Peter, how does this look? Is reset_val the proper value to test?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 13.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-06-11 05:05:35 Re: GUC --- prevent non-super user changes
Previous Message Bruce Momjian 2003-06-11 03:57:56 Re: Feature freeze date

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-06-11 05:05:35 Re: GUC --- prevent non-super user changes
Previous Message Tom Lane 2003-06-10 21:24:36 Re: Thousands of semops for every i/o