check_mk-check-selinux/agents/plugins/selinux

22 lines
573 B
Plaintext
Raw Normal View History

2018-06-11 18:05:21 +03:00
#!/bin/bash
#
# Check SELinux status
# SELinux has three modes:
# - permissive
# - enforcing
# - disabled
# we are not looking at SELINUXPOLICY - although it may be of interest
# in the future
if command sestatus > /dev/null ; then
# Selinux status
2018-06-12 09:35:31 +03:00
status=`sestatus | grep "SELinux status:" | awk '{print $3}'`
2018-06-11 18:05:21 +03:00
# the current mode
2018-06-12 09:35:31 +03:00
curmode=`sestatus | grep "Current mode:" | awk '{print $3}'`
2018-06-11 18:05:21 +03:00
# the mode from file
2018-06-12 09:35:31 +03:00
filemode=`sestatus | grep "Mode from config file:" | awk '{print $5}'`
echo '<<<selinux>>>'
echo $status $curmode $filemode
2018-06-11 18:05:21 +03:00
fi