forked from pool/selinux-targeted-setup
Accepting request 856711 from devel:kubic
Add selinux-targeted-setup package OBS-URL: https://build.opensuse.org/request/show/856711 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/selinux-targeted-setup?expand=0&rev=1
This commit is contained in:
commit
c98b95cc81
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
5
selinux-targeted-setup.changes
Normal file
5
selinux-targeted-setup.changes
Normal file
@ -0,0 +1,5 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 15 16:29:04 UTC 2020 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
||||
|
||||
- Initial release
|
||||
|
89
selinux-targeted-setup.spec
Normal file
89
selinux-targeted-setup.spec
Normal file
@ -0,0 +1,89 @@
|
||||
#
|
||||
# spec file for package selinux-targeted-setup
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
#
|
||||
# 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 https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
Name: selinux-targeted-setup
|
||||
Version: 20201215
|
||||
Release: 0
|
||||
Summary: Install, configure and enable targeted SELinux policy
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Management
|
||||
BuildArch: noarch
|
||||
BuildRequires: update-bootloader-rpm-macros
|
||||
Requires: selinux-policy-targeted
|
||||
Requires(post): selinux-policy-targeted
|
||||
Recommends: container-selinux
|
||||
%{update_bootloader_requires}
|
||||
|
||||
%description
|
||||
Install, configure and enable targeted SELinux policy
|
||||
|
||||
%prep
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
|
||||
%post
|
||||
GRUB_CFG=/etc/default/grub
|
||||
SELINUX_CFG=/etc/selinux/config
|
||||
LABEL_CFG1=/.autorelabel
|
||||
LABEL_CFG2=/etc/selinux/.autorelabel
|
||||
|
||||
if [[ -f $GRUB_CFG ]]; then
|
||||
if [[ ! $(grep "^GRUB_CMDLINE_LINUX_DEFAULT=" $GRUB_CFG | grep security=selinux) ]]; then
|
||||
sed -i -e 's|\(^GRUB_CMDLINE_LINUX_DEFAULT=.*\)"|\1 security=selinux selinux=1"|g' $GRUB_CFG
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f $SELINUX_CFG ]]; then
|
||||
sed -i -e 's|^SELINUX=.*|SELINUX=enforcing|g' \
|
||||
-e 's|^SELINUXTYPE=.*|SELINUXTYPE=targeted|g' \
|
||||
$SELINUX_CFG
|
||||
fi
|
||||
|
||||
if [[ -f $LABEL_CFG1 ]]; then
|
||||
mv $LABEL_CFG1 $LABEL_CFG2
|
||||
fi
|
||||
|
||||
%{?regenerate_initrd_post}
|
||||
%update_bootloader_refresh_post
|
||||
|
||||
%posttrans
|
||||
%{?regenerate_initrd_posttrans}
|
||||
%update_bootloader_posttrans
|
||||
|
||||
%postun
|
||||
GRUB_CFG=/etc/default/grub
|
||||
SELINUX_CFG=/etc/selinux/config
|
||||
|
||||
if [[ -f $GRUB_CFG ]]; then
|
||||
LINE=$(grep "^GRUB_CMDLINE_LINUX_DEFAULT=" $GRUB_CFG)
|
||||
LINE=$(sed 's\selinux=1\selinux=0\' <<< $LINE)
|
||||
LINE=$(sed 's\security=selinux\\' <<< $LINE)
|
||||
LINE=$(sed 's\enforcing=0\\' <<< $LINE)
|
||||
sed -i -e 's|\(^GRUB_CMDLINE_LINUX_DEFAULT=.*\)"|\'"${LINE}"'|g' $GRUB_CFG
|
||||
fi
|
||||
|
||||
if [[ -f $SELINUX_CFG ]]; then
|
||||
sed -i -e 's|^SELINUX=.*|SELINUX=permissive|g' \
|
||||
-e 's|^SELINUXTYPE=.*|SELINUXTYPE=targeted|g' \
|
||||
$SELINUX_CFG
|
||||
fi
|
||||
|
||||
%files
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user