|
Chris PeBenito |
17de1b |
## <summary>PostgreSQL relational database</summary>
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
e8cb08 |
#######################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Role access for SE-PostgreSQL.
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
296273 |
## <param name="user_role">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## The role associated with the user domain.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
## <param name="user_domain">
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## The type of the user domain.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
296273 |
interface(`postgresql_role',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
class db_database all_db_database_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_table all_db_table_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_procedure all_db_procedure_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_column all_db_column_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_tuple all_db_tuple_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_blob all_db_blob_perms;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_client_type, sepgsql_database_type;
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_sysobj_table_type;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
7f4005 |
type sepgsql_trusted_proc_exec_t, sepgsql_trusted_proc_t;
|
|
Chris PeBenito |
296273 |
type user_sepgsql_blob_t, user_sepgsql_proc_exec_t;
|
|
Chris PeBenito |
296273 |
type user_sepgsql_sysobj_t, user_sepgsql_table_t;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
# Declarations
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $2 sepgsql_client_type;
|
|
Chris PeBenito |
296273 |
role $1 types sepgsql_trusted_proc_t;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
##############################
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
# Client local policy
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
tunable_policy(`sepgsql_enable_users_ddl',`
|
|
Chris PeBenito |
e0ea7b |
allow $2 user_sepgsql_table_t:db_table { create drop setattr };
|
|
Chris PeBenito |
e0ea7b |
allow $2 user_sepgsql_table_t:db_column { create drop setattr };
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
296273 |
allow $2 user_sepgsql_sysobj_t:db_tuple { update insert delete };
|
|
Chris PeBenito |
e0ea7b |
allow $2 user_sepgsql_proc_exec_t:db_procedure { create drop setattr };
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
3f67f7 |
allow $2 user_sepgsql_table_t:db_table { getattr use select update insert delete lock };
|
|
Chris PeBenito |
e0ea7b |
allow $2 user_sepgsql_table_t:db_column { getattr use select update insert };
|
|
Chris PeBenito |
6073ea |
allow $2 user_sepgsql_table_t:db_tuple { use select update insert delete };
|
|
Chris PeBenito |
a01a4a |
type_transition $2 sepgsql_database_type:db_table user_sepgsql_table_t;
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
6073ea |
allow $2 user_sepgsql_sysobj_t:db_tuple { use select };
|
|
Chris PeBenito |
a01a4a |
type_transition $2 sepgsql_sysobj_table_type:db_tuple user_sepgsql_sysobj_t;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e0ea7b |
allow $2 user_sepgsql_proc_exec_t:db_procedure { getattr execute };
|
|
Chris PeBenito |
296273 |
type_transition $2 sepgsql_database_type:db_procedure user_sepgsql_proc_exec_t;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
996779 |
allow $2 user_sepgsql_blob_t:db_blob { create drop getattr setattr read write import export };
|
|
Chris PeBenito |
296273 |
type_transition $2 sepgsql_database_type:db_blob user_sepgsql_blob_t;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
7f4005 |
allow $2 sepgsql_trusted_proc_t:process transition;
|
|
Chris PeBenito |
7f4005 |
type_transition $2 sepgsql_trusted_proc_exec_t:process sepgsql_trusted_proc_t;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Marks as a SE-PostgreSQL loadable shared library module
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="type">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Type marked as a database object type.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_loadable_module',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_module_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_module_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Marks as a SE-PostgreSQL database object type
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="type">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Type marked as a database object type.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_database_object',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_database_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_database_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Marks as a SE-PostgreSQL table/column/tuple object type
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="type">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Type marked as a table/column/tuple object type.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_table_object',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_table_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_table_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Marks as a SE-PostgreSQL system table/column/tuple object type
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="type">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Type marked as a table/column/tuple object type.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_system_table_object',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
0bfccd |
attribute sepgsql_table_type, sepgsql_sysobj_table_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_table_type;
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_sysobj_table_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Marks as a SE-PostgreSQL procedure object type
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="type">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Type marked as a database object type.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_procedure_object',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_procedure_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_procedure_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Marks as a SE-PostgreSQL binary large object type
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="type">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Type marked as a database binary large object type.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_blob_object',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_blob_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_blob_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Allow the specified domain to search postgresql's database directory.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`postgresql_search_db',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type postgresql_db_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_db_t:dir search;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Allow the specified domain to manage postgresql's database.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
interface(`postgresql_manage_db',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type postgresql_db_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_db_t:dir rw_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_db_t:file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_db_t:lnk_file { getattr read };
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Execute postgresql in the postgresql domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The type of the process performing this action.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`postgresql_domtrans',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type postgresql_t, postgresql_exec_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
0bfccd |
domtrans_pattern($1, postgresql_exec_t, postgresql_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Jeremy Solt |
9681df |
######################################
|
|
Jeremy Solt |
9681df |
## <summary>
|
|
Jeremy Solt |
9681df |
## Allow domain to signal postgresql
|
|
Jeremy Solt |
9681df |
## </summary>
|
|
Jeremy Solt |
9681df |
## <param name="domain">
|
|
Jeremy Solt |
9681df |
## <summary>
|
|
Jeremy Solt |
9681df |
## Domain to not audit.
|
|
Jeremy Solt |
9681df |
## </summary>
|
|
Jeremy Solt |
9681df |
## </param>
|
|
Jeremy Solt |
9681df |
#
|
|
Jeremy Solt |
9681df |
interface(`postgresql_signal',`
|
|
Jeremy Solt |
9681df |
gen_require(`
|
|
Jeremy Solt |
9681df |
type postgresql_t;
|
|
Jeremy Solt |
9681df |
')
|
|
Jeremy Solt |
9681df |
allow $1 postgresql_t:process signal;
|
|
Jeremy Solt |
9681df |
')
|
|
Jeremy Solt |
9681df |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Allow the specified domain to read postgresql's etc.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
bbcd3c |
## <rolecap/>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`postgresql_read_config',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type postgresql_etc_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_search_etc($1)
|
|
Chris PeBenito |
82d277 |
allow $1 postgresql_etc_t:dir list_dir_perms;
|
|
Chris PeBenito |
82d277 |
allow $1 postgresql_etc_t:file read_file_perms;
|
|
Chris PeBenito |
82d277 |
allow $1 postgresql_etc_t:lnk_file read_lnk_file_perms;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
0b6aca |
## Allow the specified domain to connect to postgresql with a tcp socket.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`postgresql_tcp_connect',`
|
|
Chris PeBenito |
0b6aca |
gen_require(`
|
|
Chris PeBenito |
0b6aca |
type postgresql_t;
|
|
Chris PeBenito |
0b6aca |
')
|
|
Chris PeBenito |
0b6aca |
|
|
Chris PeBenito |
0bfccd |
corenet_tcp_recvfrom_labeled($1, postgresql_t)
|
|
Chris PeBenito |
0b6aca |
corenet_tcp_sendrecv_postgresql_port($1)
|
|
Chris PeBenito |
0b6aca |
corenet_tcp_connect_postgresql_port($1)
|
|
Chris PeBenito |
0b6aca |
corenet_sendrecv_postgresql_client_packets($1)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Allow the specified domain to connect to postgresql with a unix socket.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
bbcd3c |
## <rolecap/>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`postgresql_stream_connect',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type postgresql_t, postgresql_var_run_t, postgresql_tmp_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_search_pids($1)
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_var_run_t:sock_file write;
|
|
Chris PeBenito |
6073ea |
# Some versions of postgresql put the sock file in /tmp
|
|
Chris PeBenito |
17de1b |
allow $1 postgresql_tmp_t:sock_file write;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Allow the specified domain unprivileged accesses to unifined database objects
|
|
Chris PeBenito |
e8cb08 |
## managed by SE-PostgreSQL,
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="domain">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Domain allowed access.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_unpriv_client',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
a01a4a |
class db_database all_db_database_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_table all_db_table_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_procedure all_db_procedure_perms;
|
|
Chris PeBenito |
a01a4a |
class db_column all_db_column_perms;
|
|
Chris PeBenito |
a01a4a |
class db_tuple all_db_tuple_perms;
|
|
Chris PeBenito |
e8cb08 |
class db_blob all_db_blob_perms;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_client_type;
|
|
Chris PeBenito |
a01a4a |
attribute sepgsql_database_type, sepgsql_sysobj_table_type;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
7f4005 |
type sepgsql_trusted_proc_t, sepgsql_trusted_proc_exec_t;
|
|
Chris PeBenito |
a01a4a |
type unpriv_sepgsql_blob_t, unpriv_sepgsql_proc_exec_t;
|
|
Chris PeBenito |
a01a4a |
type unpriv_sepgsql_sysobj_t, unpriv_sepgsql_table_t;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
a01a4a |
########################################
|
|
Chris PeBenito |
a01a4a |
#
|
|
Chris PeBenito |
a01a4a |
# Declarations
|
|
Chris PeBenito |
a01a4a |
#
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_client_type;
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
a01a4a |
########################################
|
|
Chris PeBenito |
a01a4a |
#
|
|
Chris PeBenito |
a01a4a |
# Client local policy
|
|
Chris PeBenito |
a01a4a |
#
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
7f4005 |
type_transition $1 sepgsql_trusted_proc_exec_t:process sepgsql_trusted_proc_t;
|
|
Chris PeBenito |
7f4005 |
allow $1 sepgsql_trusted_proc_t:process transition;
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
a01a4a |
tunable_policy(`sepgsql_enable_users_ddl',`
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_table_t:db_table { create drop setattr };
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_table_t:db_column { create drop setattr };
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_sysobj_t:db_tuple { update insert delete };
|
|
Chris PeBenito |
e0ea7b |
allow $1 unpriv_sepgsql_proc_exec_t:db_procedure { create drop setattr };
|
|
Chris PeBenito |
a01a4a |
')
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_table_t:db_table { getattr use select update insert delete lock };
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_table_t:db_column { getattr use select update insert };
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_table_t:db_tuple { use select update insert delete };
|
|
Chris PeBenito |
a01a4a |
type_transition $1 sepgsql_database_type:db_table unpriv_sepgsql_table_t;
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
a01a4a |
allow $1 unpriv_sepgsql_sysobj_t:db_tuple { use select };
|
|
Chris PeBenito |
a01a4a |
type_transition $1 sepgsql_sysobj_table_type:db_tuple unpriv_sepgsql_sysobj_t;
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
e0ea7b |
allow $1 unpriv_sepgsql_proc_exec_t:db_procedure { getattr execute };
|
|
Chris PeBenito |
a01a4a |
type_transition $1 sepgsql_database_type:db_procedure unpriv_sepgsql_proc_exec_t;
|
|
Chris PeBenito |
a01a4a |
|
|
Chris PeBenito |
996779 |
allow $1 unpriv_sepgsql_blob_t:db_blob { create drop getattr setattr read write import export };
|
|
Chris PeBenito |
a01a4a |
type_transition $1 sepgsql_database_type:db_blob unpriv_sepgsql_blob_t;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
########################################
|
|
Chris PeBenito |
e8cb08 |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Allow the specified domain unconfined accesses to any database objects
|
|
Chris PeBenito |
e8cb08 |
## managed by SE-PostgreSQL,
|
|
Chris PeBenito |
e8cb08 |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## <param name="domain">
|
|
Chris PeBenito |
ff8f0a |
## <summary>
|
|
Chris PeBenito |
ff8f0a |
## Domain allowed access.
|
|
Chris PeBenito |
ff8f0a |
## </summary>
|
|
Chris PeBenito |
e8cb08 |
## </param>
|
|
Chris PeBenito |
e8cb08 |
#
|
|
Chris PeBenito |
e8cb08 |
interface(`postgresql_unconfined',`
|
|
Chris PeBenito |
e8cb08 |
gen_require(`
|
|
Chris PeBenito |
e8cb08 |
attribute sepgsql_unconfined_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
e8cb08 |
|
|
Chris PeBenito |
e8cb08 |
typeattribute $1 sepgsql_unconfined_type;
|
|
Chris PeBenito |
e8cb08 |
')
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
########################################
|
|
Chris PeBenito |
22a287 |
## <summary>
|
|
Chris PeBenito |
22a287 |
## All of the rules required to administrate an postgresql environment
|
|
Chris PeBenito |
22a287 |
## </summary>
|
|
Chris PeBenito |
22a287 |
## <param name="domain">
|
|
Chris PeBenito |
22a287 |
## <summary>
|
|
Chris PeBenito |
22a287 |
## Domain allowed access.
|
|
Chris PeBenito |
22a287 |
## </summary>
|
|
Chris PeBenito |
22a287 |
## </param>
|
|
Chris PeBenito |
22a287 |
## <param name="role">
|
|
Chris PeBenito |
22a287 |
## <summary>
|
|
Chris PeBenito |
22a287 |
## The role to be allowed to manage the postgresql domain.
|
|
Chris PeBenito |
22a287 |
## </summary>
|
|
Chris PeBenito |
22a287 |
## </param>
|
|
Chris PeBenito |
22a287 |
## <rolecap/>
|
|
Chris PeBenito |
22a287 |
#
|
|
Chris PeBenito |
22a287 |
interface(`postgresql_admin',`
|
|
Chris PeBenito |
22a287 |
gen_require(`
|
|
Chris PeBenito |
22a287 |
attribute sepgsql_admin_type;
|
|
Chris PeBenito |
22a287 |
attribute sepgsql_client_type;
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
type postgresql_t, postgresql_var_run_t;
|
|
Chris PeBenito |
22a287 |
type postgresql_tmp_t, postgresql_db_t;
|
|
Chris PeBenito |
22a287 |
type postgresql_etc_t, postgresql_log_t;
|
|
Chris PeBenito |
22a287 |
type postgresql_initrc_exec_t;
|
|
Chris PeBenito |
22a287 |
')
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
typeattribute $1 sepgsql_admin_type;
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
allow $1 postgresql_t:process { ptrace signal_perms };
|
|
Chris PeBenito |
22a287 |
ps_process_pattern($1, postgresql_t)
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
init_labeled_script_domtrans($1, postgresql_initrc_exec_t)
|
|
Chris PeBenito |
22a287 |
domain_system_change_exemption($1)
|
|
Chris PeBenito |
22a287 |
role_transition $2 postgresql_initrc_exec_t system_r;
|
|
Chris PeBenito |
22a287 |
allow $2 system_r;
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
admin_pattern($1, postgresql_var_run_t)
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
admin_pattern($1, postgresql_db_t)
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
admin_pattern($1, postgresql_etc_t)
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
admin_pattern($1, postgresql_log_t)
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
admin_pattern($1, postgresql_tmp_t)
|
|
Chris PeBenito |
22a287 |
|
|
Chris PeBenito |
22a287 |
postgresql_tcp_connect($1)
|
|
Chris PeBenito |
22a287 |
postgresql_stream_connect($1)
|
|
Chris PeBenito |
22a287 |
')
|