2021-11-08 19:43:30
This commit is contained in:
29
test.sh
29
test.sh
@@ -64,6 +64,13 @@ main ()
|
||||
echo "KO: Unknown Linux distribution"
|
||||
fi
|
||||
|
||||
if ssh_exec ${port} ${login} ${pass} cat /etc/os-release | grep -q -i -E '(bullseye|"8")'
|
||||
then
|
||||
echo "OK: Using stable distro"
|
||||
else
|
||||
echo "KO: Not using stable distro"
|
||||
fi
|
||||
|
||||
if ssh_exec ${port} ${login} ${pass} /usr/sbin/aa-status | grep -q -i -E "apparmor module is loaded" \
|
||||
|| ssh_exec ${port} ${login} ${pass} sestatus | grep -q -i -E "SELinux status:[^e]*enabled"
|
||||
then
|
||||
@@ -94,6 +101,28 @@ main ()
|
||||
echo "KO: Not disk crypted"
|
||||
fi
|
||||
|
||||
if ssh_exec ${port} ${login} ${pass} lsblk | grep -c "lvm" | grep -q -E '^[2-9]'
|
||||
then
|
||||
echo "OK: Two or more partitions use LVM"
|
||||
else
|
||||
echo "KO: Less than two or no partitions use LVM"
|
||||
fi
|
||||
|
||||
if ssh_exec ${port} ${login} ${pass} cat /etc/ssh/sshd_config | grep -q -i -E '^Port 4242' \
|
||||
&& ssh_exec ${port} ${login} ${pass} cat /etc/ssh/sshd_config | grep -q -i -E '^PermitRootLogin no'
|
||||
then
|
||||
echo "OK: SSH config is correctly setup"
|
||||
else
|
||||
echo "KO: SSH config is not correctly setup"
|
||||
fi
|
||||
|
||||
if ssh_exec ${port} ${login} ${pass} groups ${login} | grep -q -E "( user42.* sudo| sudo.* user42)"
|
||||
then
|
||||
echo "OK: ${login} is member of both user42 and sudo groups"
|
||||
else
|
||||
echo "KO: ${login} is not member of both user42 and sudo groups"
|
||||
fi
|
||||
|
||||
if ssh_exec ${port} ${login} ${pass} ss -tunlpe | grep -q -E "LISTEN.*:4242.*ssh"
|
||||
then
|
||||
echo "OK: ssh running on 4242"
|
||||
|
||||
Reference in New Issue
Block a user