Re: How do I create a Backup Operator account ? - Mailing list pgsql-general

From Luca Ferrari
Subject Re: How do I create a Backup Operator account ?
Date
Msg-id CAKoxK+5U8569beRbFVeVfur6dtG66QMZCrsh+43ya9yE9qjCoQ@mail.gmail.com
Whole thread Raw
In response to Re: How do I create a Backup Operator account ?  (Marcos Aurelio Nobre <marconobre@gmail.com>)
Responses Re: How do I create a Backup Operator account ?  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
List pgsql-general
On Wed, Jul 31, 2019 at 2:48 AM Marcos Aurelio Nobre
<marconobre@gmail.com> wrote:
> But I don't know how to implement this on Linux, nor how to write this entry in the pg_hba.conf file.

I would start with an entry in pg_hba.conf like the following:

host    all       pg_backup_username        localhost               md5

or

host    all       pg_backup_username        localhost               md5


The problem then comes on how to prevent the operating system user to
run psql. If you are doing backup from a backup machine, one solution
would be to remove the psql executable and leave the backup ones.
Again, this is  a poor practice to me. Even something like the
following (untested) in /etc/sudoers will NOT prevent the user to
access the database:


User_Alias PGBACKUPUSERS = pg_backup_username
Cmd_Alias PGBACKUP = /usr/local/bin/pg_dump,
/usr/local/bin/pg_restore, ! /usr/local/bin/psql
PGBACKUPUSERS backup_host = PGBACKUP


because the user could use another client to inspect the database.
And again, I don't see the point in not allowing an user to access the
database but to be able to take a full backup. Therefore, I would go
to revoke all write grants to such user and see if he can still do a
backup.

Luca



pgsql-general by date:

Previous
From: Marcos Aurelio Nobre
Date:
Subject: Re: How do I create a Backup Operator account ?
Next
From: AYahorau@ibagroup.eu
Date:
Subject: Re: Active connections are terminated because of small wal_sender_timeout