mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-15 00:46:58 +02:00
sec-policy/selinux-base: Sync with Gentoo
It's from Gentoo commit 93eb44523dd73a13e45dd9095692783d236f1c78.
This commit is contained in:
parent
2496a85859
commit
f9d5031a1e
@ -1,3 +1,5 @@
|
|||||||
DIST patchbundle-selinux-base-policy-2.20240226-r1.tar.bz2 430565 BLAKE2B 2d552f868375c240e71e987542a3026970f1d375d7d1e65f11386ce1b07aae84911ded2379fc768ff4bff664eb98dc3361a7392467fed3feb4916477eb957f58 SHA512 f22245ad8759d88ddbf26b71443e4ba8c804fc80d69383120ed98b7887d08a7034b8125e4d15e695b26776ef4ac1a933e14a1a382d5be90aa942358842cc6c77
|
DIST patchbundle-selinux-base-policy-2.20240226-r1.tar.bz2 430565 BLAKE2B 2d552f868375c240e71e987542a3026970f1d375d7d1e65f11386ce1b07aae84911ded2379fc768ff4bff664eb98dc3361a7392467fed3feb4916477eb957f58 SHA512 f22245ad8759d88ddbf26b71443e4ba8c804fc80d69383120ed98b7887d08a7034b8125e4d15e695b26776ef4ac1a933e14a1a382d5be90aa942358842cc6c77
|
||||||
DIST patchbundle-selinux-base-policy-2.20240226-r2.tar.bz2 442650 BLAKE2B f2f7c5e4a595afafc072fd78fc4ef3930cf739d05cbe9670f2fb2956fe84e3045518345e103bc3880603d2562f06ba0597fc005d8d394e9f8cd057363f9bf95f SHA512 2cb00d088eebdb098a6496f156eeb3dcee026fc6e53d732bac5bc8a4cfee1ce3bf2bdbbbfbbe9bba237d61c06f299d96bb9d123a57a44aaaa17cc122e15ea268
|
DIST patchbundle-selinux-base-policy-2.20240226-r2.tar.bz2 442650 BLAKE2B f2f7c5e4a595afafc072fd78fc4ef3930cf739d05cbe9670f2fb2956fe84e3045518345e103bc3880603d2562f06ba0597fc005d8d394e9f8cd057363f9bf95f SHA512 2cb00d088eebdb098a6496f156eeb3dcee026fc6e53d732bac5bc8a4cfee1ce3bf2bdbbbfbbe9bba237d61c06f299d96bb9d123a57a44aaaa17cc122e15ea268
|
||||||
|
DIST patchbundle-selinux-base-policy-2.20240916-r1.tar.bz2 274891 BLAKE2B 72b8181424450998164979ab582e8edee6d73b9110b4535e7880d1f7c989bd0ac391422872858da7bad3e3d77516996af93aa2f149f7d4a7f8fd329c481964cf SHA512 fd8259c91cc779301d6e0964827133529a9141dc235301da135210ea4359b800023848a25e33c45678477fa4f54e75da51be9ec85a3bed8b07cf5487e73b84f3
|
||||||
DIST refpolicy-2.20240226.tar.bz2 610561 BLAKE2B 5dc54dcf7238776d4e4b282c1dcbc499f45c0d96676dbf931da39592854034874b5dd6197a2e2776fccec5106d5f245eea3fb9419959bd4d61e9b2c12aeaaa85 SHA512 896a57afb024bd131f25d2831a9a5ac90ee7e5d76b0565bc818c156f6c310d86758bcd4cedbd9df5b29954c9a92a42300d16685a7e07a5efd8f789320724b3f9
|
DIST refpolicy-2.20240226.tar.bz2 610561 BLAKE2B 5dc54dcf7238776d4e4b282c1dcbc499f45c0d96676dbf931da39592854034874b5dd6197a2e2776fccec5106d5f245eea3fb9419959bd4d61e9b2c12aeaaa85 SHA512 896a57afb024bd131f25d2831a9a5ac90ee7e5d76b0565bc818c156f6c310d86758bcd4cedbd9df5b29954c9a92a42300d16685a7e07a5efd8f789320724b3f9
|
||||||
|
DIST refpolicy-2.20240916.tar.bz2 618218 BLAKE2B d86ca75d254eef10f4aa57ef3977825211200cdf1eaa9bf9d416c9a52acee476b3f8719c3b0c8c17fdff2abc0c396989961e37e313a7b3bd3b4b0266a6280e75 SHA512 a8b6c90f8e186796b4c7db1e2d8ed3c3b8690bb5b8f180dcb6d5468ba80467e2969012c4edddf74429c0f5ce900d68fbbc0c2f8e253165af28f93f191039f064
|
||||||
|
@ -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_{10..12} )
|
||||||
|
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 ~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"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user