summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenton Groombridge <concord@gentoo.org>2024-03-01 13:10:00 -0500
committerKenton Groombridge <concord@gentoo.org>2024-03-01 14:47:37 -0500
commit9a78c8130c665e43426fcb735ad69bd838984a81 (patch)
tree0fa31b3d8529fe8e56fa40c6701068af4312e2a8 /sec-policy/selinux-base
parentdev-util/spirv-llvm-translator: Stabilize 17.0.0-r2 amd64, #920053 (diff)
downloadgentoo-9a78c8130c665e43426fcb735ad69bd838984a81.tar.gz
gentoo-9a78c8130c665e43426fcb735ad69bd838984a81.tar.bz2
gentoo-9a78c8130c665e43426fcb735ad69bd838984a81.zip
sec-policy: Release of SELinux policies 2.20240226-r1
Signed-off-by: Kenton Groombridge <concord@gentoo.org>
Diffstat (limited to 'sec-policy/selinux-base')
-rw-r--r--sec-policy/selinux-base/Manifest2
-rw-r--r--sec-policy/selinux-base/selinux-base-2.20240226-r1.ebuild158
2 files changed, 160 insertions, 0 deletions
diff --git a/sec-policy/selinux-base/Manifest b/sec-policy/selinux-base/Manifest
index 4effec8926ca..adee87f98e64 100644
--- a/sec-policy/selinux-base/Manifest
+++ b/sec-policy/selinux-base/Manifest
@@ -1,2 +1,4 @@
DIST patchbundle-selinux-base-policy-2.20231002-r2.tar.bz2 436443 BLAKE2B f481e661b4afadd15f786a5d69d975d79e5d9a378c7bca279282d59215a02897a9587cbd56f7a2d95fd8152f931c0a8d469927033910e8fe214ee4494f4e6e49 SHA512 8545592130d7d10f7d6411a356e79f9cb2689138a7eb69a5f7bcd630203019c61336f1e3bdbc95dea31efceb41c9bce2e7ff42ced6a51a9b7482e991864fec05
+DIST patchbundle-selinux-base-policy-2.20240226-r1.tar.bz2 430565 BLAKE2B 2d552f868375c240e71e987542a3026970f1d375d7d1e65f11386ce1b07aae84911ded2379fc768ff4bff664eb98dc3361a7392467fed3feb4916477eb957f58 SHA512 f22245ad8759d88ddbf26b71443e4ba8c804fc80d69383120ed98b7887d08a7034b8125e4d15e695b26776ef4ac1a933e14a1a382d5be90aa942358842cc6c77
DIST refpolicy-2.20231002.tar.bz2 600458 BLAKE2B 254d6d3d6b95f21e1f8e1df5822520ccaeade427053fb172079427cf70bd33f8ced87a9e09e1d36ec5f7b33f0bac8d730020d91996c6d25eafdcec66ebe35bb3 SHA512 029cd2225ce57d96f681720f24828e962320af41832ad2dc95d4d41d00dbde20bb08d91fa8b964b592812a9fedd908c261734b77ad72cccfde2de541b9c2c74d
+DIST refpolicy-2.20240226.tar.bz2 610561 BLAKE2B 5dc54dcf7238776d4e4b282c1dcbc499f45c0d96676dbf931da39592854034874b5dd6197a2e2776fccec5106d5f245eea3fb9419959bd4d61e9b2c12aeaaa85 SHA512 896a57afb024bd131f25d2831a9a5ac90ee7e5d76b0565bc818c156f6c310d86758bcd4cedbd9df5b29954c9a92a42300d16685a7e07a5efd8f789320724b3f9
diff --git a/sec-policy/selinux-base/selinux-base-2.20240226-r1.ebuild b/sec-policy/selinux-base/selinux-base-2.20240226-r1.ebuild
new file mode 100644
index 000000000000..71793825f448
--- /dev/null
+++ b/sec-policy/selinux-base/selinux-base-2.20240226-r1.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_REQ_USE="xml(+)"
+inherit python-any-r1
+
+if [[ ${PV} == 9999* ]]; then
+ EGIT_REPO_URI="${SELINUX_GIT_REPO:-https://anongit.gentoo.org/git/proj/hardened-refpolicy.git}"
+ EGIT_BRANCH="${SELINUX_GIT_BRANCH:-master}"
+ EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy"
+
+ inherit git-r3
+else
+ SRC_URI="https://github.com/SELinuxProject/refpolicy/releases/download/RELEASE_${PV/./_}/refpolicy-${PV}.tar.bz2
+ https://dev.gentoo.org/~perfinion/patches/selinux-base-policy/patchbundle-selinux-base-policy-${PVR}.tar.bz2"
+
+ KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
+fi
+
+IUSE="doc +unknown-perms systemd +ubac +unconfined"
+
+DESCRIPTION="Gentoo base policy for SELinux"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux"
+LICENSE="GPL-2"
+SLOT="0"
+
+RDEPEND=">=sys-apps/policycoreutils-2.8"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ ${PYTHON_DEPS}
+ >=sys-apps/checkpolicy-2.8
+ sys-devel/m4"
+
+S=${WORKDIR}/
+
+src_prepare() {
+ if [[ ${PV} != 9999* ]]; then
+ einfo "Applying SELinux policy updates ... "
+ eapply -p0 "${WORKDIR}/0001-full-patch-against-stable-release.patch"
+ fi
+
+ eapply_user
+
+ cd "${S}/refpolicy" || die
+ emake bare
+}
+
+src_configure() {
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs"
+
+ # Update the SELinux refpolicy capabilities based on the users' USE flags.
+ if use unknown-perms; then
+ sed -i -e '/^UNK_PERMS/s/deny/allow/' "${S}/refpolicy/build.conf" \
+ || die "Failed to allow Unknown Permissions Handling"
+ sed -i -e '/^UNK_PERMS/s/deny/allow/' "${S}/refpolicy/Makefile" \
+ || die "Failed to allow Unknown Permissions Handling"
+ fi
+
+ if ! use ubac; then
+ sed -i -e '/^UBAC/s/y/n/' "${S}/refpolicy/build.conf" \
+ || die "Failed to disable User Based Access Control"
+ fi
+
+ if use systemd; then
+ sed -i -e '/^SYSTEMD/s/n/y/' "${S}/refpolicy/build.conf" \
+ || die "Failed to enable SystemD"
+ fi
+
+ echo "DISTRO = gentoo" >> "${S}/refpolicy/build.conf" || die
+
+ # Prepare initial configuration
+ cd "${S}/refpolicy" || die
+ emake conf
+
+ # Setup the policies based on the types delivered by the end user.
+ # These types can be "targeted", "strict", "mcs" and "mls".
+ for i in ${POLICY_TYPES}; do
+ cp -a "${S}/refpolicy" "${S}/${i}" || die
+ cd "${S}/${i}" || die
+
+ sed -i -e "/= module/d" "${S}/${i}/policy/modules.conf" || die
+
+ sed -i -e '/^QUIET/s/n/y/' -e "/^NAME/s/refpolicy/$i/" \
+ "${S}/${i}/build.conf" || die "build.conf setup failed."
+
+ if [[ "${i}" == "mls" ]] || [[ "${i}" == "mcs" ]];
+ then
+ # MCS/MLS require additional settings
+ sed -i -e "/^TYPE/s/standard/${i}/" "${S}/${i}/build.conf" \
+ || die "failed to set type to mls"
+ fi
+
+ if [ "${i}" == "targeted" ]; then
+ sed -i -e '/root/d' -e 's/user_u/unconfined_u/' \
+ "${S}/${i}/config/appconfig-standard/seusers" \
+ || die "targeted seusers setup failed."
+ fi
+
+ if [ "${i}" != "targeted" ] && [ "${i}" != "strict" ] && use unconfined; then
+ sed -i -e '/root/d' -e 's/user_u/unconfined_u/' \
+ "${S}/${i}/config/appconfig-${i}/seusers" \
+ || die "policy seusers setup failed."
+ fi
+ done
+}
+
+src_compile() {
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs"
+
+ for i in ${POLICY_TYPES}; do
+ cd "${S}/${i}" || die
+ emake base
+ if use doc; then
+ emake html
+ fi
+ done
+}
+
+src_install() {
+ [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="targeted strict mls mcs"
+
+ for i in ${POLICY_TYPES}; do
+ cd "${S}/${i}" || die
+
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install-headers
+
+ echo "run_init_t" > "${D}/etc/selinux/${i}/contexts/run_init_type" || die
+
+ echo "textrel_shlib_t" >> "${D}/etc/selinux/${i}/contexts/customizable_types" || die
+
+ # libsemanage won't make this on its own
+ keepdir "/etc/selinux/${i}/policy"
+
+ if use doc; then
+ docinto ${i}/html
+ dodoc -r doc/html/*;
+ fi
+
+ insinto /usr/share/selinux/devel;
+ doins doc/policy.xml;
+
+ done
+
+ docinto /
+ dodoc doc/Makefile.example doc/example.{te,fc,if}
+
+ doman man/man8/*.8;
+
+ insinto /etc/selinux
+ doins "${FILESDIR}/config"
+
+ insinto /usr/share/portage/config/sets
+ doins "${FILESDIR}/selinux.conf"
+}