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 c0868a
	domtrans_pattern($1,postgresql_exec_t,postgresql_t)
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 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 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 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 0b6aca
	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 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
')