2019-03-25 17:02:51 +01:00
#!/bin/sh
2009-07-05 01:58:11 +02:00
2015-11-28 16:23:28 +01:00
# EvoCheck
2020-04-21 16:59:08 +02:00
# Script to verify compliance of an OpenBSD server powered by Evolix
2009-07-05 01:58:11 +02:00
2020-10-22 18:16:52 +02:00
readonly VERSION = "6.7.7"
2020-04-21 17:30:39 +02:00
2009-09-14 18:58:38 +02:00
# Disable LANG*
2019-03-22 17:51:56 +01:00
2009-09-14 18:58:38 +02:00
export LANG = C
export LANGUAGE = C
2009-07-19 02:01:50 +02:00
2009-09-08 15:00:25 +02:00
2019-03-25 17:06:09 +01:00
# Default return code : 0 = no error
RC = 0
2019-01-16 16:53:53 +01:00
# Verbose function
verbose( ) {
msg = " ${ 1 :- $( cat /dev/stdin) } "
2019-01-17 11:02:40 +01:00
[ " ${ VERBOSE } " -eq 1 ] && [ -n " ${ msg } " ] && echo " ${ msg } "
2019-01-16 16:53:53 +01:00
}
2009-07-19 02:01:50 +02:00
# Source configuration file
2009-07-05 01:58:11 +02:00
test -f /etc/evocheck.cf && . /etc/evocheck.cf
2019-03-25 17:06:09 +01:00
# Functions
show_help( ) {
cat <<END
2020-04-21 17:32:48 +02:00
NAME:
evocheck - a system configuration verification tool
VERSION:
${ VERSION }
DESCRIPTION:
A script that verifies Evolix conventions on OpenBSD servers
AUTHORS:
Benoit Serie <bserie@evolix.fr>
Gregory Colpart <reg@evolix.fr>
Jeremy Dubois <jdubois@evolix.fr>
Jeremy Lecour <jlecour@evolix.fr>
Ludovic Poujol <lpoujol@evolix.fr>
Romain Dessort <rdessort@evolix.fr>
Tristan Pilat <tpilat@evolix.fr>
Victor Laborie <vlaborie@evolix.fr>
USAGE: evocheck
or evocheck --cron
or evocheck --quiet
or evocheck --verbose
OPTIONS:
--cron disable a few checks
-v, --verbose increase verbosity of checks
-q, --quiet nothing is printed on stdout nor stderr
-h, --help, --version print this message and exit
COPYRIGHT:
evocheck comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
See the GNU General Public License v3.0 for details. 2009-2020
2019-03-25 17:06:09 +01:00
END
}
is_installed( ) {
for pkg in " $@ " ; do
2019-03-25 17:49:22 +01:00
pkg_info | grep -q $pkg || return 1
2019-03-25 17:06:09 +01:00
done
}
# logging
failed( ) {
check_name = $1
shift
check_comments = $*
RC = 1
if [ " ${ QUIET } " != 1 ] ; then
if [ -n " ${ check_comments } " ] && [ " ${ VERBOSE } " = 1 ] ; then
printf "%s FAILED! %s\n" " ${ check_name } " " ${ check_comments } " 2>& 1
else
printf "%s FAILED!\n" " ${ check_name } " 2>& 1
fi
fi
}
2019-01-16 16:53:53 +01:00
2016-05-10 23:58:04 +02:00
# If --cron is passed, ignore some checks.
if [ " $1 " = "--cron" ] ; then
IS_KERNELUPTODATE = 0
2018-01-31 16:25:28 +01:00
IS_UPTIME = 0
2016-05-10 23:58:04 +02:00
fi
2020-04-21 17:40:28 +02:00
check_umasksudoers( ) {
2019-03-25 17:08:08 +01:00
grep -E -qr "umask=0077" /etc/sudoers* || failed "IS_UMASKSUDOERS" "sudoers must set umask to 0077"
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_tmpnoexec( ) {
2019-03-25 17:08:08 +01:00
mount | grep "on /tmp" | grep -q noexec || failed "IS_TMPNOEXEC" "/tmp should be mounted with the noexec option"
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-10-15 10:18:55 +02:00
check_softdep( ) {
if [ $( grep -c softdep /etc/fstab) -ne $( grep -c ffs /etc/fstab) ] ; then
failed "IS_SOFTDEP" "All partitions should have the softdep option"
fi
}
check_noatime( ) {
2020-10-23 17:32:15 +02:00
if [ $( mount | grep -c noatime) -ne $( grep ffs /etc/fstab | grep -vc ^\# ) ] ; then
2020-10-15 10:18:55 +02:00
failed "IS_NOATIME" "All partitions should be mounted with the noatime option"
fi
}
2020-04-21 17:40:28 +02:00
check_tmoutprofile( ) {
2019-03-25 17:08:08 +01:00
grep -q TMOUT = /etc/skel/.profile /root/.profile || failed "IS_TMOUTPROFILE" "In order to fix, add 'export TMOUT=36000' to both /etc/skel/.profile and /root/.profile files"
2020-04-21 17:40:28 +02:00
}
2016-05-10 22:07:02 +02:00
2020-04-21 17:40:28 +02:00
check_raidok( ) {
2020-04-22 17:53:26 +02:00
egrep 'sd.*RAID' /var/run/dmesg.boot 1> /dev/null 2>& 1
RESULT = $?
if [ $RESULT -eq 0 ] ; then
2020-10-22 14:16:56 +02:00
raid_device = $( egrep 'sd.*RAID' /var/run/dmesg.boot | awk '{ print $1 }' | tail -1)
2020-04-22 17:53:26 +02:00
raid_status = $( bioctl $raid_device | grep softraid | awk '{ print $3 }' )
if [ $raid_status != "Online" ] ; then
failed "IS_RAIDOK" " One of the RAID disk members is faulty. Use bioctl -h $raid_device for more informations "
fi
fi
2020-04-21 17:40:28 +02:00
}
2016-05-10 22:50:44 +02:00
2020-04-21 17:40:28 +02:00
check_evobackup( ) {
2019-03-22 14:55:57 +01:00
if [ -f /etc/daily.local ] ; then
2019-03-25 17:08:08 +01:00
grep -qE "^sh /usr/share/scripts/zzz_evobackup" /etc/daily.local || failed "IS_EVOBACKUP" "Make sure 'sh /usr/share/scripts/zzz_evobackup' is present and activated in /etc/daily.local"
2019-03-22 14:55:57 +01:00
else
2019-03-25 17:08:08 +01:00
failed "IS_EVOBACKUP" "Make sure /etc/daily.local exists and 'sh /usr/share/scripts/zzz_evobackup' is present and activated in /etc/daily.local"
2012-01-25 18:05:05 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-27 15:30:00 +02:00
check_uptodate( ) {
2020-10-22 12:12:42 +02:00
if [ $( command -v syspatch) ] ; then
2020-04-27 15:30:00 +02:00
if syspatch -c | egrep "." 1> /dev/null 2>& 1; then
failed "IS_UPTODATE" "Security update available! Update with syspatch(8)!"
fi
fi
2020-04-21 17:40:28 +02:00
}
2019-03-22 14:56:46 +01:00
2020-04-21 17:40:28 +02:00
check_uptime( ) {
2019-03-22 14:57:18 +01:00
if [ $( uptime | cut -d" " -f 4) -gt 365 ] ; then
2019-03-25 17:08:08 +01:00
failed "IS_UPTIME" "The server is running for more than a year!"
2012-01-25 18:05:05 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-08-04 15:08:21 +02:00
check_backupuptodate( ) {
backup_dir = "/home/backup"
if [ -d " ${ backup_dir } " ] ; then
if [ -n " $( ls -A ${ backup_dir } ) " ] ; then
for file in ${ backup_dir } /*; do
let " limit = $( date +"%s" ) - 172800 "
updated_at = $( stat -f "%m" " $file " )
if [ -f " $file " ] && [ " $limit " -gt " $updated_at " ] ; then
failed "IS_BACKUPUPTODATE" " $file has not been backed up "
test " ${ VERBOSE } " = 1 || break;
fi
done
else
failed "IS_BACKUPUPTODATE" " ${ backup_dir } / is empty "
fi
else
failed "IS_BACKUPUPTODATE" " ${ backup_dir } / is missing "
fi
2020-04-21 17:40:28 +02:00
}
2016-06-16 18:08:22 +02:00
2020-04-21 17:40:28 +02:00
check_gitperms( ) {
2019-03-25 17:08:08 +01:00
test -d /etc/.git && [ " $( stat -f %p /etc/.git/) " = "40700" ] || failed "IS_GITPERMS" "The directiry /etc/.git sould be in 700"
2020-04-21 17:40:28 +02:00
}
2017-05-31 16:01:19 +02:00
2020-04-21 17:40:28 +02:00
check_advbase( ) {
2019-03-20 09:43:50 +01:00
if ls /etc/hostname.carp* 1> /dev/null 2>& 1; then
2020-07-15 11:08:32 +02:00
bad_advbase = 0
2019-03-20 09:43:50 +01:00
for advbase in $( ifconfig carp | grep advbase | awk -F 'advbase' '{print $2}' | awk '{print $1}' | xargs) ; do
2020-07-15 11:08:32 +02:00
if [ [ " $advbase " -gt 5 ] ] ; then
bad_advbase = 1
2018-06-28 11:52:31 +02:00
fi
2019-01-25 10:40:51 +01:00
done
2020-07-15 11:08:32 +02:00
if [ [ " $bad_advbase " -eq 1 ] ] ; then
failed "IS_ADVBASE" "At least one CARP interface has advbase greater than 5 seconds!"
fi
2019-01-16 13:47:49 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2012-01-25 18:05:05 +01:00
2020-04-21 17:40:28 +02:00
check_preempt( ) {
2019-03-20 09:43:50 +01:00
if ls /etc/hostname.carp* 1> /dev/null 2>& 1; then
preempt = $( sysctl net.inet.carp.preempt | cut -d"=" -f2)
if [ [ " $preempt " -ne 1 ] ] ; then
2019-03-25 17:08:08 +01:00
failed "IS_PREEMPT" "The preempt function is not activated! Please type 'sysctl net.inet.carp.preempt=1' in"
2019-03-12 17:33:01 +01:00
fi
2019-03-20 09:43:50 +01:00
if [ -f /etc/sysctl.conf ] ; then
2019-03-25 17:08:08 +01:00
grep -qE "^net.inet.carp.preempt=1" /etc/sysctl.conf || failed "IS_PREEMPT" "The preempt parameter is not permanently activated! Please add 'net.inet.carp.preempt=1' in /etc/sysctl.conf"
2019-03-13 14:37:49 +01:00
else
2020-04-21 17:40:28 +02:00
failed "IS_PREEMPT" "Make sure /etc/sysctl.conf exists and contains the line 'net.inet.carp.preempt=1'"
2019-03-13 14:37:49 +01:00
fi
fi
2020-04-21 17:40:28 +02:00
}
2019-03-13 14:37:49 +01:00
2020-04-21 17:40:28 +02:00
check_rebootmail( ) {
2019-03-20 09:43:50 +01:00
if [ -f /etc/rc.local ] ; then
2019-03-25 17:08:08 +01:00
grep -qE '^date \| mail -s "boot/reboot of' /etc/rc.local || failed "IS_REBOOTMAIL" "Make sure the line 'date | mail -s \"boot/reboot of \$hostname' is present in the /etc/rc.local file!"
2019-03-20 09:43:50 +01:00
else
2019-03-25 17:08:08 +01:00
failed "IS_REBOOTMAIL" "Make sure /etc/rc.local exist and 'date | mail -s \"boot/reboot of \$hostname' is present!"
2012-01-25 18:05:05 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_pfenabled( ) {
2020-04-27 15:30:42 +02:00
if pfctl -si | grep Disabled 1> /dev/null 2>& 1; then
failed "IS_PFENABLED" "PF is disabled! Make sure pf=NO is absent from /etc/rc.conf.local and carefully run pfctl -e"
fi
2020-04-21 17:40:28 +02:00
}
2019-03-22 17:36:23 +01:00
2020-04-21 17:40:28 +02:00
check_pfcustom( ) {
}
2019-03-22 17:36:23 +01:00
2020-04-21 17:40:28 +02:00
check_wheel( ) {
2019-03-20 09:43:50 +01:00
if [ -f /etc/sudoers ] ; then
2019-03-25 17:08:08 +01:00
grep -qE " ^%wheel.* $" /etc/sudoers || failed "IS_WHEEL" ""
2012-01-25 18:05:05 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_pkgmirror( ) {
2019-03-25 17:08:08 +01:00
grep -qE "^https://cdn\.openbsd\.org/pub/OpenBSD" /etc/installurl || failed "IS_PKGMIRROR" "Check whether the right repo is present in the /etc/installurl file"
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_history( ) {
2019-03-22 17:17:55 +01:00
file = /root/.profile
2019-03-25 17:08:08 +01:00
grep -qE "^HISTFILE=\$HOME/.histfile" $file && grep -qE "^export HISTSIZE=10000" $file || failed "IS_HISTORY" " Make sure both 'HISTFILE= $HOME /.histfile' and 'export HISTSIZE=10000' are present in /root/.profile "
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_vim( ) {
2019-03-25 17:50:10 +01:00
if ! is_installed vim; then
2020-04-21 17:40:28 +02:00
failed "IS_VIM" "vim is not installed! Please add with pkg_add vim"
2019-03-25 17:50:10 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_ttyc0secure( ) {
2019-03-25 17:08:08 +01:00
grep -Eqv " ^ttyC0.*secure $" /etc/ttys || failed "IS_TTYC0SECURE" "First tty should be secured"
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_customsyslog( ) {
2020-07-15 11:19:30 +02:00
grep -q EvoBSD /etc/newsyslog.conf || failed "IS_CUSTOMSYSLOG" ""
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_sudomaint( ) {
file = /etc/sudoers
grep -q "Cmnd_Alias MAINT = /usr/share/scripts/evomaintenance.sh" $file \
2020-07-15 11:21:10 +02:00
&& grep -q "%wheel ALL=NOPASSWD: MAINT" $file \
2019-03-25 17:08:08 +01:00
|| failed "IS_SUDOMAINT" ""
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_nrpe( ) {
2019-03-25 17:50:10 +01:00
if ! is_installed monitoring-plugins || ! is_installed nrpe; then
2020-04-21 17:40:28 +02:00
failed "IS_NRPE" "nrpe and/or monitoring-plugins are not installed! Please add with pkg_add nrpe monitoring-plugins"
fi
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_rsync( ) {
2019-03-25 17:50:10 +01:00
if ! is_installed rsync; then
2020-04-21 17:40:28 +02:00
failed "IS_RSYNC" "rsync is not installed! Please add with pkg_add rsync"
2019-03-25 17:50:10 +01:00
fi
2020-04-21 17:40:28 +02:00
}
2018-03-29 22:29:50 +02:00
2020-04-21 17:40:28 +02:00
check_cronpath( ) {
2020-10-09 14:09:21 +02:00
grep -q "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/share/scripts" /var/cron/tabs/root || failed "IS_CRONPATH" ""
2020-04-21 17:40:28 +02:00
}
2012-01-25 18:05:05 +01:00
2020-04-21 17:40:28 +02:00
check_tmp1777( ) {
2019-03-25 17:08:08 +01:00
ls -ld /tmp | grep -q drwxrwxrwt || failed "IS_TMP_1777" ""
2020-04-21 17:40:28 +02:00
}
2009-07-05 01:58:11 +02:00
2020-04-21 17:40:28 +02:00
check_root0700( ) {
2019-03-25 17:08:08 +01:00
ls -ld /root | grep -q drwx------ || failed "IS_ROOT_0700" ""
2020-04-21 17:40:28 +02:00
}
2009-07-05 01:58:11 +02:00
2020-04-21 17:40:28 +02:00
check_usrsharescripts( ) {
2019-03-25 17:08:08 +01:00
ls -ld /usr/share/scripts | grep -q drwx------ || failed "IS_USRSHARESCRIPTS" ""
2020-04-21 17:40:28 +02:00
}
2009-07-05 01:58:11 +02:00
2020-04-21 17:40:28 +02:00
check_sshpermitrootno( ) {
2019-03-25 17:08:08 +01:00
grep -qE ^PermitRoot /etc/ssh/sshd_config && ( grep -E -qi "PermitRoot.*no" /etc/ssh/sshd_config || failed "IS_SSHPERMITROOTNO" "" )
2020-04-21 17:40:28 +02:00
}
2009-07-13 01:44:31 +02:00
2020-04-21 17:40:28 +02:00
check_evomaintenanceusers( ) {
2019-01-25 11:11:16 +01:00
# Can be changed in evocheck.cf
homeDir = ${ homeDir :- /home }
2019-03-25 17:09:49 +01:00
sudoers = "/etc/sudoers"
for i in $( ( grep "^User_Alias *ADMIN" $sudoers | cut -d= -f2 | tr -d " " ; grep ^sudo /etc/group | cut -d: -f 4) | tr "," "\n" | sort -u) ; do
grep -qs "^trap.*sudo.*evomaintenance.sh" ${ homeDir } /${ i } /.*profile
if [ $? != 0 ] ; then
failed "IS_EVOMAINTENANCEUSERS" " $i doesn't have evomaintenance trap! "
2017-11-14 17:34:41 +01:00
fi
2020-04-21 17:40:28 +02:00
done
}
check_evomaintenanceconf( ) {
file = /etc/evomaintenance.cf
( test -e $file \
&& test $( stat -f %p $file ) = "100600" \
&& grep "^export PGPASSWORD" $file | grep -qv "your-passwd" \
&& grep "^PGDB" $file | grep -qv "your-db" \
&& grep "^PGTABLE" $file | grep -qv "your-table" \
&& grep "^PGHOST" $file | grep -qv "your-pg-host" \
&& grep "^FROM" $file | grep -qv "jdoe@example.com" \
&& grep "^FULLFROM" $file | grep -qv "John Doe <jdoe@example.com>" \
&& grep "^URGENCYFROM" $file | grep -qv "mama.doe@example.com" \
&& grep "^URGENCYTEL" $file | grep -qv "06.00.00.00.00" \
&& grep "^REALM" $file | grep -qv "example.com" ) || failed "IS_EVOMAINTENANCECONF" ""
}
2009-07-18 17:21:00 +02:00
2020-04-27 15:38:27 +02:00
check_sync( ) {
if ifconfig carp | grep carp 1> /dev/null 2>& 1; then
sync_script = /usr/share/scripts/sync.sh
if [ ! -f $sync_script ] ; then
failed "IS_SYNC" "The sync.sh script is absent! As a carp member, a sync.sh script should be present in /usr/share/scripts"
fi
fi
}
2020-07-22 14:27:27 +02:00
check_defaultroute( ) {
2020-07-23 10:28:34 +02:00
if [ -f /etc/mygate ] ; then
file_route = $( cat /etc/mygate)
used_route = $( route -n show -priority 8 | grep default | awk '{print $2}' )
if [ " $file_route " != " $used_route " ] ; then
failed "IS_DEFAULTROUTE" "The default route in /etc/mygate is different from the one currently used"
fi
else
failed "IS_DEFAULTROUTE" "The file /etc/mygate does not exist. Make sure you have the same default route in this file as the one currently in use."
2020-07-22 14:27:27 +02:00
fi
}
2020-07-27 16:59:54 +02:00
check_ntp( ) {
if grep -q "server ntp.evolix.net" /etc/ntpd.conf; then
if [ $( wc -l /etc/ntpd.conf | awk '{print $1}' ) -ne 1 ] ; then
failed "IS_NTP" "The /etc/ntpd.conf file should only contains \"server ntp.evolix.net\"."
fi
else
failed "IS_NTP" "The configuration in /etc/ntpd.conf is not compliant. It should contains \"server ntp.evolix.net\"."
fi
}
2020-10-22 18:16:52 +02:00
check_openvpncronlog( ) {
if /etc/rc.d/openvpn check > /dev/null 2>& 1; then
grep -q 'cp /var/log/openvpn.log /var/log/openvpn.log.$(date +\\%F) && echo "$(date +\\%F. .\\%R) - logfile turned over via cron" > /var/log/openvpn.log && gzip /var/log/openvpn.log.$(date +\\%F) && find /var/log/ -type f -name "openvpn.log.\*" -mtime .365 -exec rm {} \\+' /var/cron/tabs/root || failed "IS_OPENVPNCRONLOG" "OpenVPN is enabled but there is no log rotation in the root crontab, or the cron is not up to date (OpenVPN log rotation in newsyslog is not used because a restart is needed)."
fi
}
2020-04-21 17:44:37 +02:00
main( ) {
# Default return code : 0 = no error
RC = 0
test " ${ IS_UMASKSUDOERS : =1 } " = 1 && check_umasksudoers
test " ${ IS_TMPNOEXEC : =1 } " = 1 && check_tmpnoexec
2020-10-15 10:18:55 +02:00
test " ${ IS_SOFTDEP : =1 } " = 1 && check_softdep
test " ${ IS_NOATIME : =1 } " = 1 && check_noatime
2020-04-21 17:44:37 +02:00
test " ${ IS_TMOUTPROFILE : =1 } " = 1 && check_tmoutprofile
test " ${ IS_RAIDOK : =1 } " = 1 && check_raidok
test " ${ IS_EVOBACKUP : =1 } " = 1 && check_evobackup
2020-04-27 15:30:00 +02:00
test " ${ IS_UPTODATE : =1 } " = 1 && check_uptodate
2020-04-21 17:44:37 +02:00
test " ${ IS_UPTIME : =1 } " = 1 && check_uptime
2020-08-04 15:08:21 +02:00
test " ${ IS_BACKUPUPTODATE : =1 } " = 1 && check_backupuptodate
2020-04-21 17:44:37 +02:00
test " ${ IS_GITPERMS : =1 } " = 1 && check_gitperms
test " ${ IS_ADVBASE : =1 } " = 1 && check_advbase
test " ${ IS_PREEMPT : =1 } " = 1 && check_preempt
test " ${ IS_REBOOTMAIL : =1 } " = 1 && check_rebootmail
test " ${ IS_PFENABLED : =1 } " = 1 && check_pfenabled
test " ${ IS_PFCUSTOM : =1 } " = 1 && check_pfcustom
test " ${ IS_WHEEL : =1 } " = 1 && check_wheel
test " ${ IS_PKGMIRROR : =1 } " = 1 && check_pkgmirror
test " ${ IS_HISTORY : =1 } " = 1 && check_history
test " ${ IS_VIM : =1 } " = 1 && check_vim
test " ${ IS_TTYC0SECURE : =1 } " = 1 && check_ttyc0secure
test " ${ IS_CUSTOMSYSLOG : =1 } " = 1 && check_customsyslog
test " ${ IS_SUDOMAINT : =1 } " = 1 && check_sudomaint
test " ${ IS_NRPE : =1 } " = 1 && check_nrpe
test " ${ IS_RSYNC : =1 } " = 1 && check_rsync
test " ${ IS_CRONPATH : =1 } " = 1 && check_cronpath
test " ${ IS_TMP_1777 : =1 } " = 1 && check_tmp1777
test " ${ IS_ROOT_0700 : =1 } " = 1 && check_root0700
test " ${ IS_USRSHARESCRIPTS : =1 } " = 1 && check_usrsharescripts
test " ${ IS_SSHPERMITROOTNO : =1 } " = 1 && check_sshpermitrootno
test " ${ IS_EVOMAINTENANCEUSERS : =1 } " = 1 && check_evomaintenanceusers
test " ${ IS_EVOMAINTENANCECONF : =1 } " = 1 && check_evomaintenanceconf
2020-04-27 15:38:27 +02:00
test " ${ IS_SYNC : =1 } " = 1 && check_sync
2020-07-22 14:27:27 +02:00
test " ${ IS_DEFAULTROUTE : =1 } " = 1 && check_defaultroute
2020-07-27 16:59:54 +02:00
test " ${ IS_NTP : =1 } " = 1 && check_ntp
2020-10-22 18:16:52 +02:00
test " ${ IS_OPENVPNCRONLOG : =1 } " = 1 && check_openvpncronlog
2020-04-21 17:44:37 +02:00
exit ${ RC }
}
2020-04-21 17:37:07 +02:00
# Parse options
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do
case $1 in
-h| -\? | --help| --version)
show_help
exit 0
; ;
--cron)
IS_KERNELUPTODATE = 0
IS_UPTIME = 0
; ;
-v| --verbose)
VERBOSE = 1
; ;
-q| --quiet)
QUIET = 1
VERBOSE = 0
; ;
--)
# End of all options.
shift
break
; ;
-?*| [ [ :alnum:] ] *)
# ignore unknown options
printf 'WARN: Unknown option (ignored): %s\n' " $1 " >& 2
; ;
*)
# Default case: If no more options then break out of the loop.
break
; ;
esac
shift
done
2020-04-21 17:44:37 +02:00
main ${ ARGS }