update selinux_hook.chroot

This commit is contained in:
manuel 2024-07-12 12:52:15 +00:00
parent 0269734d8d
commit 5df9f4473e
2 changed files with 22 additions and 28 deletions

View File

@ -2,39 +2,36 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
set -e
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me
# Install required SELinux packages
chroot $1 apt update
chroot $1 apt -y install selinux-basics selinux-policy-default auditd
apt -y install selinux-basics selinux-policy-default auditd
# Initialize SELinux
chroot $1 selinux-activate
selinux-activate
# Restart auditd service
chroot $1 systemctl restart auditd
systemctl restart auditd
# Enable SELinux policy activation on boot
chroot $1 systemctl enable selinux-policy-activate
systemctl enable selinux-policy-activate
# Disable AppArmor
chroot $1 systemctl disable apparmor
chroot $1 systemctl stop apparmor
chroot $1 apt -y purge apparmor
systemctl disable apparmor
systemctl stop apparmor
apt -y purge apparmor
# Additional configuration (optional)
# Here you can add commands to adjust policies or configure additional rules
# Set SELinux to enforcing mode
chroot $1 /usr/sbin/setenforce 1
/usr/sbin/setenforce 1
# Configure file contexts (example)
chroot $1 /sbin/restorecon -Rv /etc/
/sbin/restorecon -Rv /etc/
# Allow HTTPD scripts and modules to connect to the network (example)
chroot $1 /usr/sbin/setsebool -P httpd_can_network_connect 1
/usr/sbin/setsebool -P httpd_can_network_connect 1
exit 0

View File

@ -2,39 +2,36 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
set -e
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me
# Install required SELinux packages
chroot $1 apt update
chroot $1 apt -y install selinux-basics selinux-policy-default auditd
apt -y install selinux-basics selinux-policy-default auditd
# Initialize SELinux
chroot $1 selinux-activate
selinux-activate
# Restart auditd service
chroot $1 systemctl restart auditd
systemctl restart auditd
# Enable SELinux policy activation on boot
chroot $1 systemctl enable selinux-policy-activate
systemctl enable selinux-policy-activate
# Disable AppArmor
chroot $1 systemctl disable apparmor
chroot $1 systemctl stop apparmor
chroot $1 apt -y purge apparmor
systemctl disable apparmor
systemctl stop apparmor
apt -y purge apparmor
# Additional configuration (optional)
# Here you can add commands to adjust policies or configure additional rules
# Set SELinux to enforcing mode
chroot $1 /usr/sbin/setenforce 1
/usr/sbin/setenforce 1
# Configure file contexts (example)
chroot $1 /sbin/restorecon -Rv /etc/
/sbin/restorecon -Rv /etc/
# Allow HTTPD scripts and modules to connect to the network (example)
chroot $1 /usr/sbin/setsebool -P httpd_can_network_connect 1
/usr/sbin/setsebool -P httpd_can_network_connect 1
exit 0