|
|
@ -4,9 +4,7 @@
|
|
|
|
# Script to verify compliance of a Linux (Debian) server
|
|
|
|
# Script to verify compliance of a Linux (Debian) server
|
|
|
|
# powered by Evolix
|
|
|
|
# powered by Evolix
|
|
|
|
|
|
|
|
|
|
|
|
#set -x
|
|
|
|
VERSION="23.11"
|
|
|
|
|
|
|
|
|
|
|
|
VERSION="24.01"
|
|
|
|
|
|
|
|
readonly VERSION
|
|
|
|
readonly VERSION
|
|
|
|
|
|
|
|
|
|
|
|
# base functions
|
|
|
|
# base functions
|
|
|
@ -158,13 +156,13 @@ check_dpkgwarning() {
|
|
|
|
# Check if localhost, localhost.localdomain and localhost.$mydomain are set in Postfix mydestination option.
|
|
|
|
# Check if localhost, localhost.localdomain and localhost.$mydomain are set in Postfix mydestination option.
|
|
|
|
check_postfix_mydestination() {
|
|
|
|
check_postfix_mydestination() {
|
|
|
|
# shellcheck disable=SC2016
|
|
|
|
# shellcheck disable=SC2016
|
|
|
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet --extended-regexp 'localhost([[:blank:]]|$)'; then
|
|
|
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet -E 'localhost([[:blank:]]|$)'; then
|
|
|
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost' is missing in Postfix mydestination option."
|
|
|
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost' is missing in Postfix mydestination option."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet --fixed-strings 'localhost.localdomain'; then
|
|
|
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet 'localhost\.localdomain'; then
|
|
|
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost.localdomain' is missing in Postfix mydestination option."
|
|
|
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost.localdomain' is missing in Postfix mydestination option."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet --fixed-strings 'localhost.$mydomain'; then
|
|
|
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet 'localhost\.\$mydomain'; then
|
|
|
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost.\$mydomain' is missing in Postfix mydestination option."
|
|
|
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost.\$mydomain' is missing in Postfix mydestination option."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -195,13 +193,8 @@ check_logrotateconf() {
|
|
|
|
test -e /etc/logrotate.d/zsyslog || failed "IS_LOGROTATECONF" "missing zsyslog in logrotate.d"
|
|
|
|
test -e /etc/logrotate.d/zsyslog || failed "IS_LOGROTATECONF" "missing zsyslog in logrotate.d"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_syslogconf() {
|
|
|
|
check_syslogconf() {
|
|
|
|
# Test for modern servers
|
|
|
|
grep -q "^# Syslog for Pack Evolix serveur" /etc/*syslog.conf \
|
|
|
|
if [ ! -f /etc/rsyslog.d/10-evolinux-default.conf ]; then
|
|
|
|
|| failed "IS_SYSLOGCONF" "syslog evolix config file missing"
|
|
|
|
# Fallback test for legacy servers
|
|
|
|
|
|
|
|
if ! grep --quiet --ignore-case "Syslog for Pack Evolix" /etc/*syslog*/*.conf; then
|
|
|
|
|
|
|
|
failed "IS_SYSLOGCONF" "Evolix syslog config is missing"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_debiansecurity() {
|
|
|
|
check_debiansecurity() {
|
|
|
|
# Look for enabled "Debian-Security" sources from the "Debian" origin
|
|
|
|
# Look for enabled "Debian-Security" sources from the "Debian" origin
|
|
|
@ -210,25 +203,13 @@ check_debiansecurity() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_debiansecurity_lxc() {
|
|
|
|
check_debiansecurity_lxc() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
|
if [ -f /var/lib/lxc/${container}/rootfs/etc/debian_version ]; then
|
|
|
|
|
|
|
|
DEBIAN_LXC_VERSION=$(cut -d "." -f 1 < /var/lib/lxc/${container}/rootfs/etc/debian_version)
|
|
|
|
|
|
|
|
if [ $DEBIAN_LXC_VERSION -ge 9 ]; then
|
|
|
|
|
|
|
|
lxc-attach --name $container apt-cache policy | grep "\bl=Debian-Security\b" | grep "\bo=Debian\b" | grep --quiet "\bc=main\b"
|
|
|
|
lxc-attach --name $container apt-cache policy | grep "\bl=Debian-Security\b" | grep "\bo=Debian\b" | grep --quiet "\bc=main\b"
|
|
|
|
test $? -eq 0 || failed "IS_DEBIANSECURITY_LXC" "missing Debian-Security repository in container ${container}"
|
|
|
|
test $? -eq 0 || failed "IS_DEBIANSECURITY_LXC" "missing Debian-Security repository in container ${container}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_backports_version() {
|
|
|
|
|
|
|
|
# Look for enabled "Debian Backports" sources from the "Debian" origin
|
|
|
|
|
|
|
|
apt-cache policy | grep "\bl=Debian Backports\b" | grep "\bo=Debian\b" | grep --quiet "\bc=main\b"
|
|
|
|
|
|
|
|
test $? -eq 1 || ( \
|
|
|
|
|
|
|
|
apt-cache policy | grep "\bl=Debian Backports\b" | grep --quiet "\bn=${DEBIAN_RELEASE}-backports\b" && \
|
|
|
|
|
|
|
|
test $? -eq 0 || failed "IS_BACKPORTS_VERSION" "Debian Backports enabled for another release than ${DEBIAN_RELEASE}" )
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
check_oldpub() {
|
|
|
|
check_oldpub() {
|
|
|
|
# Look for enabled pub.evolix.net sources (supersed by pub.evolix.org since Stretch)
|
|
|
|
# Look for enabled pub.evolix.net sources (supersed by pub.evolix.org since Stretch)
|
|
|
|
apt-cache policy | grep --quiet pub.evolix.net
|
|
|
|
apt-cache policy | grep --quiet pub.evolix.net
|
|
|
@ -237,13 +218,10 @@ check_oldpub() {
|
|
|
|
check_oldpub_lxc() {
|
|
|
|
check_oldpub_lxc() {
|
|
|
|
# Look for enabled pub.evolix.net sources (supersed by pub.evolix.org since Buster as Sury safeguard)
|
|
|
|
# Look for enabled pub.evolix.net sources (supersed by pub.evolix.org since Buster as Sury safeguard)
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
|
APT_CACHE_BIN=$(lxc-attach --name $container -- bash -c "command -v apt-cache")
|
|
|
|
|
|
|
|
if [ -x "${APT_CACHE_BIN}" ]; then
|
|
|
|
|
|
|
|
lxc-attach --name $container apt-cache policy | grep --quiet pub.evolix.net
|
|
|
|
lxc-attach --name $container apt-cache policy | grep --quiet pub.evolix.net
|
|
|
|
test $? -eq 1 || failed "IS_OLDPUB_LXC" "Old pub.evolix.net repository is still enabled in container ${container}"
|
|
|
|
test $? -eq 1 || failed "IS_OLDPUB_LXC" "Old pub.evolix.net repository is still enabled in container ${container}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -262,16 +240,13 @@ check_sury() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_sury_lxc() {
|
|
|
|
check_sury_lxc() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
|
APT_CACHE_BIN=$(lxc-attach --name $container -- bash -c "command -v apt-cache")
|
|
|
|
|
|
|
|
if [ -x "${APT_CACHE_BIN}" ]; then
|
|
|
|
|
|
|
|
lxc-attach --name $container apt-cache policy | grep --quiet packages.sury.org
|
|
|
|
lxc-attach --name $container apt-cache policy | grep --quiet packages.sury.org
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
lxc-attach --name $container apt-cache policy | grep "\bl=Evolix\b" | grep php --quiet
|
|
|
|
lxc-attach --name $container apt-cache policy | grep "\bl=Evolix\b" | grep php --quiet
|
|
|
|
test $? -eq 0 || failed "IS_SURY_LXC" "packages.sury.org is present but our safeguard pub.evolix.org repository is missing in container ${container}"
|
|
|
|
test $? -eq 0 || failed "IS_SURY_LXC" "packages.sury.org is present but our safeguard pub.evolix.org repository is missing in container ${container}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -314,23 +289,13 @@ check_customcrontab() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_sshallowusers() {
|
|
|
|
check_sshallowusers() {
|
|
|
|
if is_debian_bookworm; then
|
|
|
|
if is_debian_bookworm; then
|
|
|
|
if [ -d /etc/ssh/sshd_config.d/ ]; then
|
|
|
|
grep -E -qir "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config.d \
|
|
|
|
# AllowUsers or AllowGroups should be in /etc/ssh/sshd_config.d/
|
|
|
|
|
|
|
|
grep -E -qir "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config.d/ \
|
|
|
|
|
|
|
|
|| failed "IS_SSHALLOWUSERS" "missing AllowUsers or AllowGroups directive in sshd_config.d/*"
|
|
|
|
|| failed "IS_SSHALLOWUSERS" "missing AllowUsers or AllowGroups directive in sshd_config.d/*"
|
|
|
|
fi
|
|
|
|
grep -E -qir "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config \
|
|
|
|
# AllowUsers or AllowGroups should not be in /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
grep -E -qi "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config \
|
|
|
|
|
|
|
|
&& failed "IS_SSHALLOWUSERS" "AllowUsers or AllowGroups directive present in sshd_config"
|
|
|
|
&& failed "IS_SSHALLOWUSERS" "AllowUsers or AllowGroups directive present in sshd_config"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# AllowUsers or AllowGroups should be in /etc/ssh/sshd_config or /etc/ssh/sshd_config.d/
|
|
|
|
grep -E -qir "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config /etc/ssh/sshd_config.d \
|
|
|
|
if [ -d /etc/ssh/sshd_config.d/ ]; then
|
|
|
|
|
|
|
|
grep -E -qir "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ \
|
|
|
|
|
|
|
|
|| failed "IS_SSHALLOWUSERS" "missing AllowUsers or AllowGroups directive in sshd_config"
|
|
|
|
|| failed "IS_SSHALLOWUSERS" "missing AllowUsers or AllowGroups directive in sshd_config"
|
|
|
|
else
|
|
|
|
|
|
|
|
grep -E -qi "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config \
|
|
|
|
|
|
|
|
|| failed "IS_SSHALLOWUSERS" "missing AllowUsers or AllowGroups directive in sshd_config"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_diskperf() {
|
|
|
|
check_diskperf() {
|
|
|
@ -631,11 +596,15 @@ check_evobackup_exclude_mount() {
|
|
|
|
# then we verify that every mount is excluded
|
|
|
|
# then we verify that every mount is excluded
|
|
|
|
if ! grep -q -- "^\s*--one-file-system" "${evobackup_file}"; then
|
|
|
|
if ! grep -q -- "^\s*--one-file-system" "${evobackup_file}"; then
|
|
|
|
# old releases of evobackups don't have version
|
|
|
|
# old releases of evobackups don't have version
|
|
|
|
if grep -q "^VERSION=" "${evobackup_file}" && dpkg --compare-versions "$(sed -E -n 's/VERSION="(.*)"/\1/p' "${evobackup_file}")" ge 22.12 ; then
|
|
|
|
if grep -q "^VERSION="23.11"; then
|
|
|
|
|
|
|
|
evobackup_version=$(sed -E -n 's/VERSION="23.11")
|
|
|
|
|
|
|
|
# versions over 22.12 use a new syntax to exclude rsync files
|
|
|
|
|
|
|
|
if dpkg --compare-versions "$evobackup_version" ge 22.12 ; then
|
|
|
|
sed -En '/RSYNC_EXCLUDES="/,/"/ {s/(RSYNC_EXCLUDES=|")//g;p}' "${evobackup_file}" > "${excludes_file}"
|
|
|
|
sed -En '/RSYNC_EXCLUDES="/,/"/ {s/(RSYNC_EXCLUDES=|")//g;p}' "${evobackup_file}" > "${excludes_file}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
grep -- "--exclude " "${evobackup_file}" | grep -E -o "\"[^\"]+\"" | tr -d '"' > "${excludes_file}"
|
|
|
|
grep -- "--exclude " "${evobackup_file}" | grep -E -o "\"[^\"]+\"" | tr -d '"' > "${excludes_file}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
not_excluded=$(findmnt --type nfs,nfs4,fuse.sshfs, -o target --noheadings | grep -v -f "${excludes_file}")
|
|
|
|
not_excluded=$(findmnt --type nfs,nfs4,fuse.sshfs, -o target --noheadings | grep -v -f "${excludes_file}")
|
|
|
|
for mount in ${not_excluded}; do
|
|
|
|
for mount in ${not_excluded}; do
|
|
|
|
failed "IS_EVOBACKUP_EXCLUDE_MOUNT" "${mount} is not excluded from ${evobackup_file} backup script"
|
|
|
|
failed "IS_EVOBACKUP_EXCLUDE_MOUNT" "${mount} is not excluded from ${evobackup_file} backup script"
|
|
|
@ -688,7 +657,7 @@ check_apacheipinallow() {
|
|
|
|
check_muninapacheconf() {
|
|
|
|
check_muninapacheconf() {
|
|
|
|
muninconf="/etc/apache2/conf-available/munin.conf"
|
|
|
|
muninconf="/etc/apache2/conf-available/munin.conf"
|
|
|
|
if is_installed apache2; then
|
|
|
|
if is_installed apache2; then
|
|
|
|
test -e $muninconf && grep --invert-match --extended-regexp --quiet "^( |\t)*#" "$muninconf" \
|
|
|
|
test -e $muninconf && grep -vEq "^( |\t)*#" "$muninconf" \
|
|
|
|
&& failed "IS_MUNINAPACHECONF" "default munin configuration may be commented or disabled"
|
|
|
|
&& failed "IS_MUNINAPACHECONF" "default munin configuration may be commented or disabled"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -697,17 +666,17 @@ check_phpmyadminapacheconf() {
|
|
|
|
phpmyadminconf0="/etc/apache2/conf-available/phpmyadmin.conf"
|
|
|
|
phpmyadminconf0="/etc/apache2/conf-available/phpmyadmin.conf"
|
|
|
|
phpmyadminconf1="/etc/apache2/conf-enabled/phpmyadmin.conf"
|
|
|
|
phpmyadminconf1="/etc/apache2/conf-enabled/phpmyadmin.conf"
|
|
|
|
if is_installed apache2; then
|
|
|
|
if is_installed apache2; then
|
|
|
|
test -e $phpmyadminconf0 && grep --invert-match --extended-regexp --quiet "^( |\t)*#" "$phpmyadminconf0" \
|
|
|
|
test -e $phpmyadminconf0 && grep -vEq "^( |\t)*#" "$phpmyadminconf0" \
|
|
|
|
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf0) should be commented or disabled"
|
|
|
|
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf0) may be commented or disabled"
|
|
|
|
test -e $phpmyadminconf1 && grep --invert-match --extended-regexp --quiet "^( |\t)*#" "$phpmyadminconf1" \
|
|
|
|
test -e $phpmyadminconf1 && grep -vEq "^( |\t)*#" "$phpmyadminconf1" \
|
|
|
|
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf1) should be commented or disabled"
|
|
|
|
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf1) may be commented or disabled"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Verification si le système doit redémarrer suite mà j kernel.
|
|
|
|
# Verification si le système doit redémarrer suite mà j kernel.
|
|
|
|
check_kerneluptodate() {
|
|
|
|
check_kerneluptodate() {
|
|
|
|
if is_installed linux-image*; then
|
|
|
|
if is_installed linux-image*; then
|
|
|
|
# shellcheck disable=SC2012
|
|
|
|
# shellcheck disable=SC2012
|
|
|
|
kernel_installed_at=$(date -d "$(ls --full-time -lcrt /boot/*lin* | tail -n1 | awk '{print $6}')" +%s)
|
|
|
|
kernel_installed_at=$(date -d "$(ls --full-time -lcrt /boot | tail -n1 | awk '{print $6}')" +%s)
|
|
|
|
last_reboot_at=$(($(date +%s) - $(cut -f1 -d '.' /proc/uptime)))
|
|
|
|
last_reboot_at=$(($(date +%s) - $(cut -f1 -d '.' /proc/uptime)))
|
|
|
|
if [ "$kernel_installed_at" -gt "$last_reboot_at" ]; then
|
|
|
|
if [ "$kernel_installed_at" -gt "$last_reboot_at" ]; then
|
|
|
|
failed "IS_KERNELUPTODATE" "machine is running an outdated kernel, reboot advised"
|
|
|
|
failed "IS_KERNELUPTODATE" "machine is running an outdated kernel, reboot advised"
|
|
|
@ -776,10 +745,9 @@ check_etcgit() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_etcgit_lxc() {
|
|
|
|
check_etcgit_lxc() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
|
export GIT_DIR="/var/lib/lxc/${container}/rootfs/etc/.git"
|
|
|
|
export GIT_DIR="/var/lib/lxc/${container}/etc/.git" GIT_WORK_TREE="/var/lib/lxc/${container}/etc"
|
|
|
|
export GIT_WORK_TREE="/var/lib/lxc/${container}/rootfs/etc"
|
|
|
|
|
|
|
|
git rev-parse --is-inside-work-tree > /dev/null 2>&1 \
|
|
|
|
git rev-parse --is-inside-work-tree > /dev/null 2>&1 \
|
|
|
|
|| failed "IS_ETCGIT_LXC" "/etc is not a git repository in container ${container}"
|
|
|
|
|| failed "IS_ETCGIT_LXC" "/etc is not a git repository in container ${container}"
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -796,9 +764,9 @@ check_gitperms() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_gitperms_lxc() {
|
|
|
|
check_gitperms_lxc() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
|
GIT_DIR="/var/lib/lxc/${container}/rootfs/etc/.git"
|
|
|
|
GIT_DIR="/var/lib/lxc/${container}/etc/.git"
|
|
|
|
if test -d $GIT_DIR; then
|
|
|
|
if test -d $GIT_DIR; then
|
|
|
|
expected="700"
|
|
|
|
expected="700"
|
|
|
|
actual=$(stat -c "%a" $GIT_DIR)
|
|
|
|
actual=$(stat -c "%a" $GIT_DIR)
|
|
|
@ -914,7 +882,7 @@ check_drbd_two_primaries() {
|
|
|
|
failed "IS_DRBDTWOPRIMARIES" "Some DRBD ressources have two primaries, you risk a split brain!"
|
|
|
|
failed "IS_DRBDTWOPRIMARIES" "Some DRBD ressources have two primaries, you risk a split brain!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif command -v drbdadm >/dev/null; then
|
|
|
|
elif command -v drbdadm >/dev/null; then
|
|
|
|
if drbdadm role all 2>&1 | grep -q 'Primary/Primary'; then
|
|
|
|
if drbdadm status | grep Primary -A2 | grep peer | grep -q Primary; then
|
|
|
|
failed "IS_DRBDTWOPRIMARIES" "Some DRBD ressources have two primaries, you risk a split brain!"
|
|
|
|
failed "IS_DRBDTWOPRIMARIES" "Some DRBD ressources have two primaries, you risk a split brain!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -925,7 +893,7 @@ check_broadcomfirmware() {
|
|
|
|
if [ -x "${LSPCI_BIN}" ]; then
|
|
|
|
if [ -x "${LSPCI_BIN}" ]; then
|
|
|
|
if ${LSPCI_BIN} | grep -q 'NetXtreme II'; then
|
|
|
|
if ${LSPCI_BIN} | grep -q 'NetXtreme II'; then
|
|
|
|
{ is_installed firmware-bnx2 \
|
|
|
|
{ is_installed firmware-bnx2 \
|
|
|
|
&& apt-cache policy | grep "\bl=Debian\b" | grep --quiet -v "\b,c=non-free\b"
|
|
|
|
&& grep -q "^deb http://mirror.evolix.org/debian.* non-free" /etc/apt/sources.list;
|
|
|
|
} || failed "IS_BROADCOMFIRMWARE" "missing non-free repository"
|
|
|
|
} || failed "IS_BROADCOMFIRMWARE" "missing non-free repository"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1092,7 +1060,7 @@ check_mysqlnrpe() {
|
|
|
|
|| [ "$(stat -c %a ${nagios_file})" != "600" ]; then
|
|
|
|
|| [ "$(stat -c %a ${nagios_file})" != "600" ]; then
|
|
|
|
failed "IS_MYSQLNRPE" "${nagios_file} has wrong permissions"
|
|
|
|
failed "IS_MYSQLNRPE" "${nagios_file} has wrong permissions"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
grep -q -E "command\[check_mysql\]=.*/usr/lib/nagios/plugins/check_mysql" /etc/nagios/nrpe.d/evolix.cfg \
|
|
|
|
grep -q -F "command[check_mysql]=/usr/lib/nagios/plugins/check_mysql" /etc/nagios/nrpe.d/evolix.cfg \
|
|
|
|
|| failed "IS_MYSQLNRPE" "check_mysql is missing"
|
|
|
|
|| failed "IS_MYSQLNRPE" "check_mysql is missing"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -1153,13 +1121,6 @@ check_evolix_user() {
|
|
|
|
grep -q -E "^evolix:" /etc/passwd \
|
|
|
|
grep -q -E "^evolix:" /etc/passwd \
|
|
|
|
&& failed "IS_EVOLIX_USER" "evolix user should be deleted, used only for install"
|
|
|
|
&& failed "IS_EVOLIX_USER" "evolix user should be deleted, used only for install"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_evolix_group() {
|
|
|
|
|
|
|
|
users=$(grep ":20..:20..:" /etc/passwd | cut -d ":" -f 1)
|
|
|
|
|
|
|
|
for user in ${users}; do
|
|
|
|
|
|
|
|
grep -E "^evolix:" /etc/group | grep -q -E "\b${user}\b" \
|
|
|
|
|
|
|
|
|| failed "IS_EVOLIX_GROUP" "user \`${user}' should be in \`evolix' group"
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
check_evoacme_cron() {
|
|
|
|
check_evoacme_cron() {
|
|
|
|
if [ -f "/usr/local/sbin/evoacme" ]; then
|
|
|
|
if [ -f "/usr/local/sbin/evoacme" ]; then
|
|
|
|
# Old cron file, should be deleted
|
|
|
|
# Old cron file, should be deleted
|
|
|
@ -1240,10 +1201,16 @@ check_usrsharescripts() {
|
|
|
|
test "$expected" = "$actual" || failed "IS_USRSHARESCRIPTS" "/usr/share/scripts must be $expected"
|
|
|
|
test "$expected" = "$actual" || failed "IS_USRSHARESCRIPTS" "/usr/share/scripts must be $expected"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_sshpermitrootno() {
|
|
|
|
check_sshpermitrootno() {
|
|
|
|
# You could change the SSH port in /etc/evocheck.cf
|
|
|
|
sshd_args="-C addr=,user=,host=,laddr=,lport=0"
|
|
|
|
sshd_args="-C addr=,user=,host=,laddr=,lport=${SSH_PORT:-22}"
|
|
|
|
if is_debian_stretch; then
|
|
|
|
if is_debian_buster; then
|
|
|
|
# Noop, we'll use the default $sshd_args
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
elif is_debian_buster; then
|
|
|
|
sshd_args="${sshd_args},rdomain="
|
|
|
|
sshd_args="${sshd_args},rdomain="
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# NOTE: From Debian Bullseye 11 onward, with OpenSSH 8.1, the argument
|
|
|
|
|
|
|
|
# -T doesn't require the additional -C.
|
|
|
|
|
|
|
|
sshd_args=
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
if ! (sshd -T ${sshd_args} 2> /dev/null | grep -qi 'permitrootlogin no'); then
|
|
|
|
if ! (sshd -T ${sshd_args} 2> /dev/null | grep -qi 'permitrootlogin no'); then
|
|
|
@ -1361,7 +1328,7 @@ check_nginx_letsencrypt_uptodate() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_lxc_container_resolv_conf() {
|
|
|
|
check_lxc_container_resolv_conf() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
current_resolvers=$(grep nameserver /etc/resolv.conf | sed 's/nameserver//g' )
|
|
|
|
current_resolvers=$(grep nameserver /etc/resolv.conf | sed 's/nameserver//g' )
|
|
|
|
|
|
|
|
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
@ -1382,16 +1349,16 @@ check_lxc_container_resolv_conf() {
|
|
|
|
# Check that there are containers if lxc is installed.
|
|
|
|
# Check that there are containers if lxc is installed.
|
|
|
|
check_no_lxc_container() {
|
|
|
|
check_no_lxc_container() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
containers_count=$(lxc-ls --active | wc -l)
|
|
|
|
containers_count=$(lxc-ls | wc -l)
|
|
|
|
if [ "$containers_count" -eq 0 ]; then
|
|
|
|
if [ "$containers_count" -eq 0 ]; then
|
|
|
|
failed "IS_NO_LXC_CONTAINER" "LXC is installed but have no active container. Consider removing it."
|
|
|
|
failed "IS_NO_LXC_CONTAINER" "LXC is installed but have no container. Consider removing it."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Check that in LXC containers, phpXX-fpm services have UMask set to 0007.
|
|
|
|
# Check that in LXC containers, phpXX-fpm services have UMask set to 0007.
|
|
|
|
check_lxc_php_fpm_service_umask_set() {
|
|
|
|
check_lxc_php_fpm_service_umask_set() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
php_containers_list=$(lxc-ls --active --filter php)
|
|
|
|
php_containers_list=$(lxc-ls --filter php)
|
|
|
|
missing_umask=""
|
|
|
|
missing_umask=""
|
|
|
|
for container in $php_containers_list; do
|
|
|
|
for container in $php_containers_list; do
|
|
|
|
# Translate container name in service name
|
|
|
|
# Translate container name in service name
|
|
|
@ -1413,7 +1380,7 @@ check_lxc_php_fpm_service_umask_set() {
|
|
|
|
# Check that LXC containers have the proper Debian version.
|
|
|
|
# Check that LXC containers have the proper Debian version.
|
|
|
|
check_lxc_php_bad_debian_version() {
|
|
|
|
check_lxc_php_bad_debian_version() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
php_containers_list=$(lxc-ls --active --filter php)
|
|
|
|
php_containers_list=$(lxc-ls --filter php)
|
|
|
|
missing_umask=""
|
|
|
|
missing_umask=""
|
|
|
|
for container in $php_containers_list; do
|
|
|
|
for container in $php_containers_list; do
|
|
|
|
if [ "$container" = "php56" ]; then
|
|
|
|
if [ "$container" = "php56" ]; then
|
|
|
@ -1432,7 +1399,7 @@ check_lxc_php_bad_debian_version() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check_lxc_openssh() {
|
|
|
|
check_lxc_openssh() {
|
|
|
|
if is_installed lxc; then
|
|
|
|
if is_installed lxc; then
|
|
|
|
container_list=$(lxc-ls --active)
|
|
|
|
container_list=$(lxc-ls)
|
|
|
|
for container in $container_list; do
|
|
|
|
for container in $container_list; do
|
|
|
|
test -e /var/lib/lxc/${container}/rootfs/usr/sbin/sshd && failed "IS_LXC_OPENSSH" "openssh-server should not be installed in container ${container}"
|
|
|
|
test -e /var/lib/lxc/${container}/rootfs/usr/sbin/sshd && failed "IS_LXC_OPENSSH" "openssh-server should not be installed in container ${container}"
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -1592,7 +1559,6 @@ main() {
|
|
|
|
test "${IS_SYSLOGCONF:=1}" = 1 && check_syslogconf
|
|
|
|
test "${IS_SYSLOGCONF:=1}" = 1 && check_syslogconf
|
|
|
|
test "${IS_DEBIANSECURITY:=1}" = 1 && check_debiansecurity
|
|
|
|
test "${IS_DEBIANSECURITY:=1}" = 1 && check_debiansecurity
|
|
|
|
test "${IS_DEBIANSECURITY_LXC:=1}" = 1 && check_debiansecurity_lxc
|
|
|
|
test "${IS_DEBIANSECURITY_LXC:=1}" = 1 && check_debiansecurity_lxc
|
|
|
|
test "${IS_BACKPORTS_VERSION:=1}" = 1 && check_backports_version
|
|
|
|
|
|
|
|
test "${IS_OLDPUB:=1}" = 1 && check_oldpub
|
|
|
|
test "${IS_OLDPUB:=1}" = 1 && check_oldpub
|
|
|
|
test "${IS_OLDPUB_LXC:=1}" = 1 && check_oldpub_lxc
|
|
|
|
test "${IS_OLDPUB_LXC:=1}" = 1 && check_oldpub_lxc
|
|
|
|
test "${IS_NEWPUB:=1}" = 1 && check_newpub
|
|
|
|
test "${IS_NEWPUB:=1}" = 1 && check_newpub
|
|
|
@ -1681,7 +1647,6 @@ main() {
|
|
|
|
test "${IS_SQUIDEVOLINUXCONF:=1}" = 1 && check_squidevolinuxconf
|
|
|
|
test "${IS_SQUIDEVOLINUXCONF:=1}" = 1 && check_squidevolinuxconf
|
|
|
|
test "${IS_DUPLICATE_FS_LABEL:=1}" = 1 && check_duplicate_fs_label
|
|
|
|
test "${IS_DUPLICATE_FS_LABEL:=1}" = 1 && check_duplicate_fs_label
|
|
|
|
test "${IS_EVOLIX_USER:=1}" = 1 && check_evolix_user
|
|
|
|
test "${IS_EVOLIX_USER:=1}" = 1 && check_evolix_user
|
|
|
|
test "${IS_EVOLIX_GROUP:=1}" = 1 && check_evolix_group
|
|
|
|
|
|
|
|
test "${IS_EVOACME_CRON:=1}" = 1 && check_evoacme_cron
|
|
|
|
test "${IS_EVOACME_CRON:=1}" = 1 && check_evoacme_cron
|
|
|
|
test "${IS_EVOACME_LIVELINKS:=1}" = 1 && check_evoacme_livelinks
|
|
|
|
test "${IS_EVOACME_LIVELINKS:=1}" = 1 && check_evoacme_livelinks
|
|
|
|
test "${IS_APACHE_CONFENABLED:=1}" = 1 && check_apache_confenabled
|
|
|
|
test "${IS_APACHE_CONFENABLED:=1}" = 1 && check_apache_confenabled
|
|
|
@ -1712,7 +1677,7 @@ main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cleanup() {
|
|
|
|
cleanup() {
|
|
|
|
# Cleanup tmp files
|
|
|
|
# Cleanup tmp files
|
|
|
|
# shellcheck disable=SC2068,SC2317
|
|
|
|
# shellcheck disable=SC2086,SC2317
|
|
|
|
rm -f ${files_to_cleanup[@]}
|
|
|
|
rm -f ${files_to_cleanup[@]}
|
|
|
|
|
|
|
|
|
|
|
|
log "$PROGNAME exit."
|
|
|
|
log "$PROGNAME exit."
|
|
|
|