From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-api 1/3] dbtools: grant permissions public schema for created databases
Date: Mon, 26 Jun 2023 10:47:32 +0200 [thread overview]
Message-ID: <20230626104732.24a7449f@rosa.proxmox.com> (raw)
In-Reply-To: <20230623122104.2411099-2-d.csapak@proxmox.com>
Thanks for the patch!
On Fri, 23 Jun 2023 14:21:00 +0200
Dominik Csapak <d.csapak@proxmox.com> wrote:
> since postgres 15, the public schema is not world writeable anymore for
> security reasons. In our environment, where the db is not externaly
> reachable and no database users should exists except the ones we create,
> we can safely give the permissions again to be able to use
> the root/www-data user without modification of the remaining
> code/privileges for postgres.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/PMG/DBTools.pm | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/PMG/DBTools.pm b/src/PMG/DBTools.pm
> index 0b37361..f8eb054 100644
> --- a/src/PMG/DBTools.pm
> +++ b/src/PMG/DBTools.pm
> @@ -344,6 +344,14 @@ my $createdb = sub {
> '--lc-ctype=C',
> $dbname,
> );
> +
> + # allow root and www-data to access the public SCHEMA like pre prostgres15
> + # this is not a security issue, since the db is not externally reachable anyway and no
> + # other users should exist
> + my $cmd = "GRANT CREATE ON SCHEMA public To \"root\";"
> + ."GRANT USAGE ON SCHEMA public To \"root\";"
> + ."GRANT CREATE ON SCHEMA public To \"www-data\";"
> + ."GRANT USAGE ON SCHEMA public To \"www-data\";";
> };
the command is placed in a variable, but never actually called?
looking through DBTools - it might be a better fit to declare
a sub create_user, and put the `createuser` invocation as well as the
GRANT sql commands there - but the separate sub is only a suggestion.
>
> sub create_ruledb {
next prev parent reply other threads:[~2023-06-26 8:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 12:20 [pmg-devel] [PATCH pmg-api/gui] perparations and breaking changes Dominik Csapak
2023-06-23 12:21 ` [pmg-devel] [PATCH pmg-api 1/3] dbtools: grant permissions public schema for created databases Dominik Csapak
2023-06-26 8:47 ` Stoiko Ivanov [this message]
2023-06-23 12:21 ` [pmg-devel] [PATCH pmg-api 2/3] config: disable awl and bayes by default Dominik Csapak
2023-06-26 13:21 ` [pmg-devel] applied: " Thomas Lamprecht
2023-06-23 12:21 ` [pmg-devel] [PATCH pmg-api 3/3] config: disable advanced statistic filters " Dominik Csapak
2023-06-26 13:21 ` [pmg-devel] applied: " Thomas Lamprecht
2023-06-23 12:21 ` [pmg-devel] [PATCH pmg-gui 1/2] configuration: options: adapt to new advanced statistic filter default Dominik Csapak
2023-06-26 13:27 ` [pmg-devel] applied: " Thomas Lamprecht
2023-06-23 12:21 ` [pmg-devel] [PATCH pmg-gui 2/2] spam: options: adapt do new defaults for bayes/awl Dominik Csapak
2023-06-26 13:27 ` [pmg-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230626104732.24a7449f@rosa.proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox