Re: pg_hba_lookup function to get all matching pg_hba.conf entries - Mailing list pgsql-hackers

From Haribabu Kommi
Subject Re: pg_hba_lookup function to get all matching pg_hba.conf entries
Date
Msg-id CAJrrPGcyxk1Ljn3eiX-d9Kaqk-obvR21s4viBntWgDsSWyPwOQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_hba_lookup function to get all matching pg_hba.conf entries  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Mon, Sep 7, 2015 at 4:34 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Hi
>
>
>>
>> postgres=# select pg_hba_lookup('postgres','all');
>>                      pg_hba_lookup
>> -------------------------------------------------------
>>  (84,local,"[""all""]","[""all""]",,,trust,{})
>>  (86,host,"[""all""]","[""all""]",127.0.0.1,,trust,{})
>>  (88,host,"[""all""]","[""all""]",::1,,trust,{})
>>
>> Here I attached a proof of concept patch for the same.
>>
>> Any suggestions/comments on this proposed approach?
>>
>
> If I understand well to your proposal, the major benefit is in impossibility
> to enter pg_hba keywords - so you don't need to analyse if parameter is
> keyword or not? It has sense, although It can be hard to do image about
> pg_hba conf from these partial views.

From the function output, it is little bit difficult to map the
pg_hba.conf file.
Because of problems in processing keywords in where clause of a view, I changed
from view to function.

Is there any possibility with rule or something, that the where clause
details can be passed
as function arguments to get the data?

> There can be other way - theoretically we can have a function pg_hba_debug
> with similar API like pg_hba_conf. The result will be a content of
> pg_hba.conf with information about result of any rule.


The output of pg_hba_debug function looks like, the entry of
pg_hba.conf and the result
match for the given input data.

Regards,
Hari Babu
Fujitsu Australia



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: WIP: Make timestamptz_out less slow.
Next
From: Joe Conway
Date:
Subject: Re: One question about security label command