Re: logfile subprocess and Fancy File Functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: logfile subprocess and Fancy File Functions
Date: 2004-07-23 22:04:29
Message-ID: 28604.1090620269@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> On Fri, 23 Jul 2004, Andreas Pflug wrote:
>> What I'd like is
>>
>> SELECT pg_file_unlink('postgresql.conf.bak');
>> SELECT pg_file_write('postgresql.conf.tmp', 'listen_addresses=...');
>> SELECT pg_file_rename('postgresql.conf.tmp', 'postgresql.conf',
>> 'postgresql.conf.bak');
>> SELECT pg_reload_conf();

> I personally don't think the above is the correct approach to allowing
> configuration editing from remote.

I'm pretty much against allowing configuration editing from remote
altogether. It would raise the stakes tremendously in terms of what
an attacker can do once they've acquired a connection with superuser
rights. Remember that the above could be applied to pg_hba.conf,
pg_ident.conf, etc just as well as postgresql.conf. Not to mention
$HOME/.profile and other things the postgres user may own.

> It seems like the wrong level for the interface, and the file rename
> isn't atomic and pretending that it is may prove to be dangerous.

Well, editing postgresql.conf directly isn't very atomic either, with
most editors (which is why we made the postmaster only re-examine the
files upon SIGHUP).

A more cogent argument why remote editing is dangerous is that if you
screw up a config file, you may be unable to get in to fix your mistake.

I agree about the "level" issue though. If we want to officially
support this, something involving a super-sized form of SET would be
a lot more supportable in the long run.

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-07-23 22:06:07 Re: logfile subprocess and Fancy File Functions
Previous Message Magnus Hagander 2004-07-23 22:03:55 Re: Updated logging config (was: Initial eventlog support on win32 )