From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7D9AC139085 for ; Fri, 13 Jan 2017 18:43:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3D00E234052; Fri, 13 Jan 2017 18:43:17 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 073B9234052 for ; Fri, 13 Jan 2017 18:43:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 155153417F4 for ; Fri, 13 Jan 2017 18:43:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EA3B52640 for ; Fri, 13 Jan 2017 18:43:10 +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: <1484332898.1c5eb0bbef55a47a0867916104065beb3f5e26f0.swift@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: / X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: dphysswapfile.fc dphysswapfile.if dphysswapfile.te X-VCS-Directories: / X-VCS-Committer: swift X-VCS-Committer-Name: Sven Vermeulen X-VCS-Revision: 1c5eb0bbef55a47a0867916104065beb3f5e26f0 X-VCS-Branch: master Date: Fri, 13 Jan 2017 18:43:10 +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: 026d265d-e582-40a4-a726-6ae41244848e X-Archives-Hash: b5c464294b2ac29cec2f261964905f89 commit: 1c5eb0bbef55a47a0867916104065beb3f5e26f0 Author: cgzones googlemail com> AuthorDate: Thu Jan 5 20:02:36 2017 +0000 Commit: Sven Vermeulen gentoo org> CommitDate: Fri Jan 13 18:41:38 2017 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=1c5eb0bb add dphysswapfile module dphysswapfile.fc | 5 +++++ dphysswapfile.if | 19 +++++++++++++++++++ dphysswapfile.te | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/dphysswapfile.fc b/dphysswapfile.fc new file mode 100644 index 0000000..1b2bfcc --- /dev/null +++ b/dphysswapfile.fc @@ -0,0 +1,5 @@ +/etc/dphys-swapfile -- gen_context(system_u:object_r:dphysswapfile_conf_t,s0) + +/sbin/dphys-swapfile -- gen_context(system_u:object_r:dphysswapfile_exec_t,s0) + +/var/swap -- gen_context(system_u:object_r:dphysswapfile_swap_t,s0) diff --git a/dphysswapfile.if b/dphysswapfile.if new file mode 100644 index 0000000..5372574 --- /dev/null +++ b/dphysswapfile.if @@ -0,0 +1,19 @@ +## Set up, mount/unmount, and delete an swap file. + +######################################## +## +## Dontaudit acces to the swap file. +## +## +## +## Domain to not audit. +## +## +# +interface(`dphysswapfile_dontaudit_read_swap',` + gen_require(` + type dphysswapfile_swap_t; + ') + + dontaudit $1 dphysswapfile_swap_t:file read_file_perms; +') diff --git a/dphysswapfile.te b/dphysswapfile.te new file mode 100644 index 0000000..1dabdb1 --- /dev/null +++ b/dphysswapfile.te @@ -0,0 +1,47 @@ +policy_module(dphysswapfile, 0.0.1) + +######################################## +# +# Declarations +# + +type dphysswapfile_t; +type dphysswapfile_exec_t; +init_system_domain(dphysswapfile_t, dphysswapfile_exec_t) + +type dphysswapfile_conf_t; +files_config_file(dphysswapfile_conf_t) + +type dphysswapfile_swap_t; +files_type(dphysswapfile_swap_t) + +######################################## +# +# Policy +# + +# sys_admin : for swapon +allow dphysswapfile_t self:capability sys_admin; +allow dphysswapfile_t self:fifo_file rw_fifo_file_perms; +allow dphysswapfile_t self:unix_stream_socket { create connect }; + +allow dphysswapfile_t dphysswapfile_conf_t:file read_file_perms; + +allow dphysswapfile_t dphysswapfile_exec_t:file execute_no_trans; + +allow dphysswapfile_t dphysswapfile_swap_t:file manage_file_perms; + +kernel_read_system_state(dphysswapfile_t) + +corecmd_exec_bin(dphysswapfile_t) +corecmd_exec_shell(dphysswapfile_t) + +files_dontaudit_getattr_pid_dirs(dphysswapfile_t) +files_read_etc_files(dphysswapfile_t) +files_search_var(dphysswapfile_t) + +fstools_exec(dphysswapfile_t) + +miscfiles_read_localization(dphysswapfile_t) + +userdom_dontaudit_search_user_home_dirs(dphysswapfile_t)