mirror of https://github.com/postgres/postgres
KaiGai Kohei, reviewed by Dimitri Fontaine and me.pull/1/head
parent
7f0e4bb82e
commit
e1042a3484
@ -0,0 +1,80 @@ |
||||
-- |
||||
-- Regression Test for Creation of Object Permission Checks |
||||
-- |
||||
-- confirm required permissions using audit messages |
||||
SELECT sepgsql_getcon(); -- confirm client privilege |
||||
sepgsql_getcon |
||||
------------------------------------------- |
||||
unconfined_u:unconfined_r:unconfined_t:s0 |
||||
(1 row) |
||||
|
||||
SET sepgsql.debug_audit = true; |
||||
SET client_min_messages = LOG; |
||||
CREATE DATABASE regtest_sepgsql_test_database; |
||||
LOG: SELinux: allowed { getattr } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=system_u:object_r:sepgsql_db_t:s0 tclass=db_database name="database template1" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_db_t:s0 tclass=db_database name="database regtest_sepgsql_test_database" |
||||
CREATE SCHEMA regtest_schema; |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
SET search_path = regtest_schema, public; |
||||
CREATE TABLE regtest_table (x serial primary key, y text); |
||||
NOTICE: CREATE TABLE will create implicit sequence "regtest_table_x_seq" for serial column "regtest_table.x" |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="sequence regtest_table_x_seq" |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="table regtest_table" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column tableoid" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column cmax" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column xmax" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column cmin" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column xmin" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column ctid" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column x" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column y" |
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "regtest_table_pkey" for table "regtest_table" |
||||
ALTER TABLE regtest_table ADD COLUMN z int; |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column z" |
||||
CREATE TABLE regtest_table_2 (a int) WITH OIDS; |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="table regtest_table_2" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column tableoid" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column cmax" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column xmax" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column cmin" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column xmin" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column oid" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column ctid" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column a" |
||||
-- corresponding toast table should not have label and permission checks |
||||
ALTER TABLE regtest_table_2 ADD COLUMN b text; |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_2 column b" |
||||
-- VACUUM FULL internally create a new table and swap them later. |
||||
VACUUM FULL regtest_table; |
||||
CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="view regtest_view" |
||||
CREATE SEQUENCE regtest_seq; |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="sequence regtest_seq" |
||||
CREATE TYPE regtest_comptype AS (a int, b text); |
||||
CREATE FUNCTION regtest_func(text,int[]) RETURNS bool LANGUAGE plpgsql |
||||
AS 'BEGIN RAISE NOTICE ''regtest_func => %'', $1; RETURN true; END'; |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="function regtest_func(text,integer[])" |
||||
CREATE AGGREGATE regtest_agg ( |
||||
sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond1 = '0' |
||||
); |
||||
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="schema regtest_schema" |
||||
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:unconfined_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="function regtest_agg(integer)" |
||||
-- |
||||
-- clean-up |
||||
-- |
||||
DROP DATABASE IF EXISTS regtest_sepgsql_test_database; |
||||
DROP SCHEMA IF EXISTS regtest_schema CASCADE; |
||||
NOTICE: drop cascades to 7 other objects |
||||
DETAIL: drop cascades to table regtest_table |
||||
drop cascades to table regtest_table_2 |
||||
drop cascades to view regtest_view |
||||
drop cascades to sequence regtest_seq |
||||
drop cascades to type regtest_comptype |
||||
drop cascades to function regtest_func(text,integer[]) |
||||
drop cascades to function regtest_agg(integer) |
@ -0,0 +1,46 @@ |
||||
-- |
||||
-- Regression Test for Creation of Object Permission Checks |
||||
-- |
||||
|
||||
-- confirm required permissions using audit messages |
||||
-- @SECURITY-CONTEXT=unconfined_u:unconfined_r:unconfined_t:s0 |
||||
SET sepgsql.debug_audit = true; |
||||
SET client_min_messages = LOG; |
||||
|
||||
CREATE DATABASE regtest_sepgsql_test_database; |
||||
|
||||
CREATE SCHEMA regtest_schema; |
||||
|
||||
SET search_path = regtest_schema, public; |
||||
|
||||
CREATE TABLE regtest_table (x serial primary key, y text); |
||||
|
||||
ALTER TABLE regtest_table ADD COLUMN z int; |
||||
|
||||
CREATE TABLE regtest_table_2 (a int) WITH OIDS; |
||||
|
||||
-- corresponding toast table should not have label and permission checks |
||||
ALTER TABLE regtest_table_2 ADD COLUMN b text; |
||||
|
||||
-- VACUUM FULL internally create a new table and swap them later. |
||||
VACUUM FULL regtest_table; |
||||
|
||||
CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; |
||||
|
||||
CREATE SEQUENCE regtest_seq; |
||||
|
||||
CREATE TYPE regtest_comptype AS (a int, b text); |
||||
|
||||
CREATE FUNCTION regtest_func(text,int[]) RETURNS bool LANGUAGE plpgsql |
||||
AS 'BEGIN RAISE NOTICE ''regtest_func => %'', $1; RETURN true; END'; |
||||
|
||||
CREATE AGGREGATE regtest_agg ( |
||||
sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond1 = '0' |
||||
); |
||||
|
||||
-- |
||||
-- clean-up |
||||
-- |
||||
DROP DATABASE IF EXISTS regtest_sepgsql_test_database; |
||||
|
||||
DROP SCHEMA IF EXISTS regtest_schema CASCADE; |
Loading…
Reference in new issue