From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Amol Inamdar <amol(dot)aai(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS) |
Date: | 2025-07-16 15:48:10 |
Message-ID: | 62b420e1c9500c68c1bc135810d4cf9f3289fb8c.camel@cybertec.at |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 2025-07-16 at 18:54 +0530, Amol Inamdar wrote:
> I would like to rephrase the question a little bit, below is how our setup going to be
> 1. NFS mount point is for /nfs-mount/postgres (and permissions locked down so
> that Postgres cannot create directories in here)
> 2. Postgres data directory is /nfs-mount/postgres/db
> 3. With secured NFS + AT-TLS setup Postgres will be able to write to data directory
> but not parent dir, however the file ownership information Postgres sees from the
> stat() call will not match the Postgres user in the container (even though the
> AT-TLS strict access control will ensure only the Posgres user can read/write to
> this directory)
> Considering the above scenario/setup, what is the danger of removing the ownership check
> in miscinit.c checkDataDir() function ?
The danger is that somebody else than the PostgreSQL user has permissions on
the data directory. You will argue that that somebody is root, and root has
these permissions anyway.
But there is another reason why PostgreSQL insists that the PostgreSQL user
owns the data directory: at startup, the postmaster checks if the data
directory belongs to the current user and fails if not. This is a protection
against starting the postmaster with the wrong user.
There are certainly ways to do it differently, but I'd argue that they would
be more complicated, and the current simple solution is robust.
If you pre-create the data directory with the appropriate permissions,
what keeps you from giving ownership to the correct user too?
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2025-07-17 00:41:44 | Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS) |
Previous Message | Adrian Klaver | 2025-07-16 15:29:13 | Re: PgBouncer-Postgres : un supported startup parameter statement_timeout |