pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to secure pg_hba.conf
5+ messages / 5 participants
[nested] [flat]

* how to secure pg_hba.conf
@ 2022-12-01 13:45  Rizwan Shaukat <rizwan.shaukat@hotmail.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Rizwan Shaukat @ 2022-12-01 13:45 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi,

we hv requiremnt from security to secure pg_hba.conf file was encryption or password protected on server to protect ip visibilty because these server access by application n thy can amend as well. how we can achive it pls 

Rizwan




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to secure pg_hba.conf
@ 2022-12-01 18:38  Christophe Pettus <xof@thebuild.com>
  parent: Rizwan Shaukat <rizwan.shaukat@hotmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Christophe Pettus @ 2022-12-01 18:38 UTC (permalink / raw)
  To: Rizwan Shaukat <rizwan.shaukat@hotmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>



> On Dec 1, 2022, at 05:45, Rizwan Shaukat <rizwan.shaukat@hotmail.com> wrote:
> we hv requiremnt from security to secure pg_hba.conf file was encryption or password protected on server to protect ip visibilty because these server access by application n thy can amend as well. how we can achive it pls 

The only practical way of securing pg_hba.conf is to secure access to the Linux user that PostgreSQL is running as (assuming you are on Linux, of course).  That user will need to open and read the file, so there's no way of securing it against that user.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to secure pg_hba.conf
@ 2022-12-01 18:44  Ron <ronljohnsonjr@gmail.com>
  parent: Rizwan Shaukat <rizwan.shaukat@hotmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Ron @ 2022-12-01 18:44 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 12/1/22 07:45, Rizwan Shaukat wrote:
> Hi,
>
> we hv requiremnt from security to secure pg_hba.conf file was encryption or password protected on server to protect ip visibilty because these server access by application n thy can amend as well. how we can achive it pls

pg_hba.conf should only be readable by user postgres, while your application 
should not be running as user postgres.  Thus, there should not be a problem.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to secure pg_hba.conf
@ 2022-12-01 19:06  David G. Johnston <david.g.johnston@gmail.com>
  parent: Rizwan Shaukat <rizwan.shaukat@hotmail.com>
  2 siblings, 1 reply; 5+ messages in thread

From: David G. Johnston @ 2022-12-01 19:06 UTC (permalink / raw)
  To: Rizwan Shaukat <rizwan.shaukat@hotmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Thu, Dec 1, 2022 at 11:36 AM Rizwan Shaukat <rizwan.shaukat@hotmail.com>
wrote:

> we hv requiremnt from security to secure pg_hba.conf file was encryption
> or password protected on server to protect ip visibilty because these
> server access by application n thy can amend as well. how we can achive it
> pls
>
>
You cannot with the present implementation of the system - pg_hba.conf is
read by the PostgreSQL process as a file.  I do not think the server is
prepared for that file to be some kind of program whose stdout is the
contents and you could arrange for that program to do whatever it is you'd
like.

That said, it isn't clear to me what you mean by "these server access by
application n thy can amend as well".  You are welcome to make the file
read-only except by root if amending it is a concern.  I don't understand
what exposure knowing ip addresses gives - I suppose knowledge is helpful
but security by obscurity isn't real security.

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to secure pg_hba.conf
@ 2022-12-01 19:29  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2022-12-01 19:29 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Rizwan Shaukat <rizwan.shaukat@hotmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thu, Dec 1, 2022 at 11:36 AM Rizwan Shaukat <rizwan.shaukat@hotmail.com>
> wrote:
>> we hv requiremnt from security to secure pg_hba.conf file was encryption
>> or password protected on server to protect ip visibilty because these
>> server access by application n thy can amend as well. how we can achive it
>> pls

> You cannot with the present implementation of the system - pg_hba.conf is
> read by the PostgreSQL process as a file.  I do not think the server is
> prepared for that file to be some kind of program whose stdout is the
> contents and you could arrange for that program to do whatever it is you'd
> like.

Even more to the point: if you are afraid of hostile actors being able
to access files inside your data directory, it seems to me that
pg_hba.conf is very far down the list of things to worry about.  What's
to stop the same actors from examining/modifying other configuration
files, or even the actual database contents?  If you don't think your
data directory is secure, you have problems that Postgres can't fix.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2022-12-01 19:29 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 13:45 how to secure pg_hba.conf Rizwan Shaukat <rizwan.shaukat@hotmail.com>
2022-12-01 18:38 ` Christophe Pettus <xof@thebuild.com>
2022-12-01 18:44 ` Ron <ronljohnsonjr@gmail.com>
2022-12-01 19:06 ` David G. Johnston <david.g.johnston@gmail.com>
2022-12-01 19:29   ` Tom Lane <tgl@sss.pgh.pa.us>

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