Chris PeBenito 17de1b
## <summary>PostgreSQL relational database</summary>
Chris PeBenito 17de1b
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 17de1b
	domain_auto_trans($1,postgresql_exec_t,postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 postgresql_t:fd use;
Chris PeBenito 17de1b
	allow postgresql_t $1:fd use;
Chris PeBenito 17de1b
	allow postgresql_t $1:fifo_file rw_file_perms;
Chris PeBenito 17de1b
	allow postgresql_t $1:process sigchld;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
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 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 17de1b
	allow $1 postgresql_etc_t:dir { getattr read search };
Chris PeBenito 17de1b
	allow $1 postgresql_etc_t:file { read getattr };
Chris PeBenito 17de1b
	allow $1 postgresql_etc_t:lnk_file { getattr read };
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 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 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type postgresql_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	kernel_tcp_recvfrom($1)
Chris PeBenito 17de1b
	allow $1 postgresql_t:tcp_socket { connectto recvfrom };
Chris PeBenito 17de1b
	allow postgresql_t $1:tcp_socket { acceptfrom recvfrom };
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 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 17de1b
        # Some versions of postgresql put the sock file in /tmp
Chris PeBenito 17de1b
	allow $1 postgresql_tmp_t:sock_file write;
Chris PeBenito 17de1b
')