diff options
Diffstat (limited to 'policy/modules/contrib/ldap.if')
-rw-r--r-- | policy/modules/contrib/ldap.if | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/policy/modules/contrib/ldap.if b/policy/modules/contrib/ldap.if new file mode 100644 index 000000000..e131cfae4 --- /dev/null +++ b/policy/modules/contrib/ldap.if @@ -0,0 +1,123 @@ +## <summary>OpenLDAP directory server</summary> + +######################################## +## <summary> +## Read the contents of the OpenLDAP +## database directories. +## </summary> +## <param name="domain"> +## <summary> +## Domain allowed access. +## </summary> +## </param> +# +interface(`ldap_list_db',` + gen_require(` + type slapd_db_t; + ') + + allow $1 slapd_db_t:dir list_dir_perms; +') + +######################################## +## <summary> +## Read the OpenLDAP configuration files. +## </summary> +## <param name="domain"> +## <summary> +## Domain allowed access. +## </summary> +## </param> +## <rolecap/> +# +interface(`ldap_read_config',` + gen_require(` + type slapd_etc_t; + ') + + files_search_etc($1) + allow $1 slapd_etc_t:file read_file_perms; +') + +######################################## +## <summary> +## Use LDAP over TCP connection. (Deprecated) +## </summary> +## <param name="domain"> +## <summary> +## Domain allowed access. +## </summary> +## </param> +# +interface(`ldap_use',` + refpolicywarn(`$0($*) has been deprecated.') +') + +######################################## +## <summary> +## Connect to slapd over an unix stream socket. +## </summary> +## <param name="domain"> +## <summary> +## Domain allowed access. +## </summary> +## </param> +# +interface(`ldap_stream_connect',` + gen_require(` + type slapd_t, slapd_var_run_t; + ') + + files_search_pids($1) + allow $1 slapd_var_run_t:sock_file write; + allow $1 slapd_t:unix_stream_socket connectto; +') + +######################################## +## <summary> +## All of the rules required to administrate +## an ldap environment +## </summary> +## <param name="domain"> +## <summary> +## Domain allowed access. +## </summary> +## </param> +## <param name="role"> +## <summary> +## The role to be allowed to manage the ldap domain. +## </summary> +## </param> +## <rolecap/> +# +interface(`ldap_admin',` + gen_require(` + type slapd_t, slapd_tmp_t, slapd_replog_t; + type slapd_lock_t, slapd_etc_t, slapd_var_run_t; + type slapd_initrc_exec_t, slapd_exec_t; + ') + + allow $1 slapd_t:process { ptrace signal_perms }; + ps_process_pattern($1, slapd_t) + + init_labeled_script_domtrans($1, slapd_initrc_exec_t) + domain_system_change_exemption($1) + role_transition $2 slapd_initrc_exec_t system_r; + allow $2 system_r; + + role $2 types slapd_t; + domtrans_pattern($1, slapd_exec_t, slapd_t) + + files_list_etc($1) + admin_pattern($1, slapd_etc_t) + + admin_pattern($1, slapd_lock_t) + + admin_pattern($1, slapd_replog_t) + + files_list_tmp($1) + admin_pattern($1, slapd_tmp_t) + + files_list_pids($1) + admin_pattern($1, slapd_var_run_t) +') |