Only label administrative postgres commands as postgresql_exec_t
PATCH 1/1 Only label administrative postgres commands as postgresql_exec_t
Currently, all postgresql commands in are labeled as postgresql_exec_t. This means they can only be executed by db admins. However, the "normal" commands, such as createdb or psql, should also be executable by users. (The users in question still need to be granted postgresql_role(), so this is no security problem.)
I only changed this behavior in the gentoo-specific part of the policy, however other distros might want to have a look at this.
--- policy/modules/services/postgresql.fc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
policy/modules/services/postgresql.fc +18 -0
@@ -46,3 +46,21 @@ ifdef(`distro_redhat', ` /var/run/postgresql(/.*)? gen_context(system_u:object_r:postgresql_var_run_t,s0) /var/run/postmaster.* gen_context(system_u:object_r:postgresql_var_run_t,s0) + +ifdef(`distro_gentoo',` +/etc/init\.d/postgresql-.* -- gen_context(system_u:object_r:postgresql_initrc_exec_t,s0) + +/etc/postgresql-.*(/.*)? gen_context(system_u:object_r:postgresql_etc_t,s0) + +/usr/lib/postgresql-.*/bin(/.*)? gen_context(system_u:object_r:bin_t,s0) +/usr/lib/postgresql-.*/bin/pg_archivecleanup -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_basebackup -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_controldata -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_ctl -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_resetxlog -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_standby -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_upgrade -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/pg_xlogdump -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/postgres -- gen_context(system_u:object_r:postgresql_exec_t,s0) +/usr/lib/postgresql-.*/bin/postmaster -l gen_context(system_u:object_r:postgresql_exec_t,s0) +')
Signature · 1 line
1.8.4.3
PATCH 1/1 Only label administrative postgres commands as postgresql_exec_t
Sorry for the resends...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20131117/f2c542b4/attachment.bin