2021-04-11 10:14:41 +00:00
|
|
|
source /etc/mailinabox.conf
|
|
|
|
source setup/functions.sh
|
|
|
|
|
2021-04-21 20:42:10 +00:00
|
|
|
# Add additional packages
|
2021-04-29 21:03:09 +00:00
|
|
|
apt_install pflogsumm rkhunter chkrootkit
|
2021-04-21 20:42:10 +00:00
|
|
|
|
2021-04-11 10:14:41 +00:00
|
|
|
# Cleanup old spam and trash email
|
2021-04-17 21:00:14 +00:00
|
|
|
hide_output install -m 755 conf/cron/miab_clean_mail /etc/cron.weekly/
|
2021-04-11 10:14:41 +00:00
|
|
|
|
|
|
|
# Reduce logs by not logging mail output in syslog
|
|
|
|
sed -i "s/\*\.\*;auth,authpriv.none.*\-\/var\/log\/syslog/\*\.\*;mail,auth,authpriv.none \-\/var\/log\/syslog/g" /etc/rsyslog.d/50-default.conf
|
|
|
|
|
|
|
|
# Reduce logs by only logging ufw in ufw.log
|
|
|
|
sed -i "s/#\& stop/\& stop/g" /etc/rsyslog.d/20-ufw.conf
|
|
|
|
|
|
|
|
restart_service rsyslog
|
|
|
|
|
|
|
|
# decrease time journal is stored
|
|
|
|
tools/editconf.py /etc/systemd/journald.conf MaxRetentionSec=2month
|
|
|
|
tools/editconf.py /etc/systemd/journald.conf MaxFileSec=1week
|
|
|
|
|
|
|
|
hide_output systemctl restart systemd-journald.service
|
2021-04-26 19:46:07 +00:00
|
|
|
|
|
|
|
# Create forward for root emails
|
|
|
|
cat > /root/.forward << EOF;
|
|
|
|
administrator@$PRIMARY_HOSTNAME
|
2021-04-28 07:23:27 +00:00
|
|
|
EOF
|
2021-04-29 21:03:09 +00:00
|
|
|
|
|
|
|
# Install fake mail script
|
|
|
|
if [ ! -f /usr/local/bin/mail ]; then
|
|
|
|
hide_output install -m 755 tools/fake_mail /usr/local/bin
|
|
|
|
mv -f /usr/local/bin/fake_mail /usr/local/bin/mail
|
|
|
|
fi
|
|
|
|
|
|
|
|
tools/editconf.py /etc/rkhunter.conf \
|
|
|
|
UPDATE_MIRRORS=1 \
|
|
|
|
MIRRORS_MODE=0 \
|
|
|
|
WEB_CMD='""' \
|
|
|
|
ALLOWHIDDENDIR=/etc/.java
|
|
|
|
|
2021-04-30 20:37:03 +00:00
|
|
|
# Check presence of whitelist
|
2021-04-30 20:15:06 +00:00
|
|
|
if ! grep -Fxq "SCRIPTWHITELIST=/usr/local/bin/mail" /etc/rkhunter.conf > /dev/null; then
|
|
|
|
echo "SCRIPTWHITELIST=/usr/local/bin/mail" >> /etc/rkhunter.conf
|
|
|
|
fi
|
|
|
|
|
2021-04-29 21:03:09 +00:00
|
|
|
tools/editconf.py /etc/default/rkhunter \
|
|
|
|
CRON_DAILY_RUN='"true"' \
|
|
|
|
CRON_DB_UPDATE='"true"' \
|
|
|
|
APT_AUTOGEN='"true"'
|
|
|
|
|
2021-05-01 21:36:51 +00:00
|
|
|
hide_output install -m 644 conf/chkrootkit.ignore /etc/
|
|
|
|
|
2021-04-29 21:03:09 +00:00
|
|
|
tools/editconf.py /etc/chkrootkit.conf \
|
2021-04-30 20:15:06 +00:00
|
|
|
RUN_DAILY='"true"' \
|
2021-05-01 21:36:51 +00:00
|
|
|
DIFF_MODE='"true"' \
|
|
|
|
IGNORE_FILE="/etc/chkrootkit.ignore"
|
2021-04-29 21:03:09 +00:00
|
|
|
|
2021-04-30 20:15:06 +00:00
|
|
|
# Should be last, update expected output
|
2021-04-29 21:03:09 +00:00
|
|
|
rkhunter --propupd
|
2021-05-01 21:36:51 +00:00
|
|
|
chkrootkit -q | egrep -v -f /etc/chkrootkit.ignore > /var/log/chkrootkit/log.expected
|