2021-02-23 19:03:01 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
function fix
|
|
|
|
{
|
|
|
|
_notify 'tasklog' 'Post-configuration checks'
|
|
|
|
for FUNC in "${FUNCS_FIX[@]}"
|
|
|
|
do
|
2021-09-23 17:49:07 +00:00
|
|
|
${FUNC}
|
2021-02-23 19:03:01 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
_notify 'inf' 'Removing leftover PID files from a stop/start'
|
2021-06-19 12:01:38 +00:00
|
|
|
find /var/run/ -not -name 'supervisord.pid' -name '*.pid' -delete
|
2021-02-23 19:03:01 +00:00
|
|
|
touch /dev/shm/supervisor.sock
|
|
|
|
}
|
|
|
|
|
|
|
|
function _fix_var_mail_permissions
|
|
|
|
{
|
|
|
|
_notify 'task' 'Checking /var/mail permissions'
|
|
|
|
|
|
|
|
# fix permissions, but skip this if 3 levels deep the user id is already set
|
|
|
|
if find /var/mail -maxdepth 3 -a \( \! -user 5000 -o \! -group 5000 \) | read -r
|
|
|
|
then
|
|
|
|
_notify 'inf' 'Fixing /var/mail permissions'
|
2021-09-23 17:49:07 +00:00
|
|
|
chown -R 5000:5000 /var/mail || _shutdown 'Failed to fix /var/mail permissions'
|
2021-02-23 19:03:01 +00:00
|
|
|
else
|
|
|
|
_notify 'inf' 'Permissions in /var/mail look OK'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function _fix_var_amavis_permissions
|
|
|
|
{
|
|
|
|
local AMAVIS_STATE_DIR='/var/mail-state/lib-amavis'
|
|
|
|
[[ ${ONE_DIR} -eq 0 ]] && AMAVIS_STATE_DIR="/var/lib/amavis"
|
|
|
|
[[ ! -e ${AMAVIS_STATE_DIR} ]] && return 0
|
|
|
|
|
2021-09-23 17:49:07 +00:00
|
|
|
_notify 'inf' 'Fixing Amavis permissions'
|
|
|
|
chown -hR amavis:amavis "${AMAVIS_STATE_DIR}" || _shutdown 'Failed to fix Amavis permissions'
|
2021-02-23 19:03:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function _fix_cleanup_clamav
|
|
|
|
{
|
2021-09-23 17:49:07 +00:00
|
|
|
_notify 'task' 'Cleaning up disabled ClamAV'
|
2021-10-03 12:48:43 +00:00
|
|
|
rm /etc/logrotate.d/clamav-* /etc/cron.d/clamav-freshclam || _notify 'err' 'Failed to remove ClamAV configuration'
|
2021-02-23 19:03:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function _fix_cleanup_spamassassin
|
|
|
|
{
|
2021-03-28 20:07:52 +00:00
|
|
|
_notify 'task' 'Cleaning up disabled SpamAssassin'
|
2021-10-03 12:48:43 +00:00
|
|
|
rm /etc/cron.daily/spamassassin || _notify 'err' 'Failed to remove SpamAssassin configuration'
|
2021-02-23 19:03:01 +00:00
|
|
|
}
|