2021-02-23 19:03:01 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2022-05-15 21:37:21 +00:00
|
|
|
function _apply_fixes
|
2021-02-23 19:03:01 +00:00
|
|
|
{
|
2022-03-21 06:07:52 +00:00
|
|
|
_log 'info' 'Post-configuration checks'
|
2021-02-23 19:03:01 +00:00
|
|
|
for FUNC in "${FUNCS_FIX[@]}"
|
|
|
|
do
|
2021-09-23 17:49:07 +00:00
|
|
|
${FUNC}
|
2021-02-23 19:03:01 +00:00
|
|
|
done
|
|
|
|
|
2022-03-21 06:07:52 +00:00
|
|
|
_log 'trace' '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
|
|
|
|
{
|
2022-03-21 06:07:52 +00:00
|
|
|
_log 'debug' 'Checking /var/mail permissions'
|
2021-02-23 19:03:01 +00:00
|
|
|
|
2022-06-07 22:09:19 +00:00
|
|
|
_chown_var_mail_if_necessary || _shutdown 'Failed to fix /var/mail permissions'
|
|
|
|
_log 'trace' 'Permissions in /var/mail look OK'
|
2021-02-23 19:03:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-03-21 06:07:52 +00:00
|
|
|
_log 'trace' 'Fixing Amavis permissions'
|
2021-09-23 17:49:07 +00:00
|
|
|
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
|
|
|
|
{
|
2022-03-21 06:07:52 +00:00
|
|
|
_log 'trace' 'Cleaning up disabled ClamAV'
|
2022-01-07 23:25:09 +00:00
|
|
|
rm /etc/logrotate.d/clamav-* /etc/cron.d/clamav-freshclam 2>/dev/null || {
|
2022-03-21 06:07:52 +00:00
|
|
|
# show warning only on first container start
|
|
|
|
[[ ! -f /CONTAINER_START ]] && _log 'warn' 'Failed to remove ClamAV configuration'
|
2022-01-07 23:25:09 +00:00
|
|
|
}
|
2021-02-23 19:03:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function _fix_cleanup_spamassassin
|
|
|
|
{
|
2022-03-21 06:07:52 +00:00
|
|
|
_log 'trace' 'Cleaning up disabled SpamAssassin'
|
2022-01-07 23:25:09 +00:00
|
|
|
rm /etc/cron.daily/spamassassin 2>/dev/null || {
|
2022-03-21 06:07:52 +00:00
|
|
|
# show warning only on first container start
|
|
|
|
[[ ! -f /CONTAINER_START ]] && _log 'warn' 'Failed to remove SpamAssassin configuration'
|
2022-01-07 23:25:09 +00:00
|
|
|
}
|
2021-02-23 19:03:01 +00:00
|
|
|
}
|