/etc/rc\.d/init\.d/icinga2 -- gen_context(system_u:object_r:icinga2_initrc_exec_t,s0)
+/etc/icinga2(/.*)? gen_context(system_u:object_r:icinga2_etc_t,s0)
+
/etc/icinga2/scripts(/.*)? gen_context(system_u:object_r:nagios_notification_plugin_exec_t,s0)
/usr/sbin/icinga2 -- gen_context(system_u:object_r:icinga2_exec_t,s0)
init_labeled_script_domtrans($1, icinga2_initrc_exec_t)
')
+
+########################################
+## <summary>
+## Allow the specified domain to read
+## icinga2 configuration files.
+## </summary>
+## <param name="domain">
+## <summary>
+## Domain allowed access.
+## </summary>
+## </param>
+## <rolecap/>
+#
+interface(`icinga2_read_config',`
+ gen_require(`
+ type icinga2_etc_t;
+ ')
+
+ files_search_etc($1)
+ list_dirs_pattern($1, icinga2_etc_t, icinga2_etc_t)
+ read_files_pattern($1, icinga2_etc_t, icinga2_etc_t)
+')
+
+########################################
+## <summary>
+## Allow the specified domain to read
+## and write icinga2 configuration files.
+## </summary>
+## <param name="domain">
+## <summary>
+## Domain allowed access.
+## </summary>
+## </param>
+## <rolecap/>
+#
+interface(`icinga2_manage_config',`
+ gen_require(`
+ type icinga2_etc_t;
+ ')
+
+ files_search_etc($1)
+ manage_dirs_pattern($1, icinga2_etc_t, icinga2_etc_t)
+ manage_files_pattern($1, icinga2_etc_t, icinga2_etc_t)
+')
+
########################################
## <summary>
## Read icinga2's log files.
/sbin/restorecon -F -R -v /usr/sbin/icinga2
# Fixing the file context on /etc/rc\.d/init\.d/icinga2
#/sbin/restorecon -F -R -v /etc/rc\.d/init\.d/icinga2
-# Fixing the file context on /etc/icinga2/scripts
-/sbin/restorecon -F -R -v /etc/icinga2/scripts
+# Fixing the file context on /etc/icinga2
+/sbin/restorecon -F -R -v /etc/icinga2
# Fixing the file context on /var/log/icinga2
/sbin/restorecon -F -R -v /var/log/icinga2
# Fixing the file context on /var/lib/icinga2
type icinga2_initrc_exec_t;
init_script_file(icinga2_initrc_exec_t)
+type icinga2_etc_t;
+files_config_file(icinga2_etc_t)
+
type icinga2_log_t;
logging_log_file(icinga2_log_t)
allow icinga2_t self:fifo_file rw_fifo_file_perms;
allow icinga2_t self:unix_stream_socket create_stream_socket_perms;
+read_files_pattern(icinga2_t, icinga2_etc_t, icinga2_etc_t)
+read_lnk_files_pattern(icinga2_t, icinga2_etc_t, icinga2_etc_t)
+
manage_dirs_pattern(icinga2_t, icinga2_log_t, icinga2_log_t)
manage_files_pattern(icinga2_t, icinga2_log_t, icinga2_log_t)
manage_lnk_files_pattern(icinga2_t, icinga2_log_t, icinga2_log_t)