From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 04C13138010 for ; Tue, 2 Oct 2012 18:24:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5325B21C029; Tue, 2 Oct 2012 18:11:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0FE9D21C027 for ; Tue, 2 Oct 2012 18:11:12 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 14A3833D132 for ; Tue, 2 Oct 2012 18:11:05 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id F049DE5454 for ; Tue, 2 Oct 2012 18:11:00 +0000 (UTC) From: "Sven Vermeulen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Vermeulen" Message-ID: <1349201216.3a8dfeed16e5aacda90b31b64657a1cd5c15687c.SwifT@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/contrib/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/contrib/firewalld.fc policy/modules/contrib/firewalld.if policy/modules/contrib/firewalld.te X-VCS-Directories: policy/modules/contrib/ X-VCS-Committer: SwifT X-VCS-Committer-Name: Sven Vermeulen X-VCS-Revision: 3a8dfeed16e5aacda90b31b64657a1cd5c15687c X-VCS-Branch: master Date: Tue, 2 Oct 2012 18:11:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 57bc35e0-c5ee-4fb3-89ea-31427decabf8 X-Archives-Hash: ba1850a563e73c19e9f5fff3c53a05af commit: 3a8dfeed16e5aacda90b31b64657a1cd5c15687c Author: Sven Vermeulen siphos be> AuthorDate: Tue Oct 2 18:06:56 2012 +0000 Commit: Sven Vermeulen siphos be> CommitDate: Tue Oct 2 18:06:56 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=3a8dfeed Initial firewalld policy module --- policy/modules/contrib/firewalld.fc | 10 ++++ policy/modules/contrib/firewalld.if | 43 ++++++++++++++++++ policy/modules/contrib/firewalld.te | 85 +++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 0 deletions(-) diff --git a/policy/modules/contrib/firewalld.fc b/policy/modules/contrib/firewalld.fc new file mode 100644 index 0000000..21d7b84 --- /dev/null +++ b/policy/modules/contrib/firewalld.fc @@ -0,0 +1,10 @@ +/etc/rc\.d/init\.d/firewalld -- gen_context(system_u:object_r:firewalld_initrc_exec_t,s0) + +/etc/firewalld(/.*)? gen_context(system_u:object_r:firewalld_etc_rw_t,s0) + +/usr/sbin/firewalld -- gen_context(system_u:object_r:firewalld_exec_t,s0) + +/var/log/firewalld.* -- gen_context(system_u:object_r:firewalld_var_log_t,s0) + +/var/run/firewalld(/.*)? gen_context(system_u:object_r:firewalld_var_run_t,s0) +/var/run/firewalld\.pid -- gen_context(system_u:object_r:firewalld_var_run_t,s0) diff --git a/policy/modules/contrib/firewalld.if b/policy/modules/contrib/firewalld.if new file mode 100644 index 0000000..82a225a --- /dev/null +++ b/policy/modules/contrib/firewalld.if @@ -0,0 +1,43 @@ +## Service daemon with a D-BUS interface that provides a dynamic managed firewall. + +######################################## +## +## All of the rules required to +## administrate an firewalld environment. +## +## +## +## Domain allowed access. +## +## +## +## +## Role allowed access. +## +## +## +# +interface(`firewalld_admin',` + gen_require(` + type firewalld_t, firewalld_initrc_exec_t; + type firewall_etc_rw_t, firewalld_var_run_t; + type firewalld_var_log_t; + ') + + allow $1 firewalld_t:process { ptrace signal_perms }; + ps_process_pattern($1, firewalld_t) + + init_labeled_script_domtrans($1, firewalld_initrc_exec_t) + domain_system_change_exemption($1) + role_transition $2 firewalld_initrc_exec_t system_r; + allow $2 system_r; + + files_search_pids($1) + admin_pattern($1, firewalld_var_run_t) + + logging_search_logs($1) + admin_pattern($1, firewalld_var_log_t) + + files_search_etc($1) + admin_pattern($1, firewall_etc_rw_t) +') diff --git a/policy/modules/contrib/firewalld.te b/policy/modules/contrib/firewalld.te new file mode 100644 index 0000000..0010122 --- /dev/null +++ b/policy/modules/contrib/firewalld.te @@ -0,0 +1,85 @@ +policy_module(firewalld, 1.0.0) + +######################################## +# +# Declarations +# + +type firewalld_t; +type firewalld_exec_t; +init_daemon_domain(firewalld_t, firewalld_exec_t) + +type firewalld_initrc_exec_t; +init_script_file(firewalld_initrc_exec_t) + +type firewalld_etc_rw_t; +files_config_file(firewalld_etc_rw_t) + +type firewalld_var_log_t; +logging_log_file(firewalld_var_log_t) + +type firewalld_var_run_t; +files_pid_file(firewalld_var_run_t) + +######################################## +# +# Local policy +# + +dontaudit firewalld_t self:capability sys_tty_config; +allow firewalld_t self:fifo_file rw_fifo_file_perms; +allow firewalld_t self:unix_stream_socket create_stream_socket_perms; + +manage_dirs_pattern(firewalld_t, firewalld_etc_rw_t, firewalld_etc_rw_t) +manage_files_pattern(firewalld_t, firewalld_etc_rw_t, firewalld_etc_rw_t) + +allow firewalld_t firewalld_var_log_t:file append_file_perms; +allow firewalld_t firewalld_var_log_t:file create_file_perms; +allow firewalld_t firewalld_var_log_t:file read_file_perms; +allow firewalld_t firewalld_var_log_t:file setattr_file_perms; +logging_log_filetrans(firewalld_t, firewalld_var_log_t, file) + +manage_files_pattern(firewalld_t, firewalld_var_run_t, firewalld_var_run_t) +files_pid_filetrans(firewalld_t, firewalld_var_run_t, file) + +kernel_read_network_state(firewalld_t) +kernel_read_system_state(firewalld_t) + +corecmd_exec_bin(firewalld_t) +corecmd_exec_shell(firewalld_t) + +dev_read_urand(firewalld_t) + +domain_use_interactive_fds(firewalld_t) + +files_read_etc_files(firewalld_t) +files_read_usr_files(firewalld_t) + +fs_getattr_xattr_fs(firewalld_t) + +logging_send_syslog_msg(firewalld_t) + +miscfiles_read_localization(firewalld_t) + +seutil_exec_setfiles(firewalld_t) +seutil_read_file_contexts(firewalld_t) + +optional_policy(` + dbus_system_domain(firewalld_t, firewalld_exec_t) + + optional_policy(` + policykit_dbus_chat(firewalld_t) + ') + + optional_policy(` + networkmanager_dbus_chat(firewalld_t) + ') +') + +optional_policy(` + iptables_domtrans(firewalld_t) +') + +optional_policy(` + modutils_domtrans_insmod(firewalld_t) +')