Chris PeBenito a1fcff
Chris PeBenito f35fed
policy_module(postgresql,1.1.2)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
#################################
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
# Declarations
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
type postgresql_t;
Chris PeBenito a1fcff
type postgresql_exec_t;
Chris PeBenito a1fcff
init_daemon_domain(postgresql_t,postgresql_exec_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
type postgresql_db_t;
Chris PeBenito a1fcff
files_type(postgresql_db_t)
Chris PeBenito a1fcff
Chris PeBenito 9bbc75
type postgresql_etc_t;
Chris PeBenito 9bbc75
files_config_file(postgresql_etc_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
type postgresql_lock_t;
Chris PeBenito a1fcff
files_lock_file(postgresql_lock_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
type postgresql_log_t;
Chris PeBenito a1fcff
logging_log_file(postgresql_log_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
type postgresql_tmp_t;
Chris PeBenito a1fcff
files_tmp_file(postgresql_tmp_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
type postgresql_var_run_t;
Chris PeBenito a1fcff
files_pid_file(postgresql_var_run_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
########################################
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
# postgresql Local policy
Chris PeBenito a1fcff
#
Chris PeBenito a1fcff
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 165b42
dontaudit postgresql_t self:capability { sys_tty_config sys_admin };
Don Miner 57d8e6
allow postgresql_t self:process signal_perms;
Chris PeBenito a1fcff
allow postgresql_t self:fifo_file { getattr read write ioctl };
Chris PeBenito a1fcff
allow postgresql_t self:file { getattr read };
Chris PeBenito a1fcff
allow postgresql_t self:sem create_sem_perms;
Chris PeBenito a1fcff
allow postgresql_t self:shm create_shm_perms;
Chris PeBenito a1fcff
allow postgresql_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito a1fcff
allow postgresql_t self:udp_socket create_stream_socket_perms;
Chris PeBenito a1fcff
allow postgresql_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito a1fcff
allow postgresql_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 165b42
allow postgresql_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_db_t:dir create_dir_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_db_t:fifo_file create_file_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_db_t:file create_file_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_db_t:lnk_file create_lnk_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_db_t:sock_file create_file_perms;
Chris PeBenito 103fe2
files_var_lib_filetrans(postgresql_t, postgresql_db_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_etc_t:dir r_dir_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_etc_t:file r_file_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_etc_t:lnk_file { getattr read };
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_exec_t:lnk_file { getattr read };
Chris PeBenito a1fcff
can_exec(postgresql_t, postgresql_exec_t )
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_lock_t:file create_file_perms;
Chris PeBenito 1c1ac6
files_lock_filetrans(postgresql_t,postgresql_lock_t,file)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_log_t:dir rw_dir_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_log_t:file create_file_perms;
Chris PeBenito 103fe2
logging_log_filetrans(postgresql_t,postgresql_log_t,{ file dir })
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_tmp_t:dir create_dir_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_tmp_t:fifo_file create_file_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_tmp_t:file create_file_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_tmp_t:lnk_file create_lnk_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_tmp_t:sock_file create_file_perms;
Chris PeBenito 103fe2
files_tmp_filetrans(postgresql_t, postgresql_tmp_t, { dir file sock_file })
Chris PeBenito 103fe2
fs_tmpfs_filetrans(postgresql_t, postgresql_tmp_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito a1fcff
Chris PeBenito a1fcff
allow postgresql_t postgresql_var_run_t:dir rw_dir_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_var_run_t:file create_file_perms;
Chris PeBenito a1fcff
allow postgresql_t postgresql_var_run_t:sock_file create_file_perms;
Chris PeBenito 1c1ac6
files_pid_filetrans(postgresql_t,postgresql_var_run_t,file)
Chris PeBenito a1fcff
Chris PeBenito 445522
kernel_read_kernel_sysctls(postgresql_t)
Chris PeBenito a1fcff
kernel_read_system_state(postgresql_t)
Chris PeBenito a1fcff
kernel_list_proc(postgresql_t)
Chris PeBenito 445522
kernel_read_all_sysctls(postgresql_t)
Chris PeBenito a1fcff
kernel_read_proc_symlinks(postgresql_t)
Chris PeBenito a1fcff
kernel_tcp_recvfrom(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito 141cff
corenet_non_ipsec_sendrecv(postgresql_t)
Chris PeBenito a1fcff
corenet_tcp_sendrecv_all_if(postgresql_t)
Chris PeBenito a1fcff
corenet_udp_sendrecv_all_if(postgresql_t)
Chris PeBenito a1fcff
corenet_tcp_sendrecv_all_nodes(postgresql_t)
Chris PeBenito a1fcff
corenet_udp_sendrecv_all_nodes(postgresql_t)
Chris PeBenito a1fcff
corenet_tcp_sendrecv_all_ports(postgresql_t)
Chris PeBenito a1fcff
corenet_udp_sendrecv_all_ports(postgresql_t)
Chris PeBenito a1fcff
corenet_tcp_bind_all_nodes(postgresql_t)
Chris PeBenito a1fcff
corenet_tcp_bind_postgresql_port(postgresql_t)
Chris PeBenito a1fcff
corenet_tcp_connect_auth_port(postgresql_t)
Chris PeBenito 141cff
corenet_sendrecv_postgresql_server_packets(postgresql_t)
Chris PeBenito 141cff
corenet_sendrecv_auth_client_packets(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
dev_read_sysfs(postgresql_t)
Chris PeBenito a1fcff
dev_read_urand(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
fs_getattr_all_fs(postgresql_t)
Chris PeBenito a1fcff
fs_search_auto_mountpoints(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
term_use_controlling_term(postgresql_t)
Chris PeBenito a1fcff
term_dontaudit_use_console(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
corecmd_exec_bin(postgresql_t)
Chris PeBenito a1fcff
corecmd_exec_ls(postgresql_t)
Chris PeBenito a1fcff
corecmd_exec_sbin(postgresql_t)
Chris PeBenito a1fcff
corecmd_exec_shell(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito 1815ba
domain_dontaudit_list_all_domains_state(postgresql_t)
Chris PeBenito 15722e
domain_use_interactive_fds(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
files_dontaudit_search_home(postgresql_t)
Chris PeBenito a1fcff
files_manage_etc_files(postgresql_t)
Chris PeBenito a1fcff
files_search_etc(postgresql_t)
Chris PeBenito a1fcff
files_read_etc_runtime_files(postgresql_t)
Chris PeBenito a1fcff
files_read_usr_files(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito 68228b
init_read_utmp(postgresql_t)
Chris PeBenito 1c1ac6
init_use_fds(postgresql_t)
Chris PeBenito 1815ba
init_use_script_ptys(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
libs_use_ld_so(postgresql_t)
Chris PeBenito a1fcff
libs_use_shared_libs(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
logging_send_syslog_msg(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
miscfiles_read_localization(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
seutil_dontaudit_search_config(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
sysnet_read_config(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito 103fe2
userdom_dontaudit_search_sysadm_home_dirs(postgresql_t)
Chris PeBenito 1815ba
userdom_dontaudit_use_sysadm_ttys(postgresql_t)
Chris PeBenito 15722e
userdom_dontaudit_use_unpriv_user_fds(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
mta_getattr_spool(postgresql_t)
Chris PeBenito a1fcff
Chris PeBenito a1fcff
ifdef(`targeted_policy', `
Chris PeBenito 9e04f5
	files_dontaudit_read_root_files(postgresql_t)
Chris PeBenito 1815ba
	term_dontaudit_use_generic_ptys(postgresql_t)
Chris PeBenito 1815ba
	term_dontaudit_use_unallocated_ttys(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
tunable_policy(`allow_execmem',`
Chris PeBenito a1fcff
	allow postgresql_t self:process execmem;
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	consoletype_exec(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	cron_search_spool(postgresql_t)
Chris PeBenito a1fcff
	cron_system_entry(postgresql_t,postgresql_exec_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	hostname_exec(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	kerberos_use(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	nis_use_ypbind(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	seutil_sigchld_newrole(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a1fcff
	udev_read_db(postgresql_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
ifdef(`TODO',`
Chris PeBenito a1fcff
ifdef(`targeted_policy', `', `
Chris PeBenito a1fcff
bool allow_user_postgresql_connect false;
Chris PeBenito a1fcff
Chris PeBenito a1fcff
if (allow_user_postgresql_connect) {
Chris PeBenito a1fcff
# allow any user domain to connect to the database server
Chris PeBenito a1fcff
can_tcp_connect(userdomain, postgresql_t)
Chris PeBenito a1fcff
allow userdomain postgresql_t:unix_stream_socket connectto;
Chris PeBenito a1fcff
allow userdomain postgresql_var_run_t:sock_file write;
Chris PeBenito a1fcff
allow userdomain postgresql_tmp_t:sock_file write;
Chris PeBenito a1fcff
}
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
ifdef(`distro_debian', `
Chris PeBenito f75479
	init_exec_script_files(postgresql_t)
Chris PeBenito a1fcff
	# gross hack
Chris PeBenito a1fcff
	postgresql_domtrans(dpkg_t)
Chris PeBenito a1fcff
	can_exec(postgresql_t, dpkg_exec_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito a1fcff
ifdef(`distro_gentoo', `
Chris PeBenito a1fcff
	allow postgresql_t initrc_su_t:process { sigchld };
Chris PeBenito a1fcff
	# "su - postgres ..." is called from initrc_t
Chris PeBenito 1815ba
	postgresql_search_db(initrc_su_t)
Chris PeBenito a1fcff
	dontaudit initrc_su_t sysadm_devpts_t:chr_file rw_file_perms;
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
')