summaryrefslogtreecommitdiff
path: root/contrib/sepgsql/selinux.c
diff options
context:
space:
mode:
authorJoe Conway2019-11-23 15:41:52 +0000
committerJoe Conway2019-11-23 15:46:44 +0000
commit4f66c93f61439b4db866b21cc1ecd5bf815564ef (patch)
tree5fa5d6cc2b9a85029289057dbed7e108d247c006 /contrib/sepgsql/selinux.c
parentf7a2002e82cfc639d1b6df89012f5d6c623ad545 (diff)
Update sepgsql to add mandatory access control for TRUNCATE
Use SELinux "db_table: { truncate }" to check if permission is granted to TRUNCATE. Update example SELinux policy to grant needed permission for TRUNCATE. Add new regression test to demonstrate a positive and negative cases. Test will only be run if the loaded SELinux policy has the "db_table: { truncate }" permission. Makes use of recent commit which added object TRUNCATE hook. Patch by Yuli Khodorkovskiy with minor editorialization by me. Not back-patched because the object TRUNCATE hook was not. Author: Yuli Khodorkovskiy Reviewed-by: Joe Conway Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com
Diffstat (limited to 'contrib/sepgsql/selinux.c')
-rw-r--r--contrib/sepgsql/selinux.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/sepgsql/selinux.c b/contrib/sepgsql/selinux.c
index b7c489cc336..5e6189a4c31 100644
--- a/contrib/sepgsql/selinux.c
+++ b/contrib/sepgsql/selinux.c
@@ -360,6 +360,9 @@ static struct
"lock", SEPG_DB_TABLE__LOCK
},
{
+ "truncate", SEPG_DB_TABLE__TRUNCATE
+ },
+ {
NULL, 0UL
},
}