1 |
commit: 7569e1c0f74423995c2514f63b9095de900981e1 |
2 |
Author: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
3 |
AuthorDate: Mon Feb 27 21:49:55 2012 +0000 |
4 |
Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
5 |
CommitDate: Mon Feb 27 21:49:55 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=7569e1c0 |
7 |
|
8 |
Adding rev3 |
9 |
|
10 |
--- |
11 |
sec-policy/selinux-base-policy/ChangeLog | 7 +- |
12 |
.../selinux-base-policy-2.20120215-r3.ebuild | 122 +++++++++++++++ |
13 |
sec-policy/selinux-base/ChangeLog | 7 +- |
14 |
.../selinux-base/selinux-base-2.20120215-r3.ebuild | 162 ++++++++++++++++++++ |
15 |
sec-policy/selinux-squid/ChangeLog | 7 +- |
16 |
.../selinux-squid-2.20120215-r1.ebuild | 16 ++ |
17 |
6 files changed, 318 insertions(+), 3 deletions(-) |
18 |
|
19 |
diff --git a/sec-policy/selinux-base-policy/ChangeLog b/sec-policy/selinux-base-policy/ChangeLog |
20 |
index 5c0ccc5..1b0ab15 100644 |
21 |
--- a/sec-policy/selinux-base-policy/ChangeLog |
22 |
+++ b/sec-policy/selinux-base-policy/ChangeLog |
23 |
@@ -1,7 +1,12 @@ |
24 |
-# ChangeLog for sec-policy/selinux-core |
25 |
+# ChangeLog for sec-policy/selinux-base-policy |
26 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
27 |
# $Header: $ |
28 |
|
29 |
+*selinux-base-policy-2.20120215-r3 (27 Feb 2012) |
30 |
+ |
31 |
+ 27 Feb 2012; <swift@g.o> +selinux-base-policy-2.20120215-r3.ebuild: |
32 |
+ Bump to r3 |
33 |
+ |
34 |
*selinux-core-2.20120215 (25 Feb 2012) |
35 |
|
36 |
25 Feb 2012; <swift@g.o> +selinux-core-2.20120215.ebuild, |
37 |
|
38 |
diff --git a/sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r3.ebuild b/sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r3.ebuild |
39 |
new file mode 100644 |
40 |
index 0000000..e76032d |
41 |
--- /dev/null |
42 |
+++ b/sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r3.ebuild |
43 |
@@ -0,0 +1,122 @@ |
44 |
+# Copyright 1999-2012 Gentoo Foundation |
45 |
+# Distributed under the terms of the GNU General Public License v2 |
46 |
+# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-dcc/selinux-dcc-2.20110726.ebuild,v 1.2 2011/10/23 12:42:45 swift Exp $ |
47 |
+EAPI="4" |
48 |
+ |
49 |
+HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/" |
50 |
+DESCRIPTION="SELinux policy for core modules" |
51 |
+ |
52 |
+IUSE="" |
53 |
+BASEPOL="2.20120215-r3" |
54 |
+ |
55 |
+inherit eutils |
56 |
+ |
57 |
+RDEPEND=">=sec-policy/selinux-base-2.20120215-r3" |
58 |
+DEPEND="" |
59 |
+SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2 |
60 |
+ http://dev.gentoo.org/~swift/patches/${PN}/patchbundle-${PN}-${BASEPOL}.tar.bz2" |
61 |
+KEYWORDS="~amd64 ~x86" |
62 |
+ |
63 |
+MODS="application authlogin bootloader clock consoletype cron dmesg fstools getty hostname hotplug init iptables libraries locallogin logging lvm miscfiles modutils mount mta netutils nscd portage raid rsync selinuxutil ssh staff storage su sysadm sysnetwork udev userdomain usermanage unprivuser xdg unconfined" |
64 |
+LICENSE="GPL-2" |
65 |
+SLOT="0" |
66 |
+S="${WORKDIR}/" |
67 |
+PATCHBUNDLE="${DISTDIR}/patchbundle-selinux-base-policy-${BASEPOL}.tar.bz2" |
68 |
+ |
69 |
+# Code entirely copied from selinux-eclass (cannot inherit due to dependency on |
70 |
+# itself), when reworked reinclude it. Only postinstall (where -b base.pp is |
71 |
+# added) needs to remain then. |
72 |
+ |
73 |
+src_prepare() { |
74 |
+ local modfiles |
75 |
+ |
76 |
+ # Patch the sources with the base patchbundle |
77 |
+ if [[ -n ${BASEPOL} ]]; |
78 |
+ then |
79 |
+ cd "${S}" |
80 |
+ EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \ |
81 |
+ EPATCH_SUFFIX="patch" \ |
82 |
+ EPATCH_SOURCE="${WORKDIR}" \ |
83 |
+ EPATCH_FORCE="yes" \ |
84 |
+ epatch |
85 |
+ fi |
86 |
+ |
87 |
+ # Apply the additional patches refered to by the module ebuild. |
88 |
+ # But first some magic to differentiate between bash arrays and strings |
89 |
+ if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]]; |
90 |
+ then |
91 |
+ cd "${S}/refpolicy/policy/modules" |
92 |
+ for POLPATCH in "${POLICY_PATCH[@]}"; |
93 |
+ do |
94 |
+ epatch "${POLPATCH}" |
95 |
+ done |
96 |
+ else |
97 |
+ if [[ -n ${POLICY_PATCH} ]]; |
98 |
+ then |
99 |
+ cd "${S}/refpolicy/policy/modules" |
100 |
+ for POLPATCH in ${POLICY_PATCH}; |
101 |
+ do |
102 |
+ epatch "${POLPATCH}" |
103 |
+ done |
104 |
+ fi |
105 |
+ fi |
106 |
+ |
107 |
+ # Collect only those files needed for this particular module |
108 |
+ for i in ${MODS}; do |
109 |
+ modfiles="$(find ${S}/refpolicy/policy/modules -iname $i.te) $modfiles" |
110 |
+ modfiles="$(find ${S}/refpolicy/policy/modules -iname $i.fc) $modfiles" |
111 |
+ done |
112 |
+ |
113 |
+ for i in ${POLICY_TYPES}; do |
114 |
+ mkdir "${S}"/${i} || die "Failed to create directory ${S}/${i}" |
115 |
+ cp "${S}"/refpolicy/doc/Makefile.example "${S}"/${i}/Makefile \ |
116 |
+ || die "Failed to copy Makefile.example to ${S}/${i}/Makefile" |
117 |
+ |
118 |
+ cp ${modfiles} "${S}"/${i} \ |
119 |
+ || die "Failed to copy the module files to ${S}/${i}" |
120 |
+ done |
121 |
+} |
122 |
+ |
123 |
+src_compile() { |
124 |
+ for i in ${POLICY_TYPES}; do |
125 |
+ # Parallel builds are broken, so we need to force -j1 here |
126 |
+ emake -j1 NAME=$i -C "${S}"/${i} || die "${i} compile failed" |
127 |
+ done |
128 |
+} |
129 |
+ |
130 |
+src_install() { |
131 |
+ local BASEDIR="/usr/share/selinux" |
132 |
+ |
133 |
+ for i in ${POLICY_TYPES}; do |
134 |
+ for j in ${MODS}; do |
135 |
+ einfo "Installing ${i} ${j} policy package" |
136 |
+ insinto ${BASEDIR}/${i} |
137 |
+ doins "${S}"/${i}/${j}.pp || die "Failed to add ${j}.pp to ${i}" |
138 |
+ done |
139 |
+ done |
140 |
+} |
141 |
+ |
142 |
+pkg_postinst() { |
143 |
+ # Override the command from the eclass, we need to load in base as well here |
144 |
+ local COMMAND |
145 |
+ for i in ${MODS}; do |
146 |
+ COMMAND="-i ${i}.pp ${COMMAND}" |
147 |
+ done |
148 |
+ |
149 |
+ for i in ${POLICY_TYPES}; do |
150 |
+ local LOCCOMMAND |
151 |
+ local LOCMODS |
152 |
+ if [[ "${i}" != "targeted" ]]; then |
153 |
+ LOCCOMMAND=$(echo "${COMMAND}" | sed -e 's:-i unconfined.pp::g'); |
154 |
+ LOCMODS=$(echo "${MODS}" | sed -e 's: unconfined::g'); |
155 |
+ else |
156 |
+ LOCCOMMAND="${COMMAND}" |
157 |
+ LOCMODS="${MODS}" |
158 |
+ fi |
159 |
+ einfo "Inserting the following modules, with base, into the $i module store: ${LOCMODS}" |
160 |
+ |
161 |
+ cd /usr/share/selinux/${i} || die "Could not enter /usr/share/selinux/${i}" |
162 |
+ |
163 |
+ semodule -s ${i} -b base.pp ${LOCCOMMAND} || die "Failed to load in base and modules ${LOCMODS} in the $i policy store" |
164 |
+ done |
165 |
+} |
166 |
|
167 |
diff --git a/sec-policy/selinux-base/ChangeLog b/sec-policy/selinux-base/ChangeLog |
168 |
index 0f2d9e7..4b9e30c 100644 |
169 |
--- a/sec-policy/selinux-base/ChangeLog |
170 |
+++ b/sec-policy/selinux-base/ChangeLog |
171 |
@@ -1,7 +1,12 @@ |
172 |
-# ChangeLog for sec-policy/selinux-base-policy |
173 |
+# ChangeLog for sec-policy/selinux-base |
174 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
175 |
# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog,v 1.95 2012/01/29 13:08:48 swift Exp $ |
176 |
|
177 |
+*selinux-base-2.20120215-r3 (27 Feb 2012) |
178 |
+ |
179 |
+ 27 Feb 2012; <swift@g.o> +selinux-base-2.20120215-r3.ebuild: |
180 |
+ Bump to r3 |
181 |
+ |
182 |
29 Jan 2012; <swift@g.o> Manifest: |
183 |
Updating manifest |
184 |
|
185 |
|
186 |
diff --git a/sec-policy/selinux-base/selinux-base-2.20120215-r3.ebuild b/sec-policy/selinux-base/selinux-base-2.20120215-r3.ebuild |
187 |
new file mode 100644 |
188 |
index 0000000..866e80f |
189 |
--- /dev/null |
190 |
+++ b/sec-policy/selinux-base/selinux-base-2.20120215-r3.ebuild |
191 |
@@ -0,0 +1,162 @@ |
192 |
+# Copyright 1999-2012 Gentoo Foundation |
193 |
+# Distributed under the terms of the GNU General Public License v2 |
194 |
+# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/selinux-base-policy-2.20110726-r13.ebuild,v 1.1 2012/02/23 18:17:40 swift Exp $ |
195 |
+ |
196 |
+EAPI="4" |
197 |
+IUSE="+peer_perms +open_perms +ubac doc" |
198 |
+ |
199 |
+inherit eutils |
200 |
+ |
201 |
+DESCRIPTION="Gentoo base policy for SELinux" |
202 |
+HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/" |
203 |
+SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2 |
204 |
+ http://dev.gentoo.org/~swift/patches/selinux-base-policy/patchbundle-selinux-base-policy-${PVR}.tar.bz2" |
205 |
+LICENSE="GPL-2" |
206 |
+SLOT="0" |
207 |
+ |
208 |
+KEYWORDS="~amd64 ~x86" |
209 |
+ |
210 |
+RDEPEND=">=sys-apps/policycoreutils-2.1.10 |
211 |
+ >=sys-fs/udev-151 |
212 |
+ !<=sec-policy/selinux-base-policy-2.20120215" |
213 |
+DEPEND="${RDEPEND} |
214 |
+ sys-devel/m4 |
215 |
+ >=sys-apps/checkpolicy-2.1.8" |
216 |
+ |
217 |
+S=${WORKDIR}/ |
218 |
+ |
219 |
+src_prepare() { |
220 |
+ # Apply the gentoo patches to the policy. These patches are only necessary |
221 |
+ # for base policies, or for interface changes on modules. |
222 |
+ EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \ |
223 |
+ EPATCH_SUFFIX="patch" \ |
224 |
+ EPATCH_SOURCE="${WORKDIR}" \ |
225 |
+ EPATCH_FORCE="yes" \ |
226 |
+ epatch |
227 |
+ |
228 |
+ cd "${S}/refpolicy" |
229 |
+ # Fix bug 257111 - Correct the initial sid for cron-started jobs in the |
230 |
+ # system_r role |
231 |
+ sed -i -e 's:system_crond_t:system_cronjob_t:g' \ |
232 |
+ "${S}/refpolicy/config/appconfig-standard/default_contexts" |
233 |
+ sed -i -e 's|system_r:cronjob_t|system_r:system_cronjob_t|g' \ |
234 |
+ "${S}/refpolicy/config/appconfig-mls/default_contexts" |
235 |
+ sed -i -e 's|system_r:cronjob_t|system_r:system_cronjob_t|g' \ |
236 |
+ "${S}/refpolicy/config/appconfig-mcs/default_contexts" |
237 |
+} |
238 |
+ |
239 |
+src_configure() { |
240 |
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs" |
241 |
+ |
242 |
+ # Update the SELinux refpolicy capabilities based on the users' USE flags. |
243 |
+ |
244 |
+ if ! use peer_perms; then |
245 |
+ sed -i -e '/network_peer_controls/d' \ |
246 |
+ "${S}/refpolicy/policy/policy_capabilities" |
247 |
+ fi |
248 |
+ |
249 |
+ if ! use open_perms; then |
250 |
+ sed -i -e '/open_perms/d' \ |
251 |
+ "${S}/refpolicy/policy/policy_capabilities" |
252 |
+ fi |
253 |
+ |
254 |
+ if ! use ubac; then |
255 |
+ sed -i -e '/^UBAC/s/y/n/' "${S}/refpolicy/build.conf" \ |
256 |
+ || die "Failed to disable User Based Access Control" |
257 |
+ fi |
258 |
+ |
259 |
+ echo "DISTRO = gentoo" >> "${S}/refpolicy/build.conf" |
260 |
+ |
261 |
+ # Setup the policies based on the types delivered by the end user. |
262 |
+ # These types can be "targeted", "strict", "mcs" and "mls". |
263 |
+ for i in ${POLICY_TYPES}; do |
264 |
+ cp -a "${S}/refpolicy" "${S}/${i}" |
265 |
+ |
266 |
+ cd "${S}/${i}"; |
267 |
+ make conf || die "Make conf in ${i} failed" |
268 |
+ |
269 |
+ #cp "${FILESDIR}/modules-2.20120215.conf" "${S}/${i}/policy/modules.conf" |
270 |
+ sed -i -e "/= module/d" "${S}/${i}/policy/modules.conf" |
271 |
+ |
272 |
+ sed -i -e '/^QUIET/s/n/y/' -e "/^NAME/s/refpolicy/$i/" \ |
273 |
+ "${S}/${i}/build.conf" || die "build.conf setup failed." |
274 |
+ |
275 |
+ if [[ "${i}" == "mls" ]] || [[ "${i}" == "mcs" ]]; |
276 |
+ then |
277 |
+ # MCS/MLS require additional settings |
278 |
+ sed -i -e "/^TYPE/s/standard/${i}/" "${S}/${i}/build.conf" \ |
279 |
+ || die "failed to set type to mls" |
280 |
+ fi |
281 |
+ |
282 |
+ if [ "${i}" == "targeted" ]; then |
283 |
+ sed -i -e '/root/d' -e 's/user_u/unconfined_u/' \ |
284 |
+ "${S}/${i}/config/appconfig-standard/seusers" \ |
285 |
+ || die "targeted seusers setup failed." |
286 |
+ fi |
287 |
+ done |
288 |
+} |
289 |
+ |
290 |
+src_compile() { |
291 |
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs" |
292 |
+ |
293 |
+ for i in ${POLICY_TYPES}; do |
294 |
+ cd "${S}/${i}" |
295 |
+ make base || die "${i} compile failed" |
296 |
+ if use doc; then |
297 |
+ make html || die |
298 |
+ fi |
299 |
+ done |
300 |
+} |
301 |
+ |
302 |
+src_install() { |
303 |
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs" |
304 |
+ |
305 |
+ for i in ${POLICY_TYPES}; do |
306 |
+ cd "${S}/${i}" |
307 |
+ |
308 |
+ make DESTDIR="${D}" install \ |
309 |
+ || die "${i} install failed." |
310 |
+ |
311 |
+ make DESTDIR="${D}" install-headers \ |
312 |
+ || die "${i} headers install failed." |
313 |
+ |
314 |
+ echo "run_init_t" > "${D}/etc/selinux/${i}/contexts/run_init_type" |
315 |
+ |
316 |
+ echo "textrel_shlib_t" >> "${D}/etc/selinux/${i}/contexts/customizable_types" |
317 |
+ |
318 |
+ # libsemanage won't make this on its own |
319 |
+ keepdir "/etc/selinux/${i}/policy" |
320 |
+ |
321 |
+ if use doc; then |
322 |
+ dohtml doc/html/*; |
323 |
+ fi |
324 |
+ done |
325 |
+ |
326 |
+ dodoc doc/Makefile.example doc/example.{te,fc,if} |
327 |
+ |
328 |
+ insinto /etc/selinux |
329 |
+ doins "${FILESDIR}/config" |
330 |
+} |
331 |
+ |
332 |
+pkg_preinst() { |
333 |
+ has_version "<${CATEGORY}/${PN}-2.20101213-r13" |
334 |
+ previous_less_than_r13=$? |
335 |
+} |
336 |
+ |
337 |
+pkg_postinst() { |
338 |
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs" |
339 |
+ |
340 |
+ for i in ${POLICY_TYPES}; do |
341 |
+ einfo "Trying to insert base module into ${i} module store." |
342 |
+ |
343 |
+ cd "${ROOT}/usr/share/selinux/${i}" |
344 |
+ semodule -s "${i}" -b base.pp |
345 |
+ if [[ $? -ne 0 ]]; then |
346 |
+ ewarn "Base policy failed loading. However, this can be ignored if" |
347 |
+ ewarn "you still have to install (or update) selinux-core." |
348 |
+ fi |
349 |
+ done |
350 |
+ elog "Updates on policies might require you to relabel files. If you, after" |
351 |
+ elog "installing new SELinux policies, get 'permission denied' errors," |
352 |
+ elog "relabelling your system using 'rlpkg -a -r' might resolve the issues." |
353 |
+} |
354 |
|
355 |
diff --git a/sec-policy/selinux-squid/ChangeLog b/sec-policy/selinux-squid/ChangeLog |
356 |
index 464c1f6..d06d4e4 100644 |
357 |
--- a/sec-policy/selinux-squid/ChangeLog |
358 |
+++ b/sec-policy/selinux-squid/ChangeLog |
359 |
@@ -1,7 +1,12 @@ |
360 |
# ChangeLog for sec-policy/selinux-squid |
361 |
-# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 |
362 |
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
363 |
# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-squid/ChangeLog,v 1.38 2011/11/12 20:52:46 swift Exp $ |
364 |
|
365 |
+*selinux-squid-2.20120215-r1 (27 Feb 2012) |
366 |
+ |
367 |
+ 27 Feb 2012; <swift@g.o> +selinux-squid-2.20120215-r1.ebuild: |
368 |
+ Add support for squid port 3128 |
369 |
+ |
370 |
12 Nov 2011; <swift@g.o> -selinux-squid-2.20101213-r1.ebuild: |
371 |
Removing old policies |
372 |
|
373 |
|
374 |
diff --git a/sec-policy/selinux-squid/selinux-squid-2.20120215-r1.ebuild b/sec-policy/selinux-squid/selinux-squid-2.20120215-r1.ebuild |
375 |
new file mode 100644 |
376 |
index 0000000..9012f60 |
377 |
--- /dev/null |
378 |
+++ b/sec-policy/selinux-squid/selinux-squid-2.20120215-r1.ebuild |
379 |
@@ -0,0 +1,16 @@ |
380 |
+# Copyright 1999-2012 Gentoo Foundation |
381 |
+# Distributed under the terms of the GNU General Public License v2 |
382 |
+# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-squid/selinux-squid-2.20110726.ebuild,v 1.2 2011/10/23 12:42:28 swift Exp $ |
383 |
+EAPI="4" |
384 |
+ |
385 |
+IUSE="" |
386 |
+MODS="squid" |
387 |
+BASEPOL="2.20120215-r3" |
388 |
+ |
389 |
+inherit selinux-policy-2 |
390 |
+ |
391 |
+DESCRIPTION="SELinux policy for squid" |
392 |
+ |
393 |
+KEYWORDS="~amd64 ~x86" |
394 |
+DEPEND=">=sec-policy/selinux-apache-2.20120215" |
395 |
+RDEPEND="${DEPEND}" |