File: selinux-config-enforcing

package info (click to toggle)
selinux-basics 0.6.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: python: 280; sh: 120; perl: 95; makefile: 2
file content (19 lines) | stat: -rwxr-xr-x 590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
set -e

MODE=$1
test "$MODE" = "0" && MODE=permissive

CONF=/etc/selinux/config

if [ "$MODE" = "permissive" ]; then
  sed -e "s/^SELINUX=.*$/SELINUX=permissive/" < $CONF > $CONF.new
  echo "Configured permissive mode in $CONF for the next boot."
  echo "This can be overridden by \"enforcing=1\" on the kernel command line."
else
  sed -e "s/^SELINUX=.*$/SELINUX=enforcing/" < $CONF > $CONF.new
  echo "Configured enforcing mode in $CONF for the next boot."
  echo "This can be overridden by \"enforcing=0\" on the kernel command line."
fi
chmod 644 $CONF.new
mv $CONF.new $CONF