mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-17 02:11:06 +02:00
sec-policy/selinux-base: Sync with Gentoo
It's from Gentoo commit 4d7080a9766d886cd15cdf4fa75890677c6266b1. Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
parent
225933e949
commit
78f021a957
@ -1,6 +1,4 @@
|
||||
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 patchbundle-selinux-base-policy-2.20250213-r1.tar.bz2 276621 BLAKE2B 5a4b0c5fe017fd6c59c3f5d3a1af97e31485bd4325b10a2769883091e5ea6fd205ad42f346c06e6d443aeed9e46bf962febc177f58241c4633058918db6b7fb6 SHA512 1098cfb396d56dfc4f0c2b3ff90dcb9de3bf0b081f1d0c21d793fccc78e48d35a93883bb7fd54a0acd5fa2b06edc8965cbfe72e2b8f3ea325bbee18a8c8e7163
|
||||
DIST refpolicy-2.20240226.tar.bz2 610561 BLAKE2B 5dc54dcf7238776d4e4b282c1dcbc499f45c0d96676dbf931da39592854034874b5dd6197a2e2776fccec5106d5f245eea3fb9419959bd4d61e9b2c12aeaaa85 SHA512 896a57afb024bd131f25d2831a9a5ac90ee7e5d76b0565bc818c156f6c310d86758bcd4cedbd9df5b29954c9a92a42300d16685a7e07a5efd8f789320724b3f9
|
||||
DIST refpolicy-2.20240916.tar.bz2 618218 BLAKE2B d86ca75d254eef10f4aa57ef3977825211200cdf1eaa9bf9d416c9a52acee476b3f8719c3b0c8c17fdff2abc0c396989961e37e313a7b3bd3b4b0266a6280e75 SHA512 a8b6c90f8e186796b4c7db1e2d8ed3c3b8690bb5b8f180dcb6d5468ba80467e2969012c4edddf74429c0f5ce900d68fbbc0c2f8e253165af28f93f191039f064
|
||||
DIST patchbundle-selinux-base-policy-2.20250618-r1.tar.bz2 306720 BLAKE2B b90de06fd143293d67f244013b9a6d775864e7fdfa54c3b5852e31c7594338dfb927b1ef105f4dd688e68932d1d20f91ad7d5cfb909a93f962a427a0a8708c0c SHA512 124424dc8c8eb0f82735d30b000568a8c4c9969363d55cf4f15a5b82a2ca7619e93e5f908cafa9f1a2c4d35d2dcf76869cac85cff909e3fccf47c8666ec15616
|
||||
DIST refpolicy-2.20250213.tar.bz2 627837 BLAKE2B 64d64549bf1fcfc33107e8f4c842af4e3279a856c3a140d05749bae687ffadfe25e4b7383bef3618b13bbd553046d162fcd48b713500d3fd59073b5bece91008 SHA512 cbaf65dfe6d7cc886674bb37160170dac060265d5cf241bfac0c0e5ef45744f057107d81c933f01411c5cd538c95755b7a92331197e2b97b995efc4d6f266895
|
||||
DIST refpolicy-2.20250618.tar.bz2 632711 BLAKE2B f522c16552fbbf66d4549bf082ece4be740018822b9b7da318c12aa3f3108a905b5f71fc6bb5e894468126123d81aa4e309912ec04c2a2e27feda00689a5ecd8 SHA512 3bfd32be63d0928c5be47707ce6d53bc3bb7b3d922fda2441d455b913eb79d33b16ba31320394aa1d9ec7afb6d9c853c3cd4c025962c6f355dbb7194bdb1c1a8
|
||||
|
@ -1,158 +0,0 @@
|
||||
# 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 ~riscv 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"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
@ -17,7 +17,7 @@ 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 ~riscv x86"
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
|
||||
fi
|
||||
|
||||
IUSE="doc +unknown-perms systemd +ubac +unconfined"
|
Loading…
x
Reference in New Issue
Block a user