On 2013-10-15 10:34:53 -0400, Robert Haas wrote:
> On Tue, Oct 15, 2013 at 10:27 AM, Andres Freund <and...@2ndquadrant.com>
> >> I think part of the problem may be that you're using the library name
> >> to identify the output plugin. I'm not excited about that design.
> >> For functions, you give the function a name and that is a pointer to
> >> where to actually find the function, which may be a 2-tuple
> >> <library-name, function-name>, or perhaps just a 1-tuple
> >> <builtin-function-name>, or maybe the whole text of a PL/pgsql
> >> procedure that should be compiled.
> > That means you allow trivial remote code execution since you could try
> > to load system() or something else that's available in every shared
> > object. Now you can argue that that's OK since we have special checks
> > for replication connections, but I'd rather not go there.
> Well, obviously you can't let somebody load any library they want.
> But that's pretty much true anyway; LOAD had better be confined to
> superusers unless there is something (like a pg_proc entry) that
> provides "prior authorization" for that specific load.
Currently you can create users that have permissions for replication but
which are not superusers. I think we should strive to providing that
capability for changeset extraction as well.
> >> Perhaps this ought to work similarly. Create a function in pg_proc
> >> which returns the structure containing the function pointers. Then,
> >> when that output plugin is selected, it'll automatically trigger
> >> loading the correct shared library if that's needed; and the shared
> >> library name may (but need not) match the output plugin name.
> > I'd like to avoid relying on inserting stuff into pg_proc because that
> > makes it harder to extract WAL from a HS standby. Requiring to configure
> > that on the primary to extract data on the standby seems confusing to
> > me.
> > But perhaps that's the correct solution :/
> That's a reasonable concern. I don't have another idea at the moment,
> unless we want to allow replication connections to issue LOAD
> commands. Then you can LOAD the library, so that the plug-in is
> registered under the well-known name you expect it to have, and then
> use that name to start replication.
But what's the advantage of that over the current situation or one where
PG_load_output_plugin() is called? The current and related
implementations allow you to only load libraries in some designated
postgres directories and it doesn't allow you to call any arbitrary
functions in there.
Would you be content with a symbol "PG_load_output_plugin" being called
that fills out the actual callbacks?
> >> Now, some users are still going to head for the hills. But at least
> >> from where I sit it sounds a hell of a lot better than the first
> >> answer. We're not going to solve all of the tooling problems around
> >> this technology in one release, for sure. But as far as 95% of our
> >> users are concerned, a C API might as well not exist at all. People
> >> WILL try to machine parse the output of whatever demo plugins we
> >> provide; so I think we should try hard to provide at least one such
> >> plugin that is designed to make that as easy as possible.
> > Well, just providing the C API + an example in a first step didn't work
> > out too badly for FDWs. I am pretty sure that once released there will
> > soon be extensions for it on PGXN or whatever for special usecases.
> I suspect so, too. But I also think that if that's the only thing
> available in the first release, a lot of users will get a poor initial
I think lots of people will expect a builtin logical replication
solution :/. Which seems a tad unlikely to arrive in 9.4.
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Sent via pgsql-hackers mailing list (firstname.lastname@example.org)
To make changes to your subscription: