forked from pool/selinux-policy
f7ff503048
- Add policycoreutils-devel as BuildRequires OBS-URL: https://build.opensuse.org/request/show/823545 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/selinux-policy?expand=0&rev=78
667 lines
23 KiB
RPMSpec
667 lines
23 KiB
RPMSpec
#
|
|
# spec file for package selinux-policy
|
|
#
|
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
|
%if ! %{defined _fillupdir}
|
|
%define _fillupdir /var/adm/fillup-templates
|
|
%endif
|
|
|
|
# TODO: This turns on distro-specific policies.
|
|
# There are almost no SUSE specific modifications available in the policy, so we utilize the
|
|
# ones used by redhat and include also the SUSE specific ones (see sed statement below)
|
|
%define distro redhat
|
|
%define ubac n
|
|
%define polyinstatiate n
|
|
%define monolithic n
|
|
%define BUILD_DOC 1
|
|
%define BUILD_TARGETED 1
|
|
%define BUILD_MINIMUM 1
|
|
%define BUILD_MLS 1
|
|
|
|
%define POLICYCOREUTILSVER %(rpm -q --qf %%{version} policycoreutils)
|
|
%define CHECKPOLICYVER %POLICYCOREUTILSVER
|
|
|
|
%define coreutils_ge() %{lua: if (rpm.vercmp(rpm.expand("%POLICYCOREUTILSVER"), rpm.expand("%1")) >= 0) then print "1" else print "0" end }
|
|
|
|
# macros calling module_store have to be defined using global, not define, and
|
|
# "lazy" evaluation
|
|
%global module_store() %{_localstatedir}/lib/selinux/%%{1}
|
|
%global policy_prio 100
|
|
%global module_dir active/modules/%{policy_prio}
|
|
%global module_disabled() %{module_store %%{1}}/active/modules/disabled/%%{2}
|
|
|
|
%global install_pp() \
|
|
(cd %{buildroot}/%{_usr}/share/selinux/%1/ \
|
|
/usr/sbin/semodule -s %%{1} -X %{policy_prio} -n -p %{buildroot} -i *.pp \
|
|
rm -f *pp*);
|
|
|
|
# FixMe 170315: None of these exist any more. Are they necessary?
|
|
%global files_base_pp() %nil
|
|
%global touch_file_contexts() touch %{buildroot}%{_sysconfdir}/selinux/%1/contexts/files/file_contexts.local
|
|
%global files_file_contexts() %nil
|
|
%global mkdir_other() \
|
|
%{__mkdir} -p %{buildroot}%{module_store %%1}/active/modules/disabled
|
|
%global files_other() \
|
|
%dir %{module_store %%1}/active/modules \
|
|
%dir %{module_store %%1}/active/modules/disabled \
|
|
%{module_disabled %%1 sandbox}
|
|
%global files_dot_bin() %nil
|
|
|
|
Summary: SELinux policy configuration
|
|
License: GPL-2.0-or-later
|
|
Group: System/Management
|
|
Name: selinux-policy
|
|
Version: 20200717
|
|
Release: 0
|
|
Source: fedora-policy.%{version}.tar.bz2
|
|
|
|
Source10: modules-targeted-base.conf
|
|
Source11: modules-targeted-contrib.conf
|
|
Source12: modules-mls-base.conf
|
|
Source13: modules-mls-contrib.conf
|
|
Source14: modules-minimum-base.conf
|
|
Source15: modules-minimum-contrib.conf
|
|
Source18: modules-minimum-disable.lst
|
|
|
|
Source20: booleans-targeted.conf
|
|
Source21: booleans-mls.conf
|
|
Source22: booleans-minimum.conf
|
|
|
|
Source30: setrans-targeted.conf
|
|
Source31: setrans-mls.conf
|
|
Source32: setrans-minimum.conf
|
|
|
|
Source40: securetty_types-targeted
|
|
Source41: securetty_types-mls
|
|
Source42: securetty_types-minimum
|
|
|
|
Source50: users-targeted
|
|
Source51: users-mls
|
|
Source52: users-minimum
|
|
|
|
Source60: selinux-policy.conf
|
|
Source61: selinux-policy.sysconfig
|
|
|
|
Source90: selinux-policy-rpmlintrc
|
|
Source91: Makefile.devel
|
|
Source92: customizable_types
|
|
#Source93: config.tgz
|
|
Source94: file_contexts.subs_dist
|
|
|
|
Source120: packagekit.te
|
|
Source121: packagekit.if
|
|
Source122: packagekit.fc
|
|
Source123: rtorrent.te
|
|
Source124: rtorrent.if
|
|
Source125: rtorrent.fc
|
|
Source126: wicked.te
|
|
Source127: wicked.if
|
|
Source128: wicked.fc
|
|
|
|
Patch001: fix_djbdns.patch
|
|
Patch002: fix_dbus.patch
|
|
Patch003: fix_gift.patch
|
|
Patch004: fix_java.patch
|
|
Patch005: fix_hadoop.patch
|
|
Patch006: fix_thunderbird.patch
|
|
Patch007: fix_postfix.patch
|
|
Patch008: fix_nscd.patch
|
|
Patch009: fix_sysnetwork.patch
|
|
Patch010: fix_logging.patch
|
|
Patch011: fix_xserver.patch
|
|
Patch012: fix_miscfiles.patch
|
|
Patch013: fix_init.patch
|
|
Patch014: fix_locallogin.patch
|
|
Patch015: fix_policykit.patch
|
|
Patch016: fix_iptables.patch
|
|
Patch017: fix_irqbalance.patch
|
|
Patch018: fix_ntp.patch
|
|
Patch019: fix_fwupd.patch
|
|
Patch020: fix_firewalld.patch
|
|
Patch021: fix_logrotate.patch
|
|
Patch022: fix_selinuxutil.patch
|
|
Patch024: fix_corecommand.patch
|
|
Patch025: fix_snapper.patch
|
|
Patch026: fix_systemd.patch
|
|
Patch027: fix_unconfined.patch
|
|
Patch028: fix_unconfineduser.patch
|
|
Patch029: fix_chronyd.patch
|
|
Patch030: fix_networkmanager.patch
|
|
Patch032: fix_accountsd.patch
|
|
Patch033: fix_automount.patch
|
|
Patch034: fix_colord.patch
|
|
Patch035: fix_mcelog.patch
|
|
Patch036: fix_sslh.patch
|
|
Patch037: fix_nagios.patch
|
|
Patch038: fix_openvpn.patch
|
|
Patch039: fix_cron.patch
|
|
Patch040: fix_usermanage.patch
|
|
Patch041: fix_smartmon.patch
|
|
Patch042: fix_geoclue.patch
|
|
Patch043: suse_specific.patch
|
|
Patch044: fix_authlogin.patch
|
|
Patch045: fix_screen.patch
|
|
Patch046: fix_unprivuser.patch
|
|
Patch047: fix_rpm.patch
|
|
Patch048: fix_apache.patch
|
|
Patch049: fix_nis.patch
|
|
|
|
Patch100: sedoctool.patch
|
|
|
|
Url: https://github.com/fedora-selinux/selinux-policy.git
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
BuildArch: noarch
|
|
BuildRequires: %fillup_prereq
|
|
BuildRequires: %insserv_prereq
|
|
BuildRequires: bzip2
|
|
BuildRequires: checkpolicy
|
|
BuildRequires: gawk
|
|
BuildRequires: libxml2-tools
|
|
BuildRequires: m4
|
|
BuildRequires: policycoreutils
|
|
BuildRequires: python3-policycoreutils
|
|
BuildRequires: policycoreutils-devel
|
|
BuildRequires: python
|
|
BuildRequires: python-xml
|
|
#BuildRequires: selinux-policy-devel
|
|
# we need selinuxenabled
|
|
Requires(pre): policycoreutils >= %{POLICYCOREUTILSVER}
|
|
Requires(pre): pam-config
|
|
Requires(post): pam-config
|
|
Requires(post): selinux-tools
|
|
Requires(post): /bin/awk /usr/bin/sha512sum
|
|
Recommends: audit
|
|
Recommends: selinux-tools
|
|
# for audit2allow
|
|
Recommends: python3-policycoreutils
|
|
Recommends: policycoreutils-python-utils
|
|
|
|
%global makeConfig() \
|
|
make %{?_smp_mflags} UNK_PERMS=%4 NAME=%1 TYPE=%2 DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} MLS_CATS=1024 MCS_CATS=1024 bare \
|
|
make %{?_smp_mflags} UNK_PERMS=%4 NAME=%1 TYPE=%2 DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} MLS_CATS=1024 MCS_CATS=1024 conf \
|
|
cp -f selinux_config/booleans-%1.conf ./policy/booleans.conf \
|
|
cp -f selinux_config/users-%1 ./policy/users \
|
|
cp -f selinux_config/modules-%1-base.conf ./policy/modules-base.conf \
|
|
cp -f selinux_config/modules-%1-base.conf ./policy/modules.conf \
|
|
if [ "%5" = "contrib" ];then \
|
|
cp selinux_config/modules-%1-%5.conf ./policy/modules-contrib.conf; \
|
|
cat selinux_config/modules-%1-%5.conf >> ./policy/modules.conf; \
|
|
fi; \
|
|
|
|
%global installCmds() \
|
|
make %{?_smp_mflags} UNK_PERMS=%4 NAME=%1 TYPE=%2 DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} MLS_CATS=1024 MCS_CATS=1024 base.pp \
|
|
make %{?_smp_mflags} validate UNK_PERMS=%4 NAME=%1 TYPE=%2 DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} MLS_CATS=1024 MCS_CATS=1024 modules \
|
|
make %{?_smp_mflags} UNK_PERMS=%4 NAME=%1 TYPE=%2 DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} DESTDIR=%{buildroot} MLS_CATS=1024 MCS_CATS=1024 install \
|
|
mkdir -p %{buildroot}/var/lib/selinux/%1 \
|
|
/usr/sbin/semodule -s %%1 -n -B -p %{buildroot}; \
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/selinux/%1/logins \
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/selinux/%1/policy \
|
|
%{__mkdir} -p %{buildroot}/%{module_store %%{1}}/%{module_dir} \
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/selinux/%1/contexts/files \
|
|
%{mkdir_other %%1} \
|
|
touch %{buildroot}/%{module_store %%{1}}/semanage.read.LOCK \
|
|
touch %{buildroot}/%{module_store %%{1}}/semanage.trans.LOCK \
|
|
rm -rf %{buildroot}%{_sysconfdir}/selinux/%1/booleans \
|
|
touch %{buildroot}%{_sysconfdir}/selinux/%1/contexts/files/file_contexts.subs \
|
|
%{touch_file_contexts %%1} \
|
|
install -m0644 selinux_config/securetty_types-%1 %{buildroot}%{_sysconfdir}/selinux/%1/contexts/securetty_types \
|
|
install -m0644 selinux_config/file_contexts.subs_dist %{buildroot}%{_sysconfdir}/selinux/%1/contexts/files \
|
|
install -m0644 selinux_config/setrans-%1.conf %{buildroot}%{_sysconfdir}/selinux/%1/setrans.conf \
|
|
install -m0644 selinux_config/customizable_types %{buildroot}%{_sysconfdir}/selinux/%1/contexts/customizable_types \
|
|
touch %{buildroot}%{module_store %%{1}}/active/seusers \
|
|
touch %{buildroot}%{module_store %%{1}}/active/nodes.local \
|
|
touch %{buildroot}%{module_store %%{1}}/active/users_extra.local \
|
|
touch %{buildroot}%{module_store %%{1}}/active/users.local \
|
|
%install_pp %%1 \
|
|
touch %{buildroot}%{module_disabled %%1 sandbox} \
|
|
/usr/bin/sha512sum %{buildroot}%{_sysconfdir}/selinux/%1/policy/policy.* | cut -d' ' -f 1 > %{buildroot}%{_sysconfdir}/selinux/%1/.policy.sha512; \
|
|
rm -rf %{buildroot}%{_sysconfdir}/selinux/%1/contexts/netfilter_contexts \
|
|
%nil
|
|
|
|
%global fileList() \
|
|
%defattr(-,root,root) \
|
|
%dir %{_usr}/share/selinux/%1 \
|
|
%{_usr}/share/selinux/%1/* \
|
|
%dir %{_sysconfdir}/selinux/%1 \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/setrans.conf \
|
|
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/selinux/%1/seusers \
|
|
%dir %{_sysconfdir}/selinux/%1/logins \
|
|
%dir %{module_store %%{1}} \
|
|
%verify(not md5 size mtime) %{module_store %%{1}}/semanage.read.LOCK \
|
|
%verify(not md5 size mtime) %{module_store %%{1}}/semanage.trans.LOCK \
|
|
%dir %attr(700,root,root) %dir %{module_store %%{1}}/active \
|
|
%dir %{module_store %%{1}}/%{module_dir} \
|
|
%verify(not md5 size mtime) %{module_store %%{1}}/active/policy.kern \
|
|
%verify(not md5 size mtime) %{module_store %%{1}}/active/commit_num \
|
|
%{files_base_pp %%1} \
|
|
%verify(not md5 size mtime) %{module_store %%{1}}/active/file_contexts \
|
|
%{files_file_contexts %%1} \
|
|
%{files_other %%1} \
|
|
%config(noreplace) %verify(not md5 size mtime) %{module_store %%{1}}/active/users_extra \
|
|
%verify(not md5 size mtime) %{module_store %%{1}}/active/homedir_template \
|
|
%{module_store %%{1}}/%{module_dir}/* \
|
|
%ghost %{module_store %%{1}}/active/*.local \
|
|
%{module_store %%{1}}/active/*.linked \
|
|
%{module_store %%{1}}/active/*.homedirs \
|
|
%{files_dot_bin %%1} \
|
|
%ghost %{module_store %%{1}}/active/seusers \
|
|
%dir %{_sysconfdir}/selinux/%1/policy/ \
|
|
%verify(not md5 size mtime) %{_sysconfdir}/selinux/%1/policy/policy.* \
|
|
%{_sysconfdir}/selinux/%1/.policy.sha512 \
|
|
%dir %{_sysconfdir}/selinux/%1/contexts \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/securetty_types \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/dbus_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/x_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/default_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/virtual_domain_context \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/virtual_image_context \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/lxc_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/sepgsql_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/openssh_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/snapperd_contexts \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/systemd_contexts \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/default_type \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/failsafe_context \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/initrc_context \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/removable_context \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/userhelper_context \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/customizable_types \
|
|
%dir %{_sysconfdir}/selinux/%1/contexts/files \
|
|
%verify(not md5 size mtime) %{_sysconfdir}/selinux/%1/contexts/files/file_contexts \
|
|
%verify(not md5 size mtime) %{_sysconfdir}/selinux/%1/contexts/files/file_contexts.homedirs \
|
|
%ghost %{_sysconfdir}/selinux/%1/contexts/files/*.bin \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/files/file_contexts.local \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/files/file_contexts.subs \
|
|
%{_sysconfdir}/selinux/%1/contexts/files/file_contexts.subs_dist \
|
|
%config %{_sysconfdir}/selinux/%1/contexts/files/media \
|
|
%dir %{_sysconfdir}/selinux/%1/contexts/users \
|
|
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/users/*
|
|
|
|
%define relabel() \
|
|
. %{_sysconfdir}/selinux/config; \
|
|
FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
|
|
if selinuxenabled; then \
|
|
if [ $? = 0 -a "${SELINUXTYPE}" = %1 -a -f ${FILE_CONTEXT}.pre ]; then \
|
|
/sbin/fixfiles -C ${FILE_CONTEXT}.pre restore 2> /dev/null; \
|
|
rm -f ${FILE_CONTEXT}.pre; \
|
|
fi; \
|
|
/sbin/restorecon -e /run/media -R /root /var/log /var/run %{_sysconfdir}/passwd* %{_sysconfdir}/group* %{_sysconfdir}/*shadow* 2> /dev/null; \
|
|
/sbin/restorecon -R /home/*/.cache /home/*/.config 2> /dev/null || true; \
|
|
fi;
|
|
|
|
%global preInstall() \
|
|
if [ $1 -ne 1 ] && [ -s %{_sysconfdir}/selinux/config ]; then \
|
|
. %{_sysconfdir}/selinux/config; \
|
|
FILE_CONTEXT=%{_sysconfdir}/selinux/%%1/contexts/files/file_contexts; \
|
|
if [ "${SELINUXTYPE}" = %%1 -a -f ${FILE_CONTEXT} ]; then \
|
|
[ -f ${FILE_CONTEXT}.pre ] || cp -f ${FILE_CONTEXT} ${FILE_CONTEXT}.pre; \
|
|
fi; \
|
|
touch %{_sysconfdir}/selinux/%%1/.rebuild; \
|
|
if [ -e %{_sysconfdir}/selinux/%%1/.policy.sha512 ]; then \
|
|
sha512=`sha512sum %{module_store %%{1}}/active/policy.kern | cut -d ' ' -f 1`; \
|
|
checksha512=`cat %{_sysconfdir}/selinux/%%1/.policy.sha512`; \
|
|
if [ "$sha512" = "$checksha512" ] ; then \
|
|
rm %{_sysconfdir}/selinux/%%1/.rebuild; \
|
|
fi; \
|
|
fi; \
|
|
fi;
|
|
|
|
%global postInstall() \
|
|
. %{_sysconfdir}/selinux/config; \
|
|
if [ -e %{_sysconfdir}/selinux/%%2/.rebuild ]; then \
|
|
rm %{_sysconfdir}/selinux/%%2/.rebuild; \
|
|
/usr/sbin/semodule -B -n -s %%2; \
|
|
else \
|
|
touch %{module_disabled %%2 sandbox} \
|
|
fi; \
|
|
if [ "${SELINUXTYPE}" = "%2" ]; then \
|
|
if selinuxenabled; then \
|
|
load_policy; \
|
|
else \
|
|
# probably a first install of the policy \
|
|
true; \
|
|
fi; \
|
|
fi; \
|
|
if selinuxenabled; then \
|
|
if [ %1 -eq 1 ]; then \
|
|
/sbin/restorecon -R /root /var/log /var/run 2> /dev/null; \
|
|
else \
|
|
%relabel %2 \
|
|
fi; \
|
|
else \
|
|
# run fixfiles on next boot \
|
|
touch /.autorelabel \
|
|
fi;
|
|
|
|
%define modulesList() \
|
|
awk '$1 !~ "/^#/" && $2 == "=" && $3 == "module" { printf "%%s ", $1 }' ./policy/modules-base.conf > %{buildroot}/%{_usr}/share/selinux/%1/modules-base.lst \
|
|
if [ -e ./policy/modules-contrib.conf ];then \
|
|
awk '$1 !~ "/^#/" && $2 == "=" && $3 == "module" { printf "%%s ", $1 }' ./policy/modules-contrib.conf > %{buildroot}/%{_usr}/share/selinux/%1/modules-contrib.lst; \
|
|
fi;
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%doc COPYING
|
|
%dir %{_usr}/share/selinux
|
|
%dir %{_sysconfdir}/selinux
|
|
%ghost %config(noreplace) %{_sysconfdir}/selinux/config
|
|
%{_fillupdir}/sysconfig.%{name}
|
|
%{_usr}/lib/tmpfiles.d/selinux-policy.conf
|
|
|
|
%description
|
|
SELinux Reference Policy. A complete SELinux policy that can be used as the system policy for a variety of
|
|
systems and used as the basis for creating other policies.
|
|
|
|
%prep
|
|
%setup -n fedora-policy
|
|
%patch001 -p1
|
|
%patch002 -p1
|
|
%patch003 -p1
|
|
%patch004 -p1
|
|
%patch005 -p1
|
|
%patch006 -p1
|
|
%patch007 -p1
|
|
%patch008 -p1
|
|
%patch009 -p1
|
|
%patch010 -p1
|
|
%patch011 -p1
|
|
%patch012 -p1
|
|
%patch013 -p1
|
|
%patch014 -p1
|
|
%patch015 -p1
|
|
%patch016 -p1
|
|
%patch017 -p1
|
|
%patch018 -p1
|
|
%patch019 -p1
|
|
%patch020 -p1
|
|
%patch021 -p1
|
|
%patch022 -p1
|
|
%patch024 -p1
|
|
%patch025 -p1
|
|
%patch026 -p1
|
|
%patch027 -p1
|
|
%patch028 -p1
|
|
%patch029 -p1
|
|
%patch030 -p1
|
|
#% patch031 -p1
|
|
%patch032 -p1
|
|
%patch033 -p1
|
|
%patch034 -p1
|
|
%patch035 -p1
|
|
%patch036 -p1
|
|
%patch037 -p1
|
|
%patch038 -p1
|
|
%patch039 -p1
|
|
%patch040 -p1
|
|
%patch041 -p1
|
|
%patch042 -p1
|
|
%patch043 -p1
|
|
%patch044 -p1
|
|
%patch045 -p1
|
|
%patch046 -p1
|
|
%patch047 -p1
|
|
%patch048 -p1
|
|
%patch049 -p1
|
|
|
|
%patch100 -p1
|
|
find . -type f -exec sed -i -e "s/distro_suse/distro_redhat/" \{\} \;
|
|
|
|
%build
|
|
|
|
%install
|
|
mkdir selinux_config
|
|
for i in %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} %{SOURCE20} %{SOURCE21} %{SOURCE22} %{SOURCE30} %{SOURCE31} %{SOURCE32} %{SOURCE40} %{SOURCE41} %{SOURCE42} %{SOURCE50} %{SOURCE51} %{SOURCE52} %{SOURCE91} %{SOURCE92} %{SOURCE94};do
|
|
cp $i selinux_config
|
|
done
|
|
#tar zxvf selinux_config/config.tgz
|
|
%{__rm} -fR %{buildroot}
|
|
mkdir -p %{buildroot}%{_sysconfdir}/selinux
|
|
mkdir -p %{buildroot}%{_usr}/lib/tmpfiles.d/
|
|
cp %{SOURCE60} %{buildroot}%{_usr}/lib/tmpfiles.d/
|
|
|
|
# Always create policy module package directories
|
|
mkdir -p %{buildroot}%{_usr}/share/selinux/{targeted,mls,minimum,modules}/
|
|
|
|
for i in %{SOURCE120} %{SOURCE121} %{SOURCE122} %{SOURCE123} %{SOURCE124} %{SOURCE125} %{SOURCE126} %{SOURCE127} %{SOURCE128}; do
|
|
cp $i policy/modules/contrib
|
|
done
|
|
|
|
make clean
|
|
%if %{BUILD_TARGETED}
|
|
%makeConfig targeted mcs n deny contrib
|
|
%installCmds targeted mcs n allow
|
|
%modulesList targeted
|
|
%endif
|
|
|
|
%if %{BUILD_MLS}
|
|
%makeConfig mls mls n deny contrib
|
|
%installCmds mls mls n deny
|
|
%modulesList mls
|
|
%endif
|
|
|
|
%if %{BUILD_MINIMUM}
|
|
%makeConfig minimum mcs n deny contrib
|
|
%installCmds minimum mcs n allow
|
|
install -m0644 %{SOURCE18} %{buildroot}/usr/share/selinux/minimum/modules-minimum-disable.lst \
|
|
%modulesList minimum
|
|
%endif
|
|
|
|
|
|
# Install devel
|
|
mkdir -p %{buildroot}%{_mandir}
|
|
cp -R man/* %{buildroot}%{_mandir}
|
|
make UNK_PERMS=allow NAME=targeted TYPE=mcs DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=n MONOLITHIC=%{monolithic} DESTDIR=%{buildroot} PKGNAME=%{name}-%{version} MLS_CATS=1024 MCS_CATS=1024 install-docs
|
|
make UNK_PERMS=allow NAME=targeted TYPE=mcs DISTRO=%{distro} UBAC=%{ubac} DIRECT_INITRC=n MONOLITHIC=%{monolithic} DESTDIR=%{buildroot} PKGNAME=%{name}-%{version} MLS_CATS=1024 MCS_CATS=1024 install-headers
|
|
mkdir %{buildroot}%{_usr}/share/selinux/devel/
|
|
mv %{buildroot}%{_usr}/share/selinux/targeted/include %{buildroot}%{_usr}/share/selinux/devel/include
|
|
chmod +x %{buildroot}%{_usr}/share/selinux/devel/include/support/segenxml.py
|
|
install -m 644 selinux_config/Makefile.devel %{buildroot}%{_usr}/share/selinux/devel/Makefile
|
|
install -m 644 doc/example.* %{buildroot}%{_usr}/share/selinux/devel/
|
|
install -m 644 doc/policy.* %{buildroot}%{_usr}/share/selinux/devel/
|
|
|
|
rm -rf selinux_config
|
|
# fillup sysconfig
|
|
mkdir -p %{buildroot}%{_fillupdir}
|
|
cp %{SOURCE61} %{buildroot}%{_fillupdir}/sysconfig.%{name}
|
|
|
|
%clean
|
|
|
|
%post
|
|
%{fillup_only}
|
|
if [ ! -s %{_sysconfdir}/selinux/config ]; then
|
|
# new install
|
|
ln -sf %{_sysconfdir}/sysconfig/selinux-policy %{_sysconfdir}/selinux/config
|
|
restorecon %{_sysconfdir}/selinux/config 2> /dev/null || :
|
|
else
|
|
. %{_sysconfdir}/sysconfig/selinux-policy
|
|
# if first time update booleans.local needs to be copied to sandbox
|
|
[ -f %{_sysconfdir}/selinux/${SELINUXTYPE}/booleans.local ] && mv %{_sysconfdir}/selinux/${SELINUXTYPE}/booleans.local %{module_store targeted}/active/
|
|
[ -f %{_sysconfdir}/selinux/${SELINUXTYPE}/seusers ] && cp -f %{_sysconfdir}/selinux/${SELINUXTYPE}/seusers %{module_store ${SELINUXTYPE}}/active/seusers
|
|
fi
|
|
%tmpfiles_create %_tmpfilesdir/selinux-policy.conf
|
|
if [ $1 -eq 1 ]; then
|
|
pam-config -a --selinux
|
|
fi
|
|
exit 0
|
|
|
|
%global post_un() \
|
|
# disable selinux if we uninstall a policy \
|
|
if [ $1 -eq 0 ]; then \
|
|
setenforce 0 2> /dev/null \
|
|
if [ -s %{_sysconfdir}/selinux/config ]; then \
|
|
sed -i --follow-symlinks 's/^SELINUX=.*/SELINUX=disabled/g' %{_sysconfdir}/selinux/config \
|
|
fi \
|
|
pam-config -d --selinux \
|
|
fi \
|
|
exit 0
|
|
|
|
%postun
|
|
%post_un $1
|
|
|
|
%package devel
|
|
Summary: SELinux policy devel
|
|
Group: System/Management
|
|
Requires(pre): selinux-policy = %{version}-%{release}
|
|
Requires: /usr/bin/make
|
|
Requires: checkpolicy >= %{CHECKPOLICYVER}
|
|
Requires: m4
|
|
|
|
%description devel
|
|
SELinux policy development and man page package
|
|
|
|
%files devel
|
|
%defattr(-,root,root,-)
|
|
%doc /usr/share/man/ru/man8/*
|
|
%dir %{_usr}/share/selinux/devel
|
|
%dir %{_usr}/share/selinux/devel/include
|
|
%{_usr}/share/selinux/devel/include/*
|
|
%{_usr}/share/selinux/devel/Makefile
|
|
%{_usr}/share/selinux/devel/example.*
|
|
|
|
%package doc
|
|
Summary: SELinux policy documentation
|
|
Group: System/Management
|
|
Requires(pre): selinux-policy = %{version}-%{release}
|
|
Requires: /usr/bin/xdg-open
|
|
|
|
%description doc
|
|
SELinux policy documentation package
|
|
|
|
%files doc
|
|
%defattr(-,root,root,-)
|
|
%doc %{_usr}/share/doc/%{name}-%{version}
|
|
%{_usr}/share/selinux/devel/policy.*
|
|
|
|
%if %{BUILD_TARGETED}
|
|
%package targeted
|
|
Summary: SELinux targeted base policy
|
|
Group: System/Management
|
|
Provides: selinux-policy-base = %{version}-%{release}
|
|
Requires(pre): policycoreutils >= %{POLICYCOREUTILSVER}
|
|
Requires(pre): coreutils
|
|
Requires(pre): selinux-policy = %{version}-%{release}
|
|
Requires: selinux-policy = %{version}-%{release}
|
|
|
|
%description targeted
|
|
SELinux Reference policy targeted base module.
|
|
|
|
%pre targeted
|
|
%preInstall targeted
|
|
|
|
%post targeted
|
|
%postInstall $1 targeted
|
|
exit 0
|
|
|
|
%files targeted
|
|
%defattr(-,root,root,-)
|
|
%fileList targeted
|
|
|
|
%postun targeted
|
|
%post_un $1
|
|
%endif
|
|
|
|
%if %{BUILD_MINIMUM}
|
|
%package minimum
|
|
Summary: SELinux minimum base policy
|
|
Group: System/Management
|
|
Provides: selinux-policy-base = %{version}-%{release}
|
|
Requires(post): python3-policycoreutils >= %{POLICYCOREUTILSVER}
|
|
Requires(pre): coreutils
|
|
Requires(pre): selinux-policy = %{version}-%{release}
|
|
Requires: selinux-policy = %{version}-%{release}
|
|
Conflicts: seedit
|
|
|
|
%description minimum
|
|
SELinux Reference policy minimum base module.
|
|
|
|
%pre minimum
|
|
%preInstall minimum
|
|
if [ $1 -ne 1 ]; then
|
|
/usr/sbin/semodule -s minimum -l 2>/dev/null | awk '{ if ($3 != "Disabled") print $1; }' > /usr/share/selinux/minimum/instmodules.lst
|
|
fi
|
|
|
|
%post minimum
|
|
contribpackages=`cat /usr/share/selinux/minimum/modules-contrib.lst`
|
|
basepackages=`cat /usr/share/selinux/minimum/modules-base.lst`
|
|
mkdir -p /var/lib/selinux/minimum/active/modules/disabled 2>/dev/null
|
|
if [ $1 -eq 1 ]; then
|
|
for p in $contribpackages; do
|
|
touch /var/lib/selinux/minimum/active/modules/disabled/$p
|
|
done
|
|
for p in $basepackages snapper dbus kerberos nscd rpm rtkit; do
|
|
rm -f /var/lib/selinux/minimum/active/modules/disabled/$p
|
|
done
|
|
/usr/sbin/semanage import -S minimum -f - << __eof
|
|
login -m -s unconfined_u -r s0-s0:c0.c1023 __default__
|
|
login -m -s unconfined_u -r s0-s0:c0.c1023 root
|
|
__eof
|
|
/sbin/restorecon -R /root /var/log /var/run 2> /dev/null
|
|
/usr/sbin/semodule -B -s minimum
|
|
else
|
|
instpackages=`cat /usr/share/selinux/minimum/instmodules.lst`
|
|
for p in $contribpackages; do
|
|
touch /var/lib/selinux/minimum/active/modules/disabled/$p
|
|
done
|
|
for p in $instpackages snapper dbus kerberos nscd rtkit; do
|
|
rm -f /var/lib/selinux/minimum/active/modules/disabled/$p
|
|
done
|
|
/usr/sbin/semodule -B -s minimum
|
|
%relabel minimum
|
|
fi
|
|
exit 0
|
|
|
|
%files minimum
|
|
%defattr(-,root,root,-)
|
|
%fileList minimum
|
|
|
|
%postun minimum
|
|
%post_un $1
|
|
%endif
|
|
|
|
%if %{BUILD_MLS}
|
|
%package mls
|
|
Summary: SELinux mls base policy
|
|
Group: System/Management
|
|
Provides: selinux-policy-base = %{version}-%{release}
|
|
Requires: policycoreutils-newrole >= %{POLICYCOREUTILSVER}
|
|
Requires: setransd
|
|
Requires(pre): policycoreutils >= %{POLICYCOREUTILSVER}
|
|
Requires(pre): coreutils
|
|
Requires(pre): selinux-policy = %{version}-%{release}
|
|
Requires: selinux-policy = %{version}-%{release}
|
|
Conflicts: seedit
|
|
|
|
%description mls
|
|
SELinux Reference policy mls base module.
|
|
|
|
%pre mls
|
|
%preInstall mls
|
|
|
|
%post mls
|
|
%postInstall $1 mls
|
|
|
|
%files mls
|
|
%defattr(-,root,root,-)
|
|
%fileList mls
|
|
|
|
%postun mls
|
|
%post_un $1
|
|
%endif
|
|
|
|
%changelog
|