Chris PeBenito 17de1b
Chris PeBenito 0251df
policy_module(postgresql,1.3.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type postgresql_t;
Chris PeBenito 17de1b
type postgresql_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(postgresql_t,postgresql_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type postgresql_db_t;
Chris PeBenito 17de1b
files_type(postgresql_db_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type postgresql_etc_t;
Chris PeBenito 17de1b
files_config_file(postgresql_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type postgresql_lock_t;
Chris PeBenito 17de1b
files_lock_file(postgresql_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type postgresql_log_t;
Chris PeBenito 17de1b
logging_log_file(postgresql_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type postgresql_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(postgresql_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type postgresql_var_run_t;
Chris PeBenito 17de1b
files_pid_file(postgresql_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# postgresql Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
allow postgresql_t self:capability { kill dac_override dac_read_search chown fowner fsetid setuid setgid sys_nice sys_tty_config sys_admin };
Chris PeBenito 17de1b
dontaudit postgresql_t self:capability { sys_tty_config sys_admin };
Chris PeBenito 17de1b
allow postgresql_t self:process signal_perms;
Chris PeBenito 17de1b
allow postgresql_t self:fifo_file { getattr read write ioctl };
Chris PeBenito 17de1b
allow postgresql_t self:file { getattr read };
Chris PeBenito 17de1b
allow postgresql_t self:sem create_sem_perms;
Chris PeBenito 17de1b
allow postgresql_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow postgresql_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow postgresql_t self:udp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow postgresql_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow postgresql_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow postgresql_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_dirs_pattern(postgresql_t,postgresql_db_t,postgresql_db_t)
Chris PeBenito c0868a
manage_files_pattern(postgresql_t,postgresql_db_t,postgresql_db_t)
Chris PeBenito c0868a
manage_lnk_files_pattern(postgresql_t,postgresql_db_t,postgresql_db_t)
Chris PeBenito c0868a
manage_fifo_files_pattern(postgresql_t,postgresql_db_t,postgresql_db_t)
Chris PeBenito c0868a
manage_sock_files_pattern(postgresql_t,postgresql_db_t,postgresql_db_t)
Chris PeBenito 17de1b
files_var_lib_filetrans(postgresql_t, postgresql_db_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow postgresql_t postgresql_etc_t:dir list_dir_perms;
Chris PeBenito c0868a
read_files_pattern(postgresql_t,postgresql_etc_t,postgresql_etc_t)
Chris PeBenito c0868a
read_lnk_files_pattern(postgresql_t,postgresql_etc_t,postgresql_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow postgresql_t postgresql_exec_t:lnk_file { getattr read };
Chris PeBenito 17de1b
can_exec(postgresql_t, postgresql_exec_t )
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow postgresql_t postgresql_lock_t:file manage_file_perms;
Chris PeBenito 17de1b
files_lock_filetrans(postgresql_t,postgresql_lock_t,file)
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(postgresql_t,postgresql_log_t,postgresql_log_t)
Chris PeBenito 17de1b
logging_log_filetrans(postgresql_t,postgresql_log_t,{ file dir })
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_dirs_pattern(postgresql_t,postgresql_tmp_t,postgresql_tmp_t)
Chris PeBenito c0868a
manage_files_pattern(postgresql_t,postgresql_tmp_t,postgresql_tmp_t)
Chris PeBenito c0868a
manage_lnk_files_pattern(postgresql_t,postgresql_tmp_t,postgresql_tmp_t)
Chris PeBenito c0868a
manage_fifo_files_pattern(postgresql_t,postgresql_tmp_t,postgresql_tmp_t)
Chris PeBenito c0868a
manage_sock_files_pattern(postgresql_t,postgresql_tmp_t,postgresql_tmp_t)
Chris PeBenito 17de1b
files_tmp_filetrans(postgresql_t, postgresql_tmp_t, { dir file sock_file })
Chris PeBenito 17de1b
fs_tmpfs_filetrans(postgresql_t, postgresql_tmp_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(postgresql_t,postgresql_var_run_t,postgresql_var_run_t)
Chris PeBenito c0868a
manage_sock_files_pattern(postgresql_t,postgresql_var_run_t,postgresql_var_run_t)
Chris PeBenito 17de1b
files_pid_filetrans(postgresql_t,postgresql_var_run_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(postgresql_t)
Chris PeBenito 17de1b
kernel_read_system_state(postgresql_t)
Chris PeBenito 17de1b
kernel_list_proc(postgresql_t)
Chris PeBenito 17de1b
kernel_read_all_sysctls(postgresql_t)
Chris PeBenito 17de1b
kernel_read_proc_symlinks(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(postgresql_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(postgresql_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_if(postgresql_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(postgresql_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_nodes(postgresql_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(postgresql_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(postgresql_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(postgresql_t)
Chris PeBenito 17de1b
corenet_tcp_bind_postgresql_port(postgresql_t)
Chris PeBenito 17de1b
corenet_tcp_connect_auth_port(postgresql_t)
Chris PeBenito 17de1b
corenet_sendrecv_postgresql_server_packets(postgresql_t)
Chris PeBenito 17de1b
corenet_sendrecv_auth_client_packets(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(postgresql_t)
Chris PeBenito 17de1b
dev_read_urand(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(postgresql_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_controlling_term(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(postgresql_t)
Chris PeBenito 17de1b
corecmd_exec_shell(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_dontaudit_list_all_domains_state(postgresql_t)
Chris PeBenito 17de1b
domain_use_interactive_fds(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_dontaudit_search_home(postgresql_t)
Chris PeBenito 17de1b
files_manage_etc_files(postgresql_t)
Chris PeBenito 17de1b
files_search_etc(postgresql_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(postgresql_t)
Chris PeBenito 17de1b
files_read_usr_files(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_read_utmp(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(postgresql_t)
Chris PeBenito 17de1b
libs_use_shared_libs(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_dontaudit_search_config(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(postgresql_t)
Chris PeBenito a5e213
sysnet_use_ldap(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_search_sysadm_home_dirs(postgresql_t)
Chris PeBenito 17de1b
userdom_dontaudit_use_sysadm_ttys(postgresql_t)
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mta_getattr_spool(postgresql_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy', `
Chris PeBenito 17de1b
	files_dontaudit_read_root_files(postgresql_t)
Chris PeBenito 17de1b
	term_dontaudit_use_generic_ptys(postgresql_t)
Chris PeBenito 17de1b
	term_dontaudit_use_unallocated_ttys(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`allow_execmem',`
Chris PeBenito 17de1b
	allow postgresql_t self:process execmem;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	consoletype_exec(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	cron_search_spool(postgresql_t)
Chris PeBenito 17de1b
	cron_system_entry(postgresql_t,postgresql_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	hostname_exec(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	kerberos_use(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(postgresql_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`TODO',`
Chris PeBenito 17de1b
ifdef(`distro_debian', `
Chris PeBenito 17de1b
	init_exec_script_files(postgresql_t)
Chris PeBenito 17de1b
	# gross hack
Chris PeBenito 17de1b
	postgresql_domtrans(dpkg_t)
Chris PeBenito 17de1b
	can_exec(postgresql_t, dpkg_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_gentoo', `
Chris PeBenito 17de1b
	allow postgresql_t initrc_su_t:process { sigchld };
Chris PeBenito 17de1b
	# "su - postgres ..." is called from initrc_t
Chris PeBenito 17de1b
	postgresql_search_db(initrc_su_t)
Chris PeBenito 17de1b
	dontaudit initrc_su_t sysadm_devpts_t:chr_file rw_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
')