pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Thomas Poty <thomas.poty@gmail.com>
Cc: pgsql-general@postgresql.org >> PG-General Mailing List <pgsql-general@postgresql.org>
Subject: Re: Issue on public schéma with Pg_restore
Date: Thu, 26 Apr 2018 07:28:14 -0700
Message-ID: <f159a8d0-b27d-6990-e782-4705ef83fba7@aklaver.com> (raw )
In-Reply-To: <CAN_ctnhp6yfQJa1ej0=GVrJbOr-kUi2OkTP7Xvwt4JuQcXW=aA@mail.gmail.com >
References: <CAN_ctnjgjCvAM+L4ZTg+sh6wGVMAzjZwR9m1_4vMVKSTB7n-FA@mail.gmail.com >
<53ffe598-eb73-0ed1-36db-057b7ca0572c@aklaver.com >
<CAN_ctnhp6yfQJa1ej0=GVrJbOr-kUi2OkTP7Xvwt4JuQcXW=aA@mail.gmail.com >
On 04/26/2018 12:03 AM, Thomas Poty wrote:
> Hi,
Comments in line below.
>
> *About version :*
>
> This is the same on both server
>
> _ + source server :_
>
>
> [[local]] thomasproot@serverconfig=# select version();
> ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
> │
> version │
> ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤
> │ PostgreSQL 9.6.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
> 20150623 (Red Hat 4.8.5-16), 64-bit │
> └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
> (1 row)
>
> Time: 0.183 ms
>
> _+ target server_
>
> [[local]] thomasproot@postgres=# select version();
> ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
> │
> version │
> ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤
> │ PostgreSQL 9.6.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
> 20150623 (Red Hat 4.8.5-16), 64-bit │
> └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
> (1 row)
>
> Time: 4.711 ms
The latest 9.6 version is 9.6.8 and it has changes to deal with this:
https://wiki.postgresql.org/wiki/A_Guide_to_CVE-2018-1058:_Protect_Your_Search_Path
Not sure if it would cover your issues, but worth the ugrade anyway.
>
>
>
> _+ pg_restore :_
>
> /command :/
> /bin/pg_restore --username=backup --host=VM38 --port=5432
> --dbname=postgres --no-password --disable-triggers --verbose --clean
> --create --if-exists
> /mnt/backupPostgreSQL/serverconfig_prod/backup_in_progress/serverconfig_prod_thomasp.sql
FYI, --disable-triggers in this context is a no-op.
>
> /version :/
> pg_restore (PostgreSQL) 9.6.7
>
>
> *About privileges:
>
> *
> _+ source db :_
>
> [[local]] thomasproot@serverconfig=# \dn+
> List of schemas
> ┌──────────┬────────────────────┬──────────────────────────────────────────┬────────────────────────┐
> │ Name │ Owner │
> Access
> privileges │ Description │
> ├──────────┼────────────────────┼──────────────────────────────────────────┼────────────────────────┤
> │ public │ serverconfig_owner │
> serverconfig_owner=UC/serverconfig_owner↵ │
> standard public schema │
> │ │ │
> toolboxsysadmin=U/serverconfig_owner
> │ │
> │ public_h │ serverconfig_owner │
> serverconfig_owner=UC/serverconfig_owner↵
> │ │
> │ │ │
> toolboxsysadmin=U/serverconfig_owner
> │ │
> └──────────┴────────────────────┴──────────────────────────────────────────┴────────────────────────┘
> (2 rows)
>
So how did you revoke the privileges for PUBLIC in the above?
>
> _+ target db _
>
> /schema of template1 :/
>
> thomasproot@template1=# \dn+
> List of schemas
> ┌──────┬───────┬───────────────────┬─────────────┐
> │ Name │ Owner │ Access privileges │ Description
> │
> ├──────┼───────┼───────────────────┼─────────────┤
> └──────┴───────┴───────────────────┴─────────────┘
> (0 rows)
>
>
> /after restore:/*
>
> *
> [[local]] thomasproot@serverconfig=# \dn+
> List of schemas
> ┌──────────┬────────────────────┬──────────────────────────────────────────┬────────────────────────┐
> │ Name │ Owner │
> Access privileges │
> Description │
> ├──────────┼────────────────────┼──────────────────────────────────────────┼────────────────────────┤
> │ public │ serverconfig_owner │
> serverconfig_owner=UC/serverconfig_owner ↵│
> standard public schema │
> │ │
> │*=UC/postgres *
> ↵│
> │
> │ │ │
> toolboxsysadmin=U/serverconfig_owner │
> │
> │ public_h │ serverconfig_owner │
> serverconfig_owner=UC/serverconfig_owner↵ │
> │
> │ │ │
> toolboxsysadmin=U/serverconfig_owner │
> │
> └──────────┴────────────────────┴──────────────────────────────────────────┴────────────────────────┘
> (2 rows)
>
>
> It seems pg_restore automtically add privileges usage and create for
> public role on schema public if it found it. Is that correct?
>
> Regards
>
> Thomas
> **
--
Adrian Klaver
adrian.klaver@aklaver.com
view thread (7+ messages) latest in thread
Message-ID: <f159a8d0-b27d-6990-e782-4705ef83fba7@aklaver.com>
Permalink: ../f159a8d0-b27d-6990-e782-4705ef83fba7@aklaver.com/
Also on: postgresql.org/message-id/f159a8d0-b27d-6990-e782-4705ef83fba7@aklaver.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, thomas.poty@gmail.com
Subject: Re: Issue on public schéma with Pg_restore
In-Reply-To: <f159a8d0-b27d-6990-e782-4705ef83fba7@aklaver.com>
References: <CAN_ctnjgjCvAM+L4ZTg+sh6wGVMAzjZwR9m1_4vMVKSTB7n-FA@mail.gmail.com> <53ffe598-eb73-0ed1-36db-057b7ca0572c@aklaver.com> <CAN_ctnhp6yfQJa1ej0=GVrJbOr-kUi2OkTP7Xvwt4JuQcXW=aA@mail.gmail.com> <f159a8d0-b27d-6990-e782-4705ef83fba7@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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