Gentoo Archives: gentoo-commits

From: Sven Vermeulen <sven.vermeulen@××××××.be>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/contrib/, policy/modules/system/
Date: Mon, 29 Oct 2012 18:41:40
Message-Id: 1351535818.47e52f4053dbb7f6c1c8e87ca1281138ae9fdd50.SwifT@gentoo
1 commit: 47e52f4053dbb7f6c1c8e87ca1281138ae9fdd50
2 Author: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be>
3 AuthorDate: Mon Oct 29 18:36:58 2012 +0000
4 Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be>
5 CommitDate: Mon Oct 29 18:36:58 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=47e52f40
7
8 Fixing cron access
9
10 Update the system logger policy to not allow write access on all possible log
11 files (too many log types are marked as logfile even though many of them are not
12 meant to be managed by the system logger). Instead, we use specific rights - in
13 this case for the cron log file.
14
15 Introduce a named file transition for when the system logger creates the initial
16 cron.log file. Also allow the write, setattr and create rights. We don't
17 implement full _manage_ rights as system loggers are not meant to remove log
18 files (unless someone points me to a use case for that).
19
20 ---
21 policy/modules/contrib/cron.if | 83 ++++++++++++++++++++++++++++++++++++++
22 policy/modules/system/logging.te | 7 ++-
23 2 files changed, 88 insertions(+), 2 deletions(-)
24
25 diff --git a/policy/modules/contrib/cron.if b/policy/modules/contrib/cron.if
26 index 2981f1f..e6259bd 100644
27 --- a/policy/modules/contrib/cron.if
28 +++ b/policy/modules/contrib/cron.if
29 @@ -409,6 +409,89 @@ interface(`cron_sigchld',`
30
31 ########################################
32 ## <summary>
33 +## Set the attributes of cron log files.
34 +## </summary>
35 +## <param name="domain">
36 +## <summary>
37 +## Domain allowed access.
38 +## </summary>
39 +## </param>
40 +#
41 +interface(`cron_setattr_log_files',`
42 + gen_require(`
43 + type cron_log_t;
44 + ')
45 +
46 + allow $1 cron_log_t:file setattr_file_perms;
47 +')
48 +
49 +########################################
50 +## <summary>
51 +## Create cron log files.
52 +## </summary>
53 +## <param name="domain">
54 +## <summary>
55 +## Domain allowed access.
56 +## </summary>
57 +## </param>
58 +#
59 +interface(`cron_create_log_files',`
60 + gen_require(`
61 + type cron_log_t;
62 + ')
63 +
64 + allow $1 cron_log_t:file create_file_perms;
65 +')
66 +
67 +########################################
68 +## <summary>
69 +## Write to cron log files.
70 +## </summary>
71 +## <param name="domain">
72 +## <summary>
73 +## Domain allowed access.
74 +## </summary>
75 +## </param>
76 +#
77 +interface(`cron_write_log_files',`
78 + gen_require(`
79 + type cron_log_t;
80 + ')
81 +
82 + allow $1 cron_log_t:file write_file_perms;
83 +')
84 +
85 +########################################
86 +## <summary>
87 +## Create specified objects in generic
88 +## log directories with the cron log file type.
89 +## </summary>
90 +## <param name="domain">
91 +## <summary>
92 +## Domain allowed access.
93 +## </summary>
94 +## </param>
95 +## <param name="object_class">
96 +## <summary>
97 +## Class of the object being created.
98 +## </summary>
99 +## </param>
100 +## <param name="name" optional="true">
101 +## <summary>
102 +## The name of the object being created.
103 +## </summary>
104 +## </param>
105 +#
106 +interface(`cron_generic_log_filetrans_log',`
107 + gen_require(`
108 + type cron_log_t;
109 + ')
110 +
111 + logging_log_filetrans($1, cron_log_t, $2, $3)
112 +')
113 +
114 +########################################
115 +## <summary>
116 ## Read cron daemon unnamed pipes.
117 ## </summary>
118 ## <param name="domain">
119
120 diff --git a/policy/modules/system/logging.te b/policy/modules/system/logging.te
121 index 0e817b7..116b338 100644
122 --- a/policy/modules/system/logging.te
123 +++ b/policy/modules/system/logging.te
124 @@ -470,12 +470,15 @@ userdom_dontaudit_use_unpriv_user_fds(syslogd_t)
125 userdom_dontaudit_search_user_home_dirs(syslogd_t)
126
127 ifdef(`distro_gentoo',`
128 - allow syslogd_t logfile:file { write_file_perms setattr_file_perms };
129 -
130 # default gentoo syslog-ng config appends kernel
131 # and high priority messages to /dev/tty12
132 term_append_unallocated_ttys(syslogd_t)
133 term_dontaudit_setattr_unallocated_ttys(syslogd_t)
134 +
135 + cron_create_log_files(syslogd_t)
136 + cron_generic_log_filetrans_log(syslogd_t, file, "cron.log")
137 + cron_setattr_log_files(syslogd_t)
138 + cron_write_log_files(syslogd_t)
139 ')
140
141 ifdef(`distro_suse',`