Files
MCO/check.sh
2024-02-28 18:34:11 +01:00

52 lines
1.1 KiB
Bash
Executable File

#! /bin/bash
#
set -u
set -o pipefail
test $# -lt 1 && dir=/home/tom/MCO || dir=$1
mkdir -p ${dir} || exit 5
exec 1> ${dir}/$(date -I)_$(hostname).report
echo -ne "\n\n########## $(hostname) ##########\n"
echo -ne "\n\n########## RH UPDATES ########## \n"
test -x /usr/bin/yum && yum --security check-update
echo -ne "\n\n########## Debian UPDATES ########## \n"
test -x /usr/bin/apt-get && /usr/bin/apt-get --just-print upgrade | grep "^Inst.*-security.*" | cut -d ' ' -f 2 | sort
echo -ne "\n\n########## CERTIFICATES ##########\n"
test -x /usr/bin/certbot && /usr/bin/certbot certificates
echo -ne "\n\n########## UPTIME ##########\n"
uptime
echo -ne "\n\n########## SERVICE STATUS ##########\n"
systemctl --failed
echo -ne "\n\n########## BACKUP LIST ##########\n"
test -x /usr/sbin/burp && /usr/sbin/burp -a l
echo -ne "\n\n########## LAST USER ##########\n"
last | head
echo -ne "\n\########## LOG Warnings ##########\n"
journalctl --priority warning --no-pager --since "1 month ago"
echo -ne "\n\########## fail2ban ##########\n"
test -x /usr/bin/fail2ban-client && fail2ban-client status sshd