Chris PeBenito a1fcff
## <summary>PostgreSQL relational database</summary>
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
## <summary>
Chris PeBenito a1fcff
##	Allow the specified domain to search postgresql's database directory.
Chris PeBenito a1fcff
## </summary>
Chris PeBenito a1fcff
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito a1fcff
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito a1fcff
## </param>
Chris PeBenito a1fcff
#
Chris PeBenito 1815ba
interface(`postgresql_search_db',`
Chris PeBenito a1fcff
	gen_require(`
Chris PeBenito a1fcff
		type postgresql_db_t;
Chris PeBenito a1fcff
	')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	allow $1 postgresql_db_t:dir search;
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
## <summary>
Chris PeBenito a1fcff
##	Allow the specified domain to manage postgresql's database.
Chris PeBenito a1fcff
## </summary>
Chris PeBenito a1fcff
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito a1fcff
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito a1fcff
## </param>
Chris PeBenito a1fcff
interface(`postgresql_manage_db',`
Chris PeBenito a1fcff
	gen_require(`
Chris PeBenito a1fcff
		type postgresql_db_t;
Chris PeBenito a1fcff
	')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	allow $1 postgresql_db_t:dir rw_dir_perms;
Chris PeBenito a1fcff
	allow $1 postgresql_db_t:file rw_file_perms;
Chris PeBenito a1fcff
	allow $1 postgresql_db_t:lnk_file { getattr read };
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
## <summary>
Chris PeBenito a1fcff
##	Execute postgresql in the postgresql domain.
Chris PeBenito a1fcff
## </summary>
Chris PeBenito a1fcff
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito a1fcff
##	The type of the process performing this action.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito a1fcff
## </param>
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
interface(`postgresql_domtrans',`
Chris PeBenito a1fcff
	gen_require(`
Chris PeBenito a1fcff
		type postgresql_t, postgresql_exec_t;
Chris PeBenito a1fcff
	')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	domain_auto_trans($1,postgresql_exec_t,postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	allow $1 postgresql_t:fd use;
Chris PeBenito a1fcff
	allow postgresql_t $1:fd use;
Chris PeBenito a1fcff
	allow postgresql_t $1:fifo_file rw_file_perms;
Chris PeBenito a1fcff
	allow postgresql_t $1:process sigchld;
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
## <summary>
Chris PeBenito a1fcff
##	Allow the specified domain to read postgresql's etc.
Chris PeBenito a1fcff
## </summary>
Chris PeBenito a1fcff
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito a1fcff
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito a1fcff
## </param>
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
interface(`postgresql_read_config',`
Chris PeBenito a1fcff
	gen_require(`
Chris PeBenito a1fcff
		type postgresql_etc_t;
Chris PeBenito a1fcff
	')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	files_search_etc($1)
Chris PeBenito a1fcff
	allow $1 postgresql_etc_t:dir { getattr read search };
Chris PeBenito a1fcff
	allow $1 postgresql_etc_t:file { read getattr };
Chris PeBenito a1fcff
	allow $1 postgresql_etc_t:lnk_file { getattr read };
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
## <summary>
Chris PeBenito a1fcff
##	Allow the specified domain to connect to postgresql with a tcp socket.
Chris PeBenito a1fcff
## </summary>
Chris PeBenito a1fcff
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito a1fcff
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito a1fcff
## </param>
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
interface(`postgresql_tcp_connect',`
Chris PeBenito a1fcff
	gen_require(`
Chris PeBenito a1fcff
		type postgresql_t;
Chris PeBenito a1fcff
	')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	kernel_tcp_recvfrom($1)
Chris PeBenito a1fcff
	allow $1 postgresql_t:tcp_socket { connectto recvfrom };
Chris PeBenito a1fcff
	allow postgresql_t $1:tcp_socket { acceptfrom recvfrom };
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
## <summary>
Chris PeBenito a1fcff
##	Allow the specified domain to connect to postgresql with a unix socket.
Chris PeBenito a1fcff
## </summary>
Chris PeBenito a1fcff
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito a1fcff
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito a1fcff
## </param>
Chris PeBenito a1fcff
#
Chris PeBenito 1815ba
interface(`postgresql_stream_connect',`
Chris PeBenito a1fcff
	gen_require(`
Chris PeBenito 85a0f9
		type postgresql_t, postgresql_var_run_t, postgresql_tmp_t;
Chris PeBenito a1fcff
	')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
	files_search_pids($1)
Chris PeBenito a1fcff
	allow $1 postgresql_t:unix_stream_socket connectto;
Chris PeBenito a1fcff
	allow $1 postgresql_var_run_t:sock_file write;
Chris PeBenito 85a0f9
        # Some versions of postgresql put the sock file in /tmp
Chris PeBenito 85a0f9
	allow $1 postgresql_tmp_t:sock_file write;
Chris PeBenito a1fcff
')