mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 15:58:26 +01:00
Checks extended to define own checks for all own hosts or a specific one.
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
runAllChecks.sh
|
||||
===============
|
||||
|
||||
This script processes all checks of a host to verify the right configuration.
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
_CURRENT_ZFS='zpool1/persistent'
|
||||
|
||||
#Check if the tool 'zfs' is available, then
|
||||
#retrieve the property 'mountpoint' from 'zpool1/persistent', without header and compare the result with 'none'
|
||||
|
||||
#Set with: 'zfs set mountpoint=none zpool1/persistent'
|
||||
zfs version &> /dev/null \
|
||||
&& [ "$(zfs get mountpoint -Ho value ${_CURRENT_ZFS})" == "none" ] \
|
||||
&& exit 0
|
||||
exit 1
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
_CURRENT_POOL='zpool1/persistent'
|
||||
|
||||
#Check if the tool 'zfs' is available, then
|
||||
#retrieve the property 'recordsize' from 'zpool1/persistent', without header and compare the result with '16K'
|
||||
#because this a 'recordsize' of '16K' matches to the needs of 'mariadb'.
|
||||
|
||||
#Set with: 'zfs set recordsize=16K zpool1/persistent'
|
||||
zfs version &> /dev/null \
|
||||
&& [ "$(zfs get recordsize -Ho value ${_CURRENT_POOL})" == "16K" ] \
|
||||
&& exit 0
|
||||
exit 1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
_OWN_PATH="$(dirname $(readlink -f $0))"
|
||||
|
||||
function run_as_root() {
|
||||
[ "0" == "$(id -u)" ] \
|
||||
&& echo OK \
|
||||
&& return 0
|
||||
|
||||
echo FAIL
|
||||
return 1
|
||||
}
|
||||
|
||||
function scripts_are_updateable_by_git() {
|
||||
git -C "${_OWN_PATH:?"Missing OWN_PATH"}" pull > /dev/null 2>&1 \
|
||||
&& echo OK \
|
||||
&& return 0
|
||||
|
||||
echo FAIL
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "PRECONDITION run as root: $(run_as_root)"
|
||||
echo "PRECONDITION scripts are updateable by git: $(scripts_are_updateable_by_git)"
|
||||
echo
|
||||
echo "Check all:"
|
||||
for _CURRENT_CHECK in ${_OWN_PATH}/checks/*.check.sh; do
|
||||
_NAME="$(basename ${_CURRENT_CHECK} | cut -d'.' -f1)"
|
||||
_CONTEXT="$(echo ${_NAME} | cut -d'_' -f1)"
|
||||
_CHECK="$(echo ${_NAME} | cut -d'_' -f2- | tr '_' ' ')"
|
||||
_RESULT="$("${_CURRENT_CHECK}" && echo OK || echo FAIL)"
|
||||
echo " ${_CONTEXT^^} ${_CHECK}: ${_RESULT}"
|
||||
done
|
||||
Reference in New Issue
Block a user