Compare commits
76 commits
openbsd/23
...
master
Author | SHA1 | Date | |
---|---|---|---|
27e8e870ee | |||
Jérémy Lecour | 91f0c72286 | ||
6762ced399 | |||
Jérémy Lecour | 202db682a0 | ||
25b00f6fa7 | |||
Jérémy Lecour | c4c8dd2112 | ||
5536e8f6ec | |||
d14a6d52a3 | |||
Mathieu Trossevin | fba4dc75c3 | ||
1fc94ec4f1 | |||
2df62afa21 | |||
ff5f7ec399 | |||
f64176db21 | |||
14e56cd575 | |||
27347f7342 | |||
e27bb4124b | |||
Jérémy Lecour | 7041505446 | ||
4dbb3d030d | |||
Jérémy Lecour | fb14549843 | ||
Jérémy Lecour | 1d995764a9 | ||
5402fa0dee | |||
f024f9d9e8 | |||
e80a7781c7 | |||
79a61e3046 | |||
95539ea38c | |||
77be2c3fe1 | |||
f4948b5611 | |||
ad85fd9784 | |||
668791208a | |||
f546fb97f0 | |||
be53bce0e5 | |||
f2d1f43e85 | |||
f5887eb43c | |||
59a14150db | |||
3bf5c4fcb7 | |||
5d15f373c2 | |||
5fe7a88fab | |||
ad50601931 | |||
9b1946d9a0 | |||
443c232b95 | |||
868fe9d7c0 | |||
Jérémy Lecour | 5b0a011eda | ||
081a8166cc | |||
8f58aa00ee | |||
d92a8862e8 | |||
1067bc6a27 | |||
42cbd14123 | |||
isaid | ed602d9e83 | ||
Iliane Said | b3db84a8f7 | ||
24d3f67718 | |||
Jérémy Lecour | 171924d99c | ||
Jérémy Lecour | e09e5b3e53 | ||
7c40af199b | |||
152653d773 | |||
6414a8c70e | |||
9d011b71b0 | |||
Jérémy Dubois | ad9231d9a9 | ||
Mathieu Trossevin | 442d1446b5 | ||
Mathieu Trossevin | 90c1f854cf | ||
Mathieu Trossevin | 02e2d4c5c0 | ||
Jérémy Dubois | 4008fb3128 | ||
Jérémy Dubois | 0dae32a135 | ||
ae797122ad | |||
96ea77b345 | |||
Jérémy Dubois | baf26b23c4 | ||
Jérémy Dubois | 8d22e5ea85 | ||
Jérémy Dubois | 011c62f984 | ||
da28729577 | |||
03f9a4eb15 | |||
e21c4e8233 | |||
1bb00c10bd | |||
ff92e3889e | |||
97a98c8df3 | |||
32d2a94b71 | |||
e5aa1aa323 | |||
c852fb188d |
|
@ -52,7 +52,7 @@ For Debian versions : `is_debian`, `is_debian_stretch`, `is_debian_jessie`…
|
||||||
For packs : `is_pack_web`, `is_pack_samba`.
|
For packs : `is_pack_web`, `is_pack_samba`.
|
||||||
For installed packages : `is_installed <package> [<package>]`.
|
For installed packages : `is_installed <package> [<package>]`.
|
||||||
|
|
||||||
### Extact variables
|
### Extract variables
|
||||||
|
|
||||||
It's better not to inline function calls inside tests. Instead of this :
|
It's better not to inline function calls inside tests. Instead of this :
|
||||||
|
|
||||||
|
|
118
linux/CHANGELOG
118
linux/CHANGELOG
|
@ -5,6 +5,122 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* IS_EVOLIX_GROUP: new check to verify that all Evolix users are in "evolix" group
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* IS_SYSLOGCONF: better detection
|
||||||
|
* IS_MYSQLNRPE: ajust check for monitoringctl new nagios conf
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Fix errors in some LXC checks: list only active LXC containers, add conditions to filter containers that are not in evo-standards.
|
||||||
|
* check_sshallowusers: fix unwanted sterr when /etc/ssh/sshd_condig.d does not exist.
|
||||||
|
|
||||||
|
## [24.01] 2024-01-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* IS_BACKPORTS_VERSION: check if the Backports release matches the Debian release
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* IS_BROADCOMFIRMWARE: use apt policy
|
||||||
|
* Prefer long options
|
||||||
|
* IS_POSTFIX_MYDESTINATION: use fixed string instead of escaping characters
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* IS_EVOBACKUP_EXCLUDE_MOUNT: correctly treat old versions of evobackup
|
||||||
|
* IS_DEBIANSECURITY_LXC: don’t test older than Debian 9 containers
|
||||||
|
* IS_KERNELUPTODATE: address false positive in case of kernel removal
|
||||||
|
* IS_SSHPERMITROOTNO: specify lport, avoiding failure if sshd listens to more than one port
|
||||||
|
* IS_DRBDTWOPRIMARIES: fix false positive (#151)
|
||||||
|
* IS_ETCGIT_LXC, IS_GITPERMS_LXC: fix path
|
||||||
|
|
||||||
|
## [23.11.1] 2023-11-27
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* IS_EVOBACKUP_EXCLUDE_MOUNT: fix another regression introduced in previous release
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
## [23.11] 2023-11-27
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* trixie and forky support (Debian 13, 14)
|
||||||
|
* IS_LXC_OPENSSH: check in openssh is installed in containers
|
||||||
|
* IS_LXC_PHP_BAD_DEBIAN_VERSION: check if php containers use the expected Debian release
|
||||||
|
* IS_DEBIANSECURITY_LXC: IS_DEBIANSECURITY in containers
|
||||||
|
* IS_SURY_LXC: IS_SURY in containers
|
||||||
|
* IS_OLDPUB_LXC: IS_OLDPUB in containers
|
||||||
|
* IS_ETCGIT_LXC: IS_ETCGIT in containers
|
||||||
|
* IS_GITPERMS_LXC: IS_GITPERMS in containers
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* IS_SSHALLOWUSERS: add Debian 12 condition
|
||||||
|
* IS_PHPEVOLINUXCONF: update for bookworm
|
||||||
|
* IS_MINIFWINCLUDES, IS_NRPEPID: Change Debian release detection logic
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* IS_EVOBACKUP_EXCLUDE_MOUNT: fix regression introduced in previous version
|
||||||
|
|
||||||
|
## [23.10] 2023-10-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* IS_MINIFW: better detection of minifirewall status
|
||||||
|
* IS_OLDPUB: pub.evolix.net has been supersed by pub.evolix.org since Stretch
|
||||||
|
* IS_NEWPUB: verify that the new public repository is present
|
||||||
|
* IS_DRBDTWOPRIMARIES: check there are not 2 DRBD primaries at the same time.
|
||||||
|
* IS_SURY: check that if sury is enabled, then a safeguard must be in place
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* IS_BACKPORTSCONF: does not require preferences anymore
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* IS_BINDCHROOT: fix /etc/default path for Debian >= 11 (renamed from bind9 to named)
|
||||||
|
* IS_EVOBACKUP_EXCLUDE_MOUNT: adapt to new version of evobackup (#148)
|
||||||
|
|
||||||
|
## [23.07] 2023-07-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* IS_REDIS_BACKUP: full rewrite of the check to be more flexible, and also check time of dump.
|
||||||
|
|
||||||
|
## [23.04.01] 2023-04-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* IS_POSTFIX_MYDESTINATION: fix regex not working (again).
|
||||||
|
|
||||||
|
## [23.04] 2023-04-07
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* IS_LOCALHOST_IN_POSTFIX_MYDESTINATION: renamed to IS_POSTFIX_MYDESTINATION
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* IS_POSTFIX_MYDESTINATION: fix regex not working.
|
||||||
|
|
||||||
|
## [23.03.01] 2023-03-01
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Fix version number.
|
||||||
|
|
||||||
|
## [23.03] 2023-03-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Log output and runtime config to /var/log/evocheck.log.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
@ -12,6 +128,8 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
* IS_LOCALHOST_IN_POSTFIX_MYDESTINATION: set grep quiet.
|
||||||
|
* IS_LXC_PHP_FPM_SERVICE_UMASK_SET: fix inverted test condition.
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
|
|
@ -4,7 +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
|
||||||
|
|
||||||
VERSION="23.02"
|
VERSION="24.01"
|
||||||
readonly VERSION
|
readonly VERSION
|
||||||
|
|
||||||
# base functions
|
# base functions
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
# Script to verify compliance of a Linux (Debian) server
|
# Script to verify compliance of a Linux (Debian) server
|
||||||
# powered by Evolix
|
# powered by Evolix
|
||||||
|
|
||||||
VERSION="23.02"
|
#set -x
|
||||||
|
|
||||||
|
VERSION="24.01"
|
||||||
readonly VERSION
|
readonly VERSION
|
||||||
|
|
||||||
# base functions
|
# base functions
|
||||||
|
@ -68,6 +70,8 @@ detect_os() {
|
||||||
10) DEBIAN_RELEASE="buster";;
|
10) DEBIAN_RELEASE="buster";;
|
||||||
11) DEBIAN_RELEASE="bullseye";;
|
11) DEBIAN_RELEASE="bullseye";;
|
||||||
12) DEBIAN_RELEASE="bookworm";;
|
12) DEBIAN_RELEASE="bookworm";;
|
||||||
|
13) DEBIAN_RELEASE="trixie";;
|
||||||
|
14) DEBIAN_RELEASE="forky";;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -85,6 +89,12 @@ is_debian_bullseye() {
|
||||||
is_debian_bookworm() {
|
is_debian_bookworm() {
|
||||||
test "${DEBIAN_RELEASE}" = "bookworm"
|
test "${DEBIAN_RELEASE}" = "bookworm"
|
||||||
}
|
}
|
||||||
|
is_debian_trixie() {
|
||||||
|
test "${DEBIAN_RELEASE}" = "trixie"
|
||||||
|
}
|
||||||
|
is_debian_forky() {
|
||||||
|
test "${DEBIAN_RELEASE}" = "forky"
|
||||||
|
}
|
||||||
|
|
||||||
is_pack_web(){
|
is_pack_web(){
|
||||||
test -e /usr/share/scripts/web-add.sh || test -e /usr/share/scripts/evoadmin/web-add.sh
|
test -e /usr/share/scripts/web-add.sh || test -e /usr/share/scripts/evoadmin/web-add.sh
|
||||||
|
@ -100,6 +110,17 @@ is_installed(){
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
|
|
||||||
|
log() {
|
||||||
|
date=$(/bin/date +"${DATE_FORMAT}")
|
||||||
|
if [ "${1}" != '' ]; then
|
||||||
|
printf "[%s] %s: %s\\n" "$date" "${PROGNAME}" "${1}" >> "${LOGFILE}"
|
||||||
|
else
|
||||||
|
while read line; do
|
||||||
|
printf "[%s] %s: %s\\n" "$date" "${PROGNAME}" "${line}" >> "${LOGFILE}"
|
||||||
|
done < /dev/stdin
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
failed() {
|
failed() {
|
||||||
check_name=$1
|
check_name=$1
|
||||||
shift
|
shift
|
||||||
|
@ -113,6 +134,9 @@ failed() {
|
||||||
printf "%s FAILED!\n" "${check_name}" >> "${main_output_file}"
|
printf "%s FAILED!\n" "${check_name}" >> "${main_output_file}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Always log verbose
|
||||||
|
log "${check_name} FAILED! ${check_comments}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# check functions
|
# check functions
|
||||||
|
@ -132,10 +156,16 @@ check_dpkgwarning() {
|
||||||
|| failed "IS_DPKGWARNING" "/etc/apt/apt.conf.d/z-evolinux.conf is missing"
|
|| failed "IS_DPKGWARNING" "/etc/apt/apt.conf.d/z-evolinux.conf is missing"
|
||||||
}
|
}
|
||||||
# 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_localhost_in_postfix_mydestination() {
|
check_postfix_mydestination() {
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
if ! grep mydestination /etc/postfix/main.cf | grep --extended-regexp 'localhost[^\\.]' | grep 'localhost.localdomain' | grep 'localhost.$mydomain'; then
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet --extended-regexp 'localhost([[:blank:]]|$)'; then
|
||||||
failed "IS_LOCALHOST_IN_POSTFIX_MYDESTINATION" "'localhost' and/or 'localhost.localdomain' and/or 'localhost.\$mydomain' are missing in Postfix mydestination option. Consider adding then."
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost' is missing in Postfix mydestination option."
|
||||||
|
fi
|
||||||
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet --fixed-strings 'localhost.localdomain'; then
|
||||||
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost.localdomain' is missing in Postfix mydestination option."
|
||||||
|
fi
|
||||||
|
if ! grep mydestination /etc/postfix/main.cf | grep --quiet --fixed-strings 'localhost.$mydomain'; then
|
||||||
|
failed "IS_POSTFIX_MYDESTINATION" "'localhost.\$mydomain' is missing in Postfix mydestination option."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# Verifying check_mailq in Nagios NRPE config file. (Option "-M postfix" need to be set if the MTA is Postfix)
|
# Verifying check_mailq in Nagios NRPE config file. (Option "-M postfix" need to be set if the MTA is Postfix)
|
||||||
|
@ -165,14 +195,86 @@ 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() {
|
||||||
grep -q "^# Syslog for Pack Evolix serveur" /etc/*syslog.conf \
|
# Test for modern servers
|
||||||
|| failed "IS_SYSLOGCONF" "syslog evolix config file missing"
|
if [ ! -f /etc/rsyslog.d/10-evolinux-default.conf ]; then
|
||||||
|
# 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
|
||||||
apt-cache policy | grep "\bl=Debian-Security\b" | grep "\bo=Debian\b" | grep --quiet "\bc=main\b"
|
apt-cache policy | grep "\bl=Debian-Security\b" | grep "\bo=Debian\b" | grep --quiet "\bc=main\b"
|
||||||
test $? -eq 0 || failed "IS_DEBIANSECURITY" "missing Debian-Security repository"
|
test $? -eq 0 || failed "IS_DEBIANSECURITY" "missing Debian-Security repository"
|
||||||
}
|
}
|
||||||
|
check_debiansecurity_lxc() {
|
||||||
|
if is_installed lxc; then
|
||||||
|
container_list=$(lxc-ls --active)
|
||||||
|
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"
|
||||||
|
test $? -eq 0 || failed "IS_DEBIANSECURITY_LXC" "missing Debian-Security repository in container ${container}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
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() {
|
||||||
|
# Look for enabled pub.evolix.net sources (supersed by pub.evolix.org since Stretch)
|
||||||
|
apt-cache policy | grep --quiet pub.evolix.net
|
||||||
|
test $? -eq 1 || failed "IS_OLDPUB" "Old pub.evolix.net repository is still enabled"
|
||||||
|
}
|
||||||
|
check_oldpub_lxc() {
|
||||||
|
# Look for enabled pub.evolix.net sources (supersed by pub.evolix.org since Buster as Sury safeguard)
|
||||||
|
if is_installed lxc; then
|
||||||
|
container_list=$(lxc-ls --active)
|
||||||
|
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
|
||||||
|
test $? -eq 1 || failed "IS_OLDPUB_LXC" "Old pub.evolix.net repository is still enabled in container ${container}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
check_newpub() {
|
||||||
|
# Look for enabled pub.evolix.org sources
|
||||||
|
apt-cache policy | grep "\bl=Evolix\b" | grep --quiet -v php
|
||||||
|
test $? -eq 0 || failed "IS_NEWPUB" "New pub.evolix.org repository is missing"
|
||||||
|
}
|
||||||
|
check_sury() {
|
||||||
|
# Look for enabled packages.sury.org sources
|
||||||
|
apt-cache policy | grep --quiet packages.sury.org
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
apt-cache policy | grep "\bl=Evolix\b" | grep php --quiet
|
||||||
|
test $? -eq 0 || failed "IS_SURY" "packages.sury.org is present but our safeguard pub.evolix.org repository is missing"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
check_sury_lxc() {
|
||||||
|
if is_installed lxc; then
|
||||||
|
container_list=$(lxc-ls --active)
|
||||||
|
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
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
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}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
check_aptitude() {
|
check_aptitude() {
|
||||||
test -e /usr/bin/aptitude && failed "IS_APTITUDE" "aptitude may not be installed on Debian >=8"
|
test -e /usr/bin/aptitude && failed "IS_APTITUDE" "aptitude may not be installed on Debian >=8"
|
||||||
}
|
}
|
||||||
|
@ -211,8 +313,25 @@ check_customcrontab() {
|
||||||
test "$found_lines" = 4 && failed "IS_CUSTOMCRONTAB" "missing custom field in crontab"
|
test "$found_lines" = 4 && failed "IS_CUSTOMCRONTAB" "missing custom field in crontab"
|
||||||
}
|
}
|
||||||
check_sshallowusers() {
|
check_sshallowusers() {
|
||||||
grep -E -qir "(AllowUsers|AllowGroups)" /etc/ssh/sshd_config /etc/ssh/sshd_config.d \
|
if is_debian_bookworm; then
|
||||||
|
if [ -d /etc/ssh/sshd_config.d/ ]; then
|
||||||
|
# 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/*"
|
||||||
|
fi
|
||||||
|
# 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"
|
||||||
|
else
|
||||||
|
# AllowUsers or AllowGroups should be in /etc/ssh/sshd_config or /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
|
||||||
}
|
}
|
||||||
check_diskperf() {
|
check_diskperf() {
|
||||||
perfFile="/root/disk-perf.txt"
|
perfFile="/root/disk-perf.txt"
|
||||||
|
@ -256,11 +375,20 @@ check_alert5minifw() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_minifw() {
|
check_minifw() {
|
||||||
/sbin/iptables -L -n | grep -q -E "^ACCEPT\s*all\s*--\s*31\.170\.8\.4\s*0\.0\.0\.0/0\s*$" \
|
{
|
||||||
|| failed "IS_MINIFW" "minifirewall seems not started"
|
if [ -f /etc/systemd/system/minifirewall.service ]; then
|
||||||
|
systemctl is-active minifirewall > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
if test -x /usr/share/scripts/minifirewall_status; then
|
||||||
|
/usr/share/scripts/minifirewall_status > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
/sbin/iptables -L -n 2> /dev/null | grep -q -E "^(DROP\s+(udp|17)|ACCEPT\s+(icmp|1))\s+--\s+0\.0\.0\.0\/0\s+0\.0\.0\.0\/0\s*$"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
} || failed "IS_MINIFW" "minifirewall seems not started"
|
||||||
}
|
}
|
||||||
check_minifw_includes() {
|
check_minifw_includes() {
|
||||||
if is_debian_bullseye; then
|
if { ! is_debian_stretch && ! is_debian_buster ; }; then
|
||||||
if grep -q -e '/sbin/iptables' -e '/sbin/ip6tables' "/etc/default/minifirewall"; then
|
if grep -q -e '/sbin/iptables' -e '/sbin/ip6tables' "/etc/default/minifirewall"; then
|
||||||
failed "IS_MINIFWINCLUDES" "minifirewall has direct iptables invocations in /etc/default/minifirewall that should go in /etc/minifirewall.d/"
|
failed "IS_MINIFWINCLUDES" "minifirewall has direct iptables invocations in /etc/default/minifirewall that should go in /etc/minifirewall.d/"
|
||||||
fi
|
fi
|
||||||
|
@ -287,13 +415,13 @@ check_nrpedisks() {
|
||||||
test "$NRPEDISKS" = "$DFDISKS" || failed "IS_NRPEDISKS" "there must be $DFDISKS check_disk in nrpe.cfg"
|
test "$NRPEDISKS" = "$DFDISKS" || failed "IS_NRPEDISKS" "there must be $DFDISKS check_disk in nrpe.cfg"
|
||||||
}
|
}
|
||||||
check_nrpepid() {
|
check_nrpepid() {
|
||||||
if is_debian_bullseye; then
|
if { is_debian_stretch || is_debian_buster ; }; then
|
||||||
{ test -e /etc/nagios/nrpe.cfg \
|
{ test -e /etc/nagios/nrpe.cfg \
|
||||||
&& grep -q "^pid_file=/run/nagios/nrpe.pid" /etc/nagios/nrpe.cfg;
|
&& grep -q "^pid_file=/var/run/nagios/nrpe.pid" /etc/nagios/nrpe.cfg;
|
||||||
} || failed "IS_NRPEPID" "missing or wrong pid_file directive in nrpe.cfg"
|
} || failed "IS_NRPEPID" "missing or wrong pid_file directive in nrpe.cfg"
|
||||||
else
|
else
|
||||||
{ test -e /etc/nagios/nrpe.cfg \
|
{ test -e /etc/nagios/nrpe.cfg \
|
||||||
&& grep -q "^pid_file=/var/run/nagios/nrpe.pid" /etc/nagios/nrpe.cfg;
|
&& grep -q "^pid_file=/run/nagios/nrpe.pid" /etc/nagios/nrpe.cfg;
|
||||||
} || failed "IS_NRPEPID" "missing or wrong pid_file directive in nrpe.cfg"
|
} || failed "IS_NRPEPID" "missing or wrong pid_file directive in nrpe.cfg"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -420,7 +548,11 @@ check_log2mailsquid() {
|
||||||
check_bindchroot() {
|
check_bindchroot() {
|
||||||
if is_installed bind9; then
|
if is_installed bind9; then
|
||||||
if netstat -utpln | grep "/named" | grep :53 | grep -qvE "(127.0.0.1|::1)"; then
|
if netstat -utpln | grep "/named" | grep :53 | grep -qvE "(127.0.0.1|::1)"; then
|
||||||
if grep -q '^OPTIONS=".*-t' /etc/default/bind9 && grep -q '^OPTIONS=".*-u' /etc/default/bind9; then
|
default_conf=/etc/default/named
|
||||||
|
if is_debian_buster || is_debian_stretch; then
|
||||||
|
default_conf=/etc/default/bind9
|
||||||
|
fi
|
||||||
|
if grep -q '^OPTIONS=".*-t' "${default_conf}" && grep -q '^OPTIONS=".*-u' "${default_conf}"; then
|
||||||
md5_original=$(md5sum /usr/sbin/named | cut -f 1 -d ' ')
|
md5_original=$(md5sum /usr/sbin/named | cut -f 1 -d ' ')
|
||||||
md5_chrooted=$(md5sum /var/chroot-bind/usr/sbin/named | cut -f 1 -d ' ')
|
md5_chrooted=$(md5sum /var/chroot-bind/usr/sbin/named | cut -f 1 -d ' ')
|
||||||
if [ "$md5_original" != "$md5_chrooted" ]; then
|
if [ "$md5_original" != "$md5_chrooted" ]; then
|
||||||
|
@ -498,7 +630,12 @@ check_evobackup_exclude_mount() {
|
||||||
# If rsync is not limited by "one-file-system"
|
# If rsync is not limited by "one-file-system"
|
||||||
# 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
|
||||||
|
if grep -q "^VERSION=" "${evobackup_file}" && dpkg --compare-versions "$(sed -E -n 's/VERSION="(.*)"/\1/p' "${evobackup_file}")" ge 22.12 ; then
|
||||||
|
sed -En '/RSYNC_EXCLUDES="/,/"/ {s/(RSYNC_EXCLUDES=|")//g;p}' "${evobackup_file}" > "${excludes_file}"
|
||||||
|
else
|
||||||
grep -- "--exclude " "${evobackup_file}" | grep -E -o "\"[^\"]+\"" | tr -d '"' > "${excludes_file}"
|
grep -- "--exclude " "${evobackup_file}" | grep -E -o "\"[^\"]+\"" | tr -d '"' > "${excludes_file}"
|
||||||
|
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"
|
||||||
|
@ -551,7 +688,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 -vEq "^( |\t)*#" "$muninconf" \
|
test -e $muninconf && grep --invert-match --extended-regexp --quiet "^( |\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
|
||||||
}
|
}
|
||||||
|
@ -560,17 +697,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 -vEq "^( |\t)*#" "$phpmyadminconf0" \
|
test -e $phpmyadminconf0 && grep --invert-match --extended-regexp --quiet "^( |\t)*#" "$phpmyadminconf0" \
|
||||||
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf0) may be commented or disabled"
|
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf0) should be commented or disabled"
|
||||||
test -e $phpmyadminconf1 && grep -vEq "^( |\t)*#" "$phpmyadminconf1" \
|
test -e $phpmyadminconf1 && grep --invert-match --extended-regexp --quiet "^( |\t)*#" "$phpmyadminconf1" \
|
||||||
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf1) may be commented or disabled"
|
&& failed "IS_PHPMYADMINAPACHECONF" "default phpmyadmin configuration ($phpmyadminconf1) should 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 | tail -n1 | awk '{print $6}')" +%s)
|
kernel_installed_at=$(date -d "$(ls --full-time -lcrt /boot/*lin* | 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"
|
||||||
|
@ -637,6 +774,17 @@ check_etcgit() {
|
||||||
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" "/etc is not a git repository"
|
|| failed "IS_ETCGIT" "/etc is not a git repository"
|
||||||
}
|
}
|
||||||
|
check_etcgit_lxc() {
|
||||||
|
if is_installed lxc; then
|
||||||
|
container_list=$(lxc-ls --active)
|
||||||
|
for container in $container_list; do
|
||||||
|
export GIT_DIR="/var/lib/lxc/${container}/rootfs/etc/.git"
|
||||||
|
export GIT_WORK_TREE="/var/lib/lxc/${container}/rootfs/etc"
|
||||||
|
git rev-parse --is-inside-work-tree > /dev/null 2>&1 \
|
||||||
|
|| failed "IS_ETCGIT_LXC" "/etc is not a git repository in container ${container}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
# Check if /etc/.git/ has read/write permissions for root only.
|
# Check if /etc/.git/ has read/write permissions for root only.
|
||||||
check_gitperms() {
|
check_gitperms() {
|
||||||
GIT_DIR="/etc/.git"
|
GIT_DIR="/etc/.git"
|
||||||
|
@ -646,6 +794,19 @@ check_gitperms() {
|
||||||
[ "$expected" = "$actual" ] || failed "IS_GITPERMS" "$GIT_DIR must be $expected"
|
[ "$expected" = "$actual" ] || failed "IS_GITPERMS" "$GIT_DIR must be $expected"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
check_gitperms_lxc() {
|
||||||
|
if is_installed lxc; then
|
||||||
|
container_list=$(lxc-ls --active)
|
||||||
|
for container in $container_list; do
|
||||||
|
GIT_DIR="/var/lib/lxc/${container}/rootfs/etc/.git"
|
||||||
|
if test -d $GIT_DIR; then
|
||||||
|
expected="700"
|
||||||
|
actual=$(stat -c "%a" $GIT_DIR)
|
||||||
|
[ "$expected" = "$actual" ] || failed "IS_GITPERMS_LXC" "$GIT_DIR must be $expected (in container ${container})"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
# Check if no package has been upgraded since $limit.
|
# Check if no package has been upgraded since $limit.
|
||||||
check_notupgraded() {
|
check_notupgraded() {
|
||||||
last_upgrade=0
|
last_upgrade=0
|
||||||
|
@ -733,10 +894,6 @@ check_apache2evolinuxconf() {
|
||||||
check_backportsconf() {
|
check_backportsconf() {
|
||||||
grep -qsE "^[^#].*backports" /etc/apt/sources.list \
|
grep -qsE "^[^#].*backports" /etc/apt/sources.list \
|
||||||
&& failed "IS_BACKPORTSCONF" "backports can't be in main sources list"
|
&& failed "IS_BACKPORTSCONF" "backports can't be in main sources list"
|
||||||
if grep -qsE "^[^#].*backports" /etc/apt/sources.list.d/*.list; then
|
|
||||||
grep -qsE "^[^#].*backports" /etc/apt/preferences.d/* \
|
|
||||||
|| failed "IS_BACKPORTSCONF" "backports must have preferences"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
check_bind9munin() {
|
check_bind9munin() {
|
||||||
if is_installed bind9; then
|
if is_installed bind9; then
|
||||||
|
@ -750,12 +907,25 @@ check_bind9logrotate() {
|
||||||
test -e /etc/logrotate.d/bind9 || failed "IS_BIND9LOGROTATE" "missing bind logrotate file"
|
test -e /etc/logrotate.d/bind9 || failed "IS_BIND9LOGROTATE" "missing bind logrotate file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
check_drbd_two_primaries() {
|
||||||
|
if is_installed drbd-utils; then
|
||||||
|
if command -v drbd-overview >/dev/null; then
|
||||||
|
if drbd-overview 2>&1 | grep -q "Primary/Primary"; then
|
||||||
|
failed "IS_DRBDTWOPRIMARIES" "Some DRBD ressources have two primaries, you risk a split brain!"
|
||||||
|
fi
|
||||||
|
elif command -v drbdadm >/dev/null; then
|
||||||
|
if drbdadm role all 2>&1 | grep -q 'Primary/Primary'; then
|
||||||
|
failed "IS_DRBDTWOPRIMARIES" "Some DRBD ressources have two primaries, you risk a split brain!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
check_broadcomfirmware() {
|
check_broadcomfirmware() {
|
||||||
LSPCI_BIN=$(command -v lspci)
|
LSPCI_BIN=$(command -v lspci)
|
||||||
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 \
|
||||||
&& grep -q "^deb http://mirror.evolix.org/debian.* non-free" /etc/apt/sources.list;
|
&& apt-cache policy | grep "\bl=Debian\b" | grep --quiet -v "\b,c=non-free\b"
|
||||||
} || failed "IS_BROADCOMFIRMWARE" "missing non-free repository"
|
} || failed "IS_BROADCOMFIRMWARE" "missing non-free repository"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -854,20 +1024,28 @@ check_ldap_backup() {
|
||||||
check_redis_backup() {
|
check_redis_backup() {
|
||||||
if is_installed redis-server; then
|
if is_installed redis-server; then
|
||||||
# You could change the default path in /etc/evocheck.cf
|
# You could change the default path in /etc/evocheck.cf
|
||||||
# REDIS_BACKUP_PATH may contain space-separated paths, example:
|
# REDIS_BACKUP_PATH may contain space-separated paths, for example:
|
||||||
# REDIS_BACKUP_PATH='/home/backup/redis-instance1/dump.rdb /home/backup/redis-instance2/dump.rdb'
|
# REDIS_BACKUP_PATH='/home/backup/redis-instance1/dump.rdb /home/backup/redis-instance2/dump.rdb'
|
||||||
# Old default path: /home/backup/dump.rdb
|
# Warning : this script doesn't handle spaces in file paths !
|
||||||
# New default path: /home/backup/redis/dump.rdb
|
|
||||||
if [ -z "${REDIS_BACKUP_PATH}" ]; then
|
REDIS_BACKUP_PATH="${REDIS_BACKUP_PATH:-$(find /home/backup/ -iname "*.rdb*")}"
|
||||||
if ! [ -f "/home/backup/dump.rdb" ] && ! [ -f "/home/backup/redis/dump.rdb" ]; then
|
|
||||||
failed "IS_REDIS_BACKUP" "Redis dump is missing (/home/backup/dump.rdb or /home/backup/redis/dump.rdb)."
|
# Check number of dumps
|
||||||
|
n_instances=$(pgrep 'redis-server' | wc -l)
|
||||||
|
n_dumps=$(echo $REDIS_BACKUP_PATH | wc -w)
|
||||||
|
if [ ${n_dumps} -lt ${n_instances} ]; then
|
||||||
|
failed "IS_REDIS_BACKUP" "Missing Redis dump : ${n_instances} instance(s) found versus ${n_dumps} dump(s) found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check last dump date
|
||||||
|
age_threshold=$(date +"%s" -d "now - 2 days")
|
||||||
|
for dump in ${REDIS_BACKUP_PATH}; do
|
||||||
|
last_update=$(stat -c "%Z" $dump)
|
||||||
|
if [ "${last_update}" -lt "${age_threshold}" ]; then
|
||||||
|
failed "IS_REDIS_BACKUP" "Redis dump ${dump} is older than 2 days."
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
for file in ${REDIS_BACKUP_PATH}; do
|
|
||||||
test -f "${file}" || failed "IS_REDIS_BACKUP" "Redis dump ${file} is missing."
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
check_elastic_backup() {
|
check_elastic_backup() {
|
||||||
if is_installed elasticsearch; then
|
if is_installed elasticsearch; then
|
||||||
|
@ -914,7 +1092,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 -F "command[check_mysql]=/usr/lib/nagios/plugins/check_mysql" /etc/nagios/nrpe.d/evolix.cfg \
|
grep -q -E "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
|
||||||
|
@ -923,6 +1101,7 @@ check_phpevolinuxconf() {
|
||||||
is_debian_stretch && phpVersion="7.0"
|
is_debian_stretch && phpVersion="7.0"
|
||||||
is_debian_buster && phpVersion="7.3"
|
is_debian_buster && phpVersion="7.3"
|
||||||
is_debian_bullseye && phpVersion="7.4"
|
is_debian_bullseye && phpVersion="7.4"
|
||||||
|
is_debian_bookworm && phpVersion="8.2"
|
||||||
if is_installed php; then
|
if is_installed php; then
|
||||||
{ test -f "/etc/php/${phpVersion}/cli/conf.d/z-evolinux-defaults.ini" \
|
{ test -f "/etc/php/${phpVersion}/cli/conf.d/z-evolinux-defaults.ini" \
|
||||||
&& test -f "/etc/php/${phpVersion}/cli/conf.d/zzz-evolinux-custom.ini"
|
&& test -f "/etc/php/${phpVersion}/cli/conf.d/zzz-evolinux-custom.ini"
|
||||||
|
@ -974,6 +1153,13 @@ 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
|
||||||
|
@ -1054,16 +1240,10 @@ 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() {
|
||||||
sshd_args="-C addr=,user=,host=,laddr=,lport=0"
|
# You could change the SSH port in /etc/evocheck.cf
|
||||||
if is_debian_stretch; then
|
sshd_args="-C addr=,user=,host=,laddr=,lport=${SSH_PORT:-22}"
|
||||||
# Noop, we'll use the default $sshd_args
|
if is_debian_buster; then
|
||||||
:
|
|
||||||
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
|
||||||
|
@ -1181,7 +1361,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)
|
container_list=$(lxc-ls --active)
|
||||||
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
|
||||||
|
@ -1202,16 +1382,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 | wc -l)
|
containers_count=$(lxc-ls --active | 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 container. Consider removing it."
|
failed "IS_NO_LXC_CONTAINER" "LXC is installed but have no active 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 --filter php)
|
php_containers_list=$(lxc-ls --active --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
|
||||||
|
@ -1221,7 +1401,7 @@ check_lxc_php_fpm_service_umask_set() {
|
||||||
service="${container:0:4}.${container:4}-fpm"
|
service="${container:0:4}.${container:4}-fpm"
|
||||||
fi
|
fi
|
||||||
umask=$(lxc-attach --name "${container}" -- systemctl show -p UMask "$service" | cut -d "=" -f2)
|
umask=$(lxc-attach --name "${container}" -- systemctl show -p UMask "$service" | cut -d "=" -f2)
|
||||||
if ! [ "$umask" != "0007" ]; then
|
if [ "$umask" != "0007" ]; then
|
||||||
missing_umask="${missing_umask} ${container}"
|
missing_umask="${missing_umask} ${container}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1230,6 +1410,34 @@ check_lxc_php_fpm_service_umask_set() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# Check that LXC containers have the proper Debian version.
|
||||||
|
check_lxc_php_bad_debian_version() {
|
||||||
|
if is_installed lxc; then
|
||||||
|
php_containers_list=$(lxc-ls --active --filter php)
|
||||||
|
missing_umask=""
|
||||||
|
for container in $php_containers_list; do
|
||||||
|
if [ "$container" = "php56" ]; then
|
||||||
|
grep --quiet 'VERSION_ID="8"' /var/lib/lxc/${container}/rootfs/etc/os-release || failed "IS_LXC_PHP_BAD_DEBIAN_VERSION" "Container ${container} should use Jessie"
|
||||||
|
elif [ "$container" = "php70" ]; then
|
||||||
|
grep --quiet 'VERSION_ID="9"' /var/lib/lxc/${container}/rootfs/etc/os-release || failed "IS_LXC_PHP_BAD_DEBIAN_VERSION" "Container ${container} should use Stretch"
|
||||||
|
elif [ "$container" = "php73" ]; then
|
||||||
|
grep --quiet 'VERSION_ID="10"' /var/lib/lxc/${container}/rootfs/etc/os-release || failed "IS_LXC_PHP_BAD_DEBIAN_VERSION" "Container ${container} should use Buster"
|
||||||
|
elif [ "$container" = "php74" ]; then
|
||||||
|
grep --quiet 'VERSION_ID="11"' /var/lib/lxc/${container}/rootfs/etc/os-release || failed "IS_LXC_PHP_BAD_DEBIAN_VERSION" "Container ${container} should use Bullseye"
|
||||||
|
elif [ "$container" = "php82" ]; then
|
||||||
|
grep --quiet 'VERSION_ID="12"' /var/lib/lxc/${container}/rootfs/etc/os-release || failed "IS_LXC_PHP_BAD_DEBIAN_VERSION" "Container ${container} should use Bookworm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
check_lxc_openssh() {
|
||||||
|
if is_installed lxc; then
|
||||||
|
container_list=$(lxc-ls --active)
|
||||||
|
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}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
download_versions() {
|
download_versions() {
|
||||||
local file
|
local file
|
||||||
|
@ -1375,7 +1583,7 @@ main() {
|
||||||
|
|
||||||
test "${IS_LSBRELEASE:=1}" = 1 && check_lsbrelease
|
test "${IS_LSBRELEASE:=1}" = 1 && check_lsbrelease
|
||||||
test "${IS_DPKGWARNING:=1}" = 1 && check_dpkgwarning
|
test "${IS_DPKGWARNING:=1}" = 1 && check_dpkgwarning
|
||||||
test "${IS_LOCALHOST_IN_POSTFIX_MYDESTINATION:=1}" = 1 && check_localhost_in_postfix_mydestination
|
test "${IS_POSTFIX_MYDESTINATION:=1}" = 1 && check_postfix_mydestination
|
||||||
test "${IS_NRPEPOSTFIX:=1}" = 1 && check_nrpepostfix
|
test "${IS_NRPEPOSTFIX:=1}" = 1 && check_nrpepostfix
|
||||||
test "${IS_CUSTOMSUDOERS:=1}" = 1 && check_customsudoers
|
test "${IS_CUSTOMSUDOERS:=1}" = 1 && check_customsudoers
|
||||||
test "${IS_VARTMPFS:=1}" = 1 && check_vartmpfs
|
test "${IS_VARTMPFS:=1}" = 1 && check_vartmpfs
|
||||||
|
@ -1383,6 +1591,13 @@ main() {
|
||||||
test "${IS_LOGROTATECONF:=1}" = 1 && check_logrotateconf
|
test "${IS_LOGROTATECONF:=1}" = 1 && check_logrotateconf
|
||||||
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_BACKPORTS_VERSION:=1}" = 1 && check_backports_version
|
||||||
|
test "${IS_OLDPUB:=1}" = 1 && check_oldpub
|
||||||
|
test "${IS_OLDPUB_LXC:=1}" = 1 && check_oldpub_lxc
|
||||||
|
test "${IS_NEWPUB:=1}" = 1 && check_newpub
|
||||||
|
test "${IS_SURY:=1}" = 1 && check_sury
|
||||||
|
test "${IS_SURY_LXC:=1}" = 1 && check_sury_lxc
|
||||||
test "${IS_APTITUDE:=1}" = 1 && check_aptitude
|
test "${IS_APTITUDE:=1}" = 1 && check_aptitude
|
||||||
test "${IS_APTGETBAK:=1}" = 1 && check_aptgetbak
|
test "${IS_APTGETBAK:=1}" = 1 && check_aptgetbak
|
||||||
test "${IS_USRRO:=1}" = 1 && check_usrro
|
test "${IS_USRRO:=1}" = 1 && check_usrro
|
||||||
|
@ -1435,7 +1650,9 @@ main() {
|
||||||
test "${IS_MUNINRUNNING:=1}" = 1 && check_muninrunning
|
test "${IS_MUNINRUNNING:=1}" = 1 && check_muninrunning
|
||||||
test "${IS_BACKUPUPTODATE:=1}" = 1 && check_backupuptodate
|
test "${IS_BACKUPUPTODATE:=1}" = 1 && check_backupuptodate
|
||||||
test "${IS_ETCGIT:=1}" = 1 && check_etcgit
|
test "${IS_ETCGIT:=1}" = 1 && check_etcgit
|
||||||
|
test "${IS_ETCGIT_LXC:=1}" = 1 && check_etcgit_lxc
|
||||||
test "${IS_GITPERMS:=1}" = 1 && check_gitperms
|
test "${IS_GITPERMS:=1}" = 1 && check_gitperms
|
||||||
|
test "${IS_GITPERMS_LXC:=1}" = 1 && check_gitperms_lxc
|
||||||
test "${IS_NOTUPGRADED:=1}" = 1 && check_notupgraded
|
test "${IS_NOTUPGRADED:=1}" = 1 && check_notupgraded
|
||||||
test "${IS_TUNE2FS_M5:=1}" = 1 && check_tune2fs_m5
|
test "${IS_TUNE2FS_M5:=1}" = 1 && check_tune2fs_m5
|
||||||
test "${IS_EVOLINUXSUDOGROUP:=1}" = 1 && check_evolinuxsudogroup
|
test "${IS_EVOLINUXSUDOGROUP:=1}" = 1 && check_evolinuxsudogroup
|
||||||
|
@ -1444,6 +1661,7 @@ main() {
|
||||||
test "${IS_BACKPORTSCONF:=1}" = 1 && check_backportsconf
|
test "${IS_BACKPORTSCONF:=1}" = 1 && check_backportsconf
|
||||||
test "${IS_BIND9MUNIN:=1}" = 1 && check_bind9munin
|
test "${IS_BIND9MUNIN:=1}" = 1 && check_bind9munin
|
||||||
test "${IS_BIND9LOGROTATE:=1}" = 1 && check_bind9logrotate
|
test "${IS_BIND9LOGROTATE:=1}" = 1 && check_bind9logrotate
|
||||||
|
test "${IS_DRBDTWOPRIMARIES:=1}" = 1 && check_drbd_two_primaries
|
||||||
test "${IS_BROADCOMFIRMWARE:=1}" = 1 && check_broadcomfirmware
|
test "${IS_BROADCOMFIRMWARE:=1}" = 1 && check_broadcomfirmware
|
||||||
test "${IS_HARDWARERAIDTOOL:=1}" = 1 && check_hardwareraidtool
|
test "${IS_HARDWARERAIDTOOL:=1}" = 1 && check_hardwareraidtool
|
||||||
test "${IS_LOG2MAILSYSTEMDUNIT:=1}" = 1 && check_log2mailsystemdunit
|
test "${IS_LOG2MAILSYSTEMDUNIT:=1}" = 1 && check_log2mailsystemdunit
|
||||||
|
@ -1463,6 +1681,7 @@ 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
|
||||||
|
@ -1476,6 +1695,8 @@ main() {
|
||||||
test "${IS_LXC_CONTAINER_RESOLV_CONF:=1}" = 1 && check_lxc_container_resolv_conf
|
test "${IS_LXC_CONTAINER_RESOLV_CONF:=1}" = 1 && check_lxc_container_resolv_conf
|
||||||
test "${IS_NO_LXC_CONTAINER:=1}" = 1 && check_no_lxc_container
|
test "${IS_NO_LXC_CONTAINER:=1}" = 1 && check_no_lxc_container
|
||||||
test "${IS_LXC_PHP_FPM_SERVICE_UMASK_SET:=1}" = 1 && check_lxc_php_fpm_service_umask_set
|
test "${IS_LXC_PHP_FPM_SERVICE_UMASK_SET:=1}" = 1 && check_lxc_php_fpm_service_umask_set
|
||||||
|
test "${IS_LXC_PHP_BAD_DEBIAN_VERSION:=1}" = 1 && check_lxc_php_bad_debian_version
|
||||||
|
test "${IS_LXC_OPENSSH:=1}" = 1 && check_lxc_openssh
|
||||||
test "${IS_CHECK_VERSIONS:=1}" = 1 && check_versions
|
test "${IS_CHECK_VERSIONS:=1}" = 1 && check_versions
|
||||||
|
|
||||||
if [ -f "${main_output_file}" ]; then
|
if [ -f "${main_output_file}" ]; then
|
||||||
|
@ -1489,9 +1710,12 @@ main() {
|
||||||
|
|
||||||
exit ${RC}
|
exit ${RC}
|
||||||
}
|
}
|
||||||
cleanup_temp_files() {
|
cleanup() {
|
||||||
# shellcheck disable=SC2086,SC2317
|
# Cleanup tmp files
|
||||||
|
# shellcheck disable=SC2068,SC2317
|
||||||
rm -f ${files_to_cleanup[@]}
|
rm -f ${files_to_cleanup[@]}
|
||||||
|
|
||||||
|
log "$PROGNAME exit."
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGNAME=$(basename "$0")
|
PROGNAME=$(basename "$0")
|
||||||
|
@ -1502,17 +1726,23 @@ readonly PROGNAME
|
||||||
ARGS=$@
|
ARGS=$@
|
||||||
readonly ARGS
|
readonly ARGS
|
||||||
|
|
||||||
|
LOGFILE="/var/log/evocheck.log"
|
||||||
|
readonly LOGFILE
|
||||||
|
|
||||||
|
CONFIGFILE="/etc/evocheck.cf"
|
||||||
|
readonly CONFIGFILE
|
||||||
|
|
||||||
|
DATE_FORMAT="%Y-%m-%d %H:%M:%S"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
readonly DATEFORMAT
|
||||||
|
|
||||||
# Disable LANG*
|
# Disable LANG*
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LANGUAGE=C
|
export LANGUAGE=C
|
||||||
|
|
||||||
declare -a files_to_cleanup
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap cleanup_temp_files 0
|
|
||||||
|
|
||||||
# Source configuration file
|
# Source configuration file
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
test -f /etc/evocheck.cf && . /etc/evocheck.cf
|
test -f "${CONFIGFILE}" && . "${CONFIGFILE}"
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||||
|
@ -1560,5 +1790,24 @@ while :; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Keep this after "show_version(); exit 0" which is called by check_versions
|
||||||
|
# to avoid logging exit twice.
|
||||||
|
declare -a files_to_cleanup
|
||||||
|
files_to_cleanup=""
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
|
log '-----------------------------------------------'
|
||||||
|
log "Running $PROGNAME $VERSION..."
|
||||||
|
|
||||||
|
# Log config file content
|
||||||
|
if [ -f "${CONFIGFILE}" ]; then
|
||||||
|
log "Runtime configuration (${CONFIGFILE}):"
|
||||||
|
sed -e '/^[[:blank:]]*#/d; s/#.*//; /^[[:blank:]]*$/d' "${CONFIGFILE}" | log
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
main ${ARGS}
|
main ${ARGS}
|
||||||
|
|
||||||
|
log "End of $PROGNAME execution."
|
||||||
|
|
||||||
|
|
|
@ -4,7 +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
|
||||||
|
|
||||||
VERSION="23.02"
|
VERSION="24.01"
|
||||||
readonly VERSION
|
readonly VERSION
|
||||||
|
|
||||||
# base functions
|
# base functions
|
||||||
|
|
|
@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
## [23.06] - 2023-06-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Log output and runtime config to /var/log/evocheck.log.
|
||||||
|
* check_mountfstab and check_mount: make sure all mounted partitions are in fstab and all partitions in fstab are mounted
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* check_carpadvbase and check_carppreempt: fixed indentation
|
||||||
|
* check_mount: removed useless echo
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* check_evobackup: zzz_evobackup is now executed with bash
|
||||||
|
|
||||||
## [23.02] - 2023-02-10
|
## [23.02] - 2023-02-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -17,194 +43,194 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Replaced check_sudomaint with check_doasmaint because evomaintenance is used with doas, not with sudo
|
* Replaced check_sudomaint with check_doasmaint because evomaintenance is used with doas, not with sudo
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- check_history: escape $HOME variable
|
* check_history: escape $HOME variable
|
||||||
- check_pkgmirror: fix openbsd mirror
|
* check_pkgmirror: fix openbsd mirror
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- check_wheel: wheel group mustn't be sudo because we use the evolinux-sudo group
|
* check_wheel: wheel group mustn't be sudo because we use the evolinux-sudo group
|
||||||
|
|
||||||
## [22.11] - 2022-11-28
|
## [22.11] - 2022-11-28
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- check_pkgmirror: use our own openbsd mirror
|
* check_pkgmirror: use our own openbsd mirror
|
||||||
|
|
||||||
## [22.10] - 2022-10-14
|
## [22.10] - 2022-10-14
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- check_evobackup_exclude_mount: skip if --one-file-system is used, and exclude scripts without Rsync command
|
* check_evobackup_exclude_mount: skip if --one-file-system is used, and exclude scripts without Rsync command
|
||||||
- check_backupuptodate: use find with --max-depth=1 to limit the number of evaluated files
|
* check_backupuptodate: use find with --max-depth=1 to limit the number of evaluated files
|
||||||
- check_sshpermitrootno: do not display sshd errors
|
* check_sshpermitrootno: do not display sshd errors
|
||||||
- check_ntp: comply with ntp configuration change on EvoBSD
|
* check_ntp: comply with ntp configuration change on EvoBSD
|
||||||
|
|
||||||
## [22.08] - 2022-08-04
|
## [22.08] - 2022-08-04
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed check_sshpermitrootno to check real configuration
|
* Fixed check_sshpermitrootno to check real configuration
|
||||||
|
|
||||||
## [22.06] - 2022-06-16
|
## [22.06] - 2022-06-16
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Fixed various shellcheck violations
|
* Fixed various shellcheck violations
|
||||||
- Added a function to cleanup files at once instead of using multiple trap rm
|
* Added a function to cleanup files at once instead of using multiple trap rm
|
||||||
|
|
||||||
## [22.04] - 2022-04-13
|
## [22.04] - 2022-04-13
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added check_root_user: make sure that root user does not have a password
|
* Added check_root_user: make sure that root user does not have a password
|
||||||
|
|
||||||
## [22.03] - 2022-03-10
|
## [22.03] - 2022-03-10
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- check_evomaintenanceconf: check existence and rights of evomaintenance conf file
|
* check_evomaintenanceconf: check existence and rights of evomaintenance conf file
|
||||||
- Added check_nrpeopensmtpd to ensure that opensmtpd is used for mailq nrpe check
|
* Added check_nrpeopensmtpd to ensure that opensmtpd is used for mailq nrpe check
|
||||||
- Added check_sshallowusers to ensure that AllowUsers or AllowGroups directive is present in sshd_config
|
* Added check_sshallowusers to ensure that AllowUsers or AllowGroups directive is present in sshd_config
|
||||||
- Added check_evobackup_exclude_mount to ensure that NFS mounts are excluded from backup
|
* Added check_evobackup_exclude_mount to ensure that NFS mounts are excluded from backup
|
||||||
- Added check_etcgit to ensure that /etc is a git repository
|
* Added check_etcgit to ensure that /etc is a git repository
|
||||||
- Added check_evolinuxsudogroup to ensure that evolinux-sudo is properly configured in sudo if group exist
|
* Added check_evolinuxsudogroup to ensure that evolinux-sudo is properly configured in sudo if group exist
|
||||||
- Added check_bind9munin to ensure that a plugin for bind is configured when munin is installed
|
* Added check_bind9munin to ensure that a plugin for bind is configured when munin is installed
|
||||||
- Added check_evolix_user to ensure that evolix user does not exist
|
* Added check_evolix_user to ensure that evolix user does not exist
|
||||||
- Added check_versions and its functions (download_versions, get_command, get_version, check_version, add_to_path) to ensure that custom scripts are up to date
|
* Added check_versions and its functions (download_versions, get_command, get_version, check_version, add_to_path) to ensure that custom scripts are up to date
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Overall improvement of evocheck: reordering, splitting version and help options, adding comments, developping some functions so they are more comprehensible
|
* Overall improvement of evocheck: reordering, splitting version and help options, adding comments, developping some functions so they are more comprehensible
|
||||||
- Improved check_umasksudoers to have a more complete grep
|
* Improved check_umasksudoers to have a more complete grep
|
||||||
- Updated check_history to reflect the new HISTSIZE value
|
* Updated check_history to reflect the new HISTSIZE value
|
||||||
- Renamed check_tmp1777 and check_root0700 respectively to check_tmp_1777 and check_root_0700
|
* Renamed check_tmp1777 and check_root0700 respectively to check_tmp_1777 and check_root_0700
|
||||||
- Improved check_tmp_1777, check_root_0700, check_usrsharescripts in the way the folders rights are checked
|
* Improved check_tmp_1777, check_root_0700, check_usrsharescripts in the way the folders rights are checked
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed check_uptime: it didn't work at all, and tried to get uptime in the wrong way
|
* Fixed check_uptime: it didn't work at all, and tried to get uptime in the wrong way
|
||||||
- Fixed check_evomaintenanceusers: sudo is not used for the evomaintenance trap, doas is ; and users were not found the better way
|
* Fixed check_evomaintenanceusers: sudo is not used for the evomaintenance trap, doas is ; and users were not found the better way
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Removed empty check_pfcustom
|
* Removed empty check_pfcustom
|
||||||
|
|
||||||
## [21.10] - 2021-10-07
|
## [21.10] - 2021-10-07
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed check_tmoutprofile: syntax error on if/else/fi test
|
* Fixed check_tmoutprofile: syntax error on if/else/fi test
|
||||||
|
|
||||||
## [21.09] - 2021-09-17
|
## [21.09] - 2021-09-17
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Changed version numbering to use year.month and be capable to know the age of the script
|
* Changed version numbering to use year.month and be capable to know the age of the script
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed check_tmoutprofile: Add "if" to check if file exists
|
* Fixed check_tmoutprofile: Add "if" to check if file exists
|
||||||
|
|
||||||
## [6.9.1] - 2021-07-23
|
## [6.9.1] - 2021-07-23
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Renamed check_advskew, check_preempt, check_advbase and their alert to add "carp" in them
|
* Renamed check_advskew, check_preempt, check_advbase and their alert to add "carp" in them
|
||||||
|
|
||||||
## [6.9.0] - 2021-07-16
|
## [6.9.0] - 2021-07-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_advskew: convention for CARP interfaces. CARP in master state must have advskew parameter between 1 and 50, CARP in backup state must have advskew parameter between 100 and 150, preventing a configuration error with the same value for master and backup
|
* Add check_advskew: convention for CARP interfaces. CARP in master state must have advskew parameter between 1 and 50, CARP in backup state must have advskew parameter between 100 and 150, preventing a configuration error with the same value for master and backup
|
||||||
|
|
||||||
## [6.8.0] - 2020-10-23
|
## [6.8.0] - 2020-10-23
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix check_noatime: do not take into account commented entry in fstab
|
* Fix check_noatime: do not take into account commented entry in fstab
|
||||||
|
|
||||||
## [6.7.7] - 2020-10-22
|
## [6.7.7] - 2020-10-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_openvpncronlog: a cron is needed to rotate logs, because a restart of OpenVPN would be needed with the use of newsyslog to rotate logs
|
* Add check_openvpncronlog: a cron is needed to rotate logs, because a restart of OpenVPN would be needed with the use of newsyslog to rotate logs
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix check_uptodate: properly check that syspatch exists
|
* Fix check_uptodate: properly check that syspatch exists
|
||||||
- Fix check_raidok: the same device could be displayed multiple times
|
* Fix check_raidok: the same device could be displayed multiple times
|
||||||
|
|
||||||
## [6.7.6] - 2020-10-15
|
## [6.7.6] - 2020-10-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_noatime - Check that all ffs partitions are mounted with the noatime option
|
* Add check_noatime - Check that all ffs partitions are mounted with the noatime option
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix check_softdep - We now check the number of ffs partitions and we compare it to the number of softdep options currently there
|
* Fix check_softdep - We now check the number of ffs partitions and we compare it to the number of softdep options currently there
|
||||||
|
|
||||||
## [6.7.5] - 2020-10-09
|
## [6.7.5] - 2020-10-09
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix check_cronpath - Do not check PATH=XXX but only XXX because XXX can also be in quotes (PATH="XXX" would not be matched)
|
* Fix check_cronpath - Do not check PATH=XXX but only XXX because XXX can also be in quotes (PATH="XXX" would not be matched)
|
||||||
|
|
||||||
## [6.7.4] - 2020-08-04
|
## [6.7.4] - 2020-08-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_backupuptodate - Check that /home/backup is not older than 2 days
|
* Add check_backupuptodate - Check that /home/backup is not older than 2 days
|
||||||
|
|
||||||
## [6.7.3] - 2020-07-23
|
## [6.7.3] - 2020-07-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_ntp - Check the ntpd configuration
|
* Add check_ntp - Check the ntpd configuration
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix check_defaultroute - We need to check if the /etc/mygate file exists before comparing it
|
* Fix check_defaultroute - We need to check if the /etc/mygate file exists before comparing it
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Removed check_postgresql - Deprecated since we now use an API
|
* Removed check_postgresql - Deprecated since we now use an API
|
||||||
|
|
||||||
## [6.7.2] - 2020-07-22
|
## [6.7.2] - 2020-07-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_defaultroute function - Make sure the default route in /etc/mygate file is the same that the one currently used
|
* Add check_defaultroute function - Make sure the default route in /etc/mygate file is the same that the one currently used
|
||||||
|
|
||||||
## [6.7.1] - 2020-07-15
|
## [6.7.1] - 2020-07-15
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix check_customsyslog - We have to check whether EvoBSD is present in newsyslog.conf file
|
* Fix check_customsyslog - We have to check whether EvoBSD is present in newsyslog.conf file
|
||||||
- Fix check_sudomaint function - ADMIN group does not exist anymore, we now check that the wheel group has NOPASSWD to run the evomaintenance command alias
|
* Fix check_sudomaint function - ADMIN group does not exist anymore, we now check that the wheel group has NOPASSWD to run the evomaintenance command alias
|
||||||
- Fix check_advbase - We want the evocheck advbase function output to be uniq
|
* Fix check_advbase - We want the evocheck advbase function output to be uniq
|
||||||
|
|
||||||
## [6.6.2] - 2020-04-27
|
## [6.6.2] - 2020-04-27
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add check_sync function - If a server is a Carp member we check whether the sync.sh script is present or not
|
* Add check_sync function - If a server is a Carp member we check whether the sync.sh script is present or not
|
||||||
- Add check_pfenabled function - We make sure PF is enabled
|
* Add check_pfenabled function - We make sure PF is enabled
|
||||||
- Add check_uptodate function - Use syspatch(8) to check if security updates are available
|
* Add check_uptodate function - Use syspatch(8) to check if security updates are available
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Remove check_oldhomedir - This information is irrelevant since we always keep home directories of former sysadmins
|
* Remove check_oldhomedir - This information is irrelevant since we always keep home directories of former sysadmins
|
||||||
- Now use a version-naming scheme based on OpenBSD's one
|
* Now use a version-naming scheme based on OpenBSD's one
|
||||||
|
|
||||||
## [6.6.1] - 2020-04-21
|
## [6.6.1] - 2020-04-21
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Rewrite if statements to functions
|
* Rewrite if statements to functions
|
||||||
- Add a main function
|
* Add a main function
|
||||||
- New help message
|
* New help message
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# EvoCheck
|
# EvoCheck
|
||||||
# Script to verify compliance of an OpenBSD server powered by Evolix
|
# Script to verify compliance of an OpenBSD server powered by Evolix
|
||||||
|
|
||||||
readonly VERSION="22.12"
|
readonly VERSION="23.06"
|
||||||
|
|
||||||
# base functions
|
# base functions
|
||||||
|
|
||||||
|
@ -51,6 +51,17 @@ is_installed(){
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
|
|
||||||
|
log() {
|
||||||
|
date=$(/bin/date +"${DATE_FORMAT}")
|
||||||
|
if [ "${1}" != '' ]; then
|
||||||
|
printf "[%s] %s: %s\\n" "$date" "${PROGNAME}" "${1}" >> "${LOGFILE}"
|
||||||
|
else
|
||||||
|
while read line; do
|
||||||
|
printf "[%s] %s: %s\\n" "$date" "${PROGNAME}" "${line}" >> "${LOGFILE}"
|
||||||
|
done < /dev/stdin
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
failed() {
|
failed() {
|
||||||
check_name=$1
|
check_name=$1
|
||||||
shift
|
shift
|
||||||
|
@ -64,6 +75,9 @@ failed() {
|
||||||
printf "%s FAILED!\n" "${check_name}" 2>&1
|
printf "%s FAILED!\n" "${check_name}" 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Always log verbose
|
||||||
|
log "${check_name} FAILED! ${check_comments}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# check functions
|
# check functions
|
||||||
|
@ -104,9 +118,9 @@ check_raidok(){
|
||||||
}
|
}
|
||||||
check_evobackup(){
|
check_evobackup(){
|
||||||
if [ -f /etc/daily.local ]; then
|
if [ -f /etc/daily.local ]; then
|
||||||
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"
|
grep -qE "^(ba)?sh /usr/share/scripts/zzz_evobackup" /etc/daily.local || failed "IS_EVOBACKUP" "Make sure 'bash or sh /usr/share/scripts/zzz_evobackup' is present and activated in /etc/daily.local"
|
||||||
else
|
else
|
||||||
failed "IS_EVOBACKUP" "Make sure /etc/daily.local exists and 'sh /usr/share/scripts/zzz_evobackup' is present and activated in /etc/daily.local"
|
failed "IS_EVOBACKUP" "Make sure /etc/daily.local exists and 'bash or sh /usr/share/scripts/zzz_evobackup' is present and activated in /etc/daily.local"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_uptodate(){
|
check_uptodate(){
|
||||||
|
@ -512,6 +526,17 @@ check_root_user() {
|
||||||
failed "IS_ROOT_USER" "root user should not have a password ; replace the password field with 'vipw' for the root user with '*************' (exactly 13 asterisks) "
|
failed "IS_ROOT_USER" "root user should not have a password ; replace the password field with 'vipw' for the root user with '*************' (exactly 13 asterisks) "
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
check_mount(){
|
||||||
|
for fstab_entry in $(grep ffs /etc/fstab | grep -v "^#" | awk '{print $2}'); do
|
||||||
|
mount | awk '{print $3}' | grep -q "^$fstab_entry$" || failed "IS_MOUNT" "Local OpenBSD partition(s) detected in /etc/fstab but not mounted"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
check_mountfstab() {
|
||||||
|
for mount_point in $(mount | awk '{print $3}'); do
|
||||||
|
grep -q " $mount_point " /etc/fstab || failed "IS_MOUNT_FSTAB" "Partition(s) detected mounted but no presence in /etc/fstab"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# Default return code : 0 = no error
|
# Default return code : 0 = no error
|
||||||
|
@ -561,24 +586,34 @@ main() {
|
||||||
test "${IS_EVOLIX_USER:=1}" = 1 && check_evolix_user
|
test "${IS_EVOLIX_USER:=1}" = 1 && check_evolix_user
|
||||||
test "${IS_CHECK_VERSIONS:=1}" = 1 && check_versions
|
test "${IS_CHECK_VERSIONS:=1}" = 1 && check_versions
|
||||||
test "${IS_ROOT_USER:=1}" = 1 && check_root_user
|
test "${IS_ROOT_USER:=1}" = 1 && check_root_user
|
||||||
|
test "${IS_MOUNT:=1}" = 1 && check_mount
|
||||||
|
test "${IS_MOUNT_FSTAB:=1}" = 1 && check_mountfstab
|
||||||
|
|
||||||
exit ${RC}
|
exit ${RC}
|
||||||
}
|
}
|
||||||
cleanup_temp_files() {
|
cleanup() {
|
||||||
|
# Cleanup tmp files
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
rm -f ${files_to_cleanup}
|
rm -f ${files_to_cleanup}
|
||||||
|
|
||||||
|
log "$PROGNAME exit."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROGNAME=$(basename "$0")
|
||||||
|
|
||||||
|
LOGFILE="/var/log/evocheck.log"
|
||||||
|
|
||||||
|
CONFIGFILE="/etc/evocheck.cf"
|
||||||
|
|
||||||
|
DATE_FORMAT="%Y-%m-%d %H:%M:%S"
|
||||||
|
|
||||||
# Disable LANG*
|
# Disable LANG*
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LANGUAGE=C
|
export LANGUAGE=C
|
||||||
|
|
||||||
files_to_cleanup=""
|
|
||||||
trap cleanup_temp_files 0
|
|
||||||
|
|
||||||
# Source configuration file
|
# Source configuration file
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
test -f /etc/evocheck.cf && . /etc/evocheck.cf
|
test -f "${CONFIGFILE}" && . "${CONFIGFILE}"
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||||
|
@ -621,5 +656,25 @@ while :; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Keep this after "show_version(); exit 0" which is called by check_versions
|
||||||
|
# to avoid logging exit twice.
|
||||||
|
files_to_cleanup=""
|
||||||
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
|
log '-----------------------------------------------'
|
||||||
|
log "Running $PROGNAME $VERSION..."
|
||||||
|
|
||||||
|
# Log config file content
|
||||||
|
if [ -f "${CONFIGFILE}" ]; then
|
||||||
|
log "Runtime configuration (${CONFIGFILE}):"
|
||||||
|
conf=$(sed -e '/^[[:blank:]]*#/d; s/#.*//; /^[[:blank:]]*$/d' "${CONFIGFILE}")
|
||||||
|
if [ ! -z "${conf}" ]; then
|
||||||
|
sed -e '/^[[:blank:]]*#/d; s/#.*//; /^[[:blank:]]*$/d' "${CONFIGFILE}" | log
|
||||||
|
else
|
||||||
|
log "${CONFIGFILE} is empty."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
main ${ARGS}
|
main ${ARGS}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue