1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
#!/bin/sh
################################################################################
# #
# Copyright (C) 2008-2012 LABBE Corentin <corentin.labbe@geomatys.fr>
#
# YASAT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YASAT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YASAT. If not, see <http://www.gnu.org/licenses/>.
# #
################################################################################
Title "Check partition configurations"
if [ ! -e /etc/fstab ]
then
Display --indent 2 --text "Strange, no /etc/fstab" --result NOTFOUND --color ORANGE
return 1;
fi
#TODO in /etc/fstab users is same as noexec, nosuid, nodev
#TODO check swap for encryption
if [ "${OS}" = 'OpenBSD' ]
then
SWAP_ENCRYPT="`$BSD_SYSCTL vm.swapencrypt.enable | cut -d\= -f2`"
if [ $SWAP_ENCRYPT -eq 1 ]
then
Display --indent 2 --text "SWAP is encrypted" --result ENCRYPTED --color GREEN
else
Display --indent 2 --text "SWAP is not encrypted" --result CLEAR --color ORANGE
fi
fi
#TODO under freebsd http://www.freebsd.org/doc/en/books/handbook/swap-encrypting.html
#For detecting encrypted swap under linux, i see it in 2 steps
#detect LV where swap is
#check for /etc/crypttab
#TODO nfs nfs4 smbs cifs and other network FS must have nodev noexex nosuid
check_partition '/home'
if [ ! -z $RESULTAT ]
then
#check for nodev (noexec)
if [ -z "`echo $RESULTAT | grep -i nodev`" ]
then
Display --indent 4 --text "/home dont have nodev" --result NOTFOUND --color ORANGE --advice PARTITION_NODEV
else
Display --indent 4 --text "/home have nodev" --result FOUND --color GREEN
fi
#check for nosuid
if [ -z "`echo $RESULTAT | grep -i nosuid`" ]
then
Display --indent 4 --text "/home dont have nosuid" --result NOTFOUND --color ORANGE --advice PARTITION_NOSUID
else
Display --indent 4 --text "/home have nosuid" --result FOUND --color GREEN
fi
fi
# /var nodev noexec
check_partition '/var'
if [ -z "`echo $RESULTAT | grep -i nodev`" ]
then
Display --indent 4 --text "/var dont have nodev" --result NOTFOUND --color ORANGE --advice PARTITION_NODEV
else
Display --indent 4 --text "/var have nodev" --result FOUND --color GREEN
fi
# noexec on /var breaks debian
# if [ -z "`echo $RESULTAT | grep -i noexec`" ]
# then
# Display --indent 4 --text "/var dont have noexec" --result NOTFOUND --color ORANGE --advice PARTITION_NOEXEC
# else
# Display --indent 4 --text "/var have noexec" --result FOUND --color GREEN
# fi
if [ -z "`echo $RESULTAT | grep -i nosuid`" ]
then
Display --indent 4 --text "/var dont have nosuid" --result NOTFOUND --color ORANGE --advice PARTITION_NOSUID
else
Display --indent 4 --text "/var have nosuid" --result FOUND --color GREEN
fi
# /usr nodev, I disabled this test because of http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken
#check_partition '/usr'
# if [ -z "`echo $RESULTAT | grep -i nodev`" ]
# then
# Display --indent 4 --text "/usr dont have nodev" --result NOTFOUND --color ORANGE --advice PARTITION_NODEV
# else
# Display --indent 4 --text "/usr have nodev" --result FOUND --color GREEN
# fi
# /tmp nodev noexec
check_partition '/tmp'
if [ -z "`echo $RESULTAT | grep -i nodev`" ]
then
Display --indent 4 --text "/tmp dont have nodev" --result NOTFOUND --color ORANGE --advice PARTITION_NODEV
else
Display --indent 4 --text "/tmp have nodev" --result FOUND --color GREEN
fi
if [ -z "`echo $RESULTAT | grep -i nosuid`" ]
then
Display --indent 4 --text "/tmp dont have nosuid" --result NOTFOUND --color ORANGE --advice PARTITION_NOSUID
else
Display --indent 4 --text "/tmp have nosuid" --result FOUND --color GREEN
fi
|