Re: More sepgsql weirdness - Mailing list pgsql-hackers

From Dave Page
Subject Re: More sepgsql weirdness
Date
Msg-id CA+OCxoxd3t=3uXivBzmO0_dDC2WVYpFtbZk8728t_CCqANpkvQ@mail.gmail.com
Whole thread Raw
In response to Re: More sepgsql weirdness  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi

On Tue, Apr 13, 2021 at 6:22 PM Robert Haas <robertmhaas@gmail.com> wrote:
On Tue, Apr 13, 2021 at 10:33 AM Dave Page <dpage@pgadmin.org> wrote:
> On a system with selinux and sepgsql configured, search path resolution appears to fail if sepgsql is in enforcing mode, but selinux is in permissive mode (which, as I understand it, should cause sepgsql to behave as if it's in permissive mode anyway - and does for other operations). Regardless of whether my understanding of the interaction of the two permissive modes is correct, I don't believe the following should happen:

I agree that this sounds like something which shouldn't happen if the
system is in permissive mode,

I realised that my test database hadn't had the sepgsql SQL script run in it (I must have created it before running it on template1). I guess the error was caused by lack of proper labelling.

So, clearly my fault, but I think there are a couple of things we need to do here:

1) Improve the docs for sepgsql. The *only* vaguely useful source of info I've found on using this is "SELinux System Administration", a Packt book by Sven Vermeulen. Our own docs don't even list the supported object classes (e.g. db_table) or types (e.g. sepgsql_ro_table_t) for example.

2) Improve the way we handle cases like the one I ran into. I only realised what was going on when I tried to run sepgsql_getcon() to confirm I was running in undefined_t. Clearly very weird things can happen if labelling hasn't been run; perhaps we could raise a notice if the sepgsql module is loaded but sepgsql_getcon() isn't present (though that seems flakey at best)? I'd hesitate to try to check for the presence of one or more labels as the admin could have intentionally removed them or changed them of course.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: "osumi.takamichi@fujitsu.com"
Date:
Subject: RE: Truncate in synchronous logical replication failed
Next
From: Oleg Bartunov
Date:
Subject: Re: jsonb subscripting assignment performance