From ff0937af030500654ca386cd2239b87b4b1f46d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Sun, 10 Sep 2017 17:48:03 +0200
Subject: [PATCH] rkhunter: add interfaces for var_run and lock dir access
 check

---
 policy/modules/kernel/files.if | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if
index 1b10d466d..597801ade 100644
--- a/policy/modules/kernel/files.if
+++ b/policy/modules/kernel/files.if
@@ -5816,6 +5816,25 @@ interface(`files_list_locks',`
 	list_dirs_pattern($1, var_t, var_lock_t)
 ')
 
+########################################
+## <summary>
+##	Test write access on lock directories.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`files_check_write_lock_dirs',`
+	gen_require(`
+		type var_lock_t;
+	')
+
+	allow $1 var_lock_t:lnk_file read_lnk_file_perms;
+	allow $1 var_lock_t:dir write;
+')
+
 ########################################
 ## <summary>
 ##	Add entries in the /var/lock directories.
@@ -6222,6 +6241,24 @@ interface(`files_create_pid_dirs',`
 	allow $1 var_run_t:dir create_dir_perms;
 ')
 
+########################################
+## <summary>
+##	Check write access on /var/run directories.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`files_check_write_pid_dirs',`
+	gen_require(`
+		type var_run_t;
+	')
+
+	allow $1 var_run_t:dir write;
+')
+
 ########################################
 ## <summary>
 ##	Read generic process ID files.