Remove ip addresses from email logs

This commit is contained in:
Bob Mottram 2018-05-23 17:51:07 +01:00
parent 45c117a7a2
commit e803b6b130
3 changed files with 24 additions and 0 deletions

View File

@ -1694,4 +1694,24 @@ function install_email {
mark_completed "${FUNCNAME[0]}"
}
function remove_ip_addresses_from_email_logs {
{ echo '#!/bin/bash';
echo 'if [ -f /var/log/exim4/mainlog ]; then';
echo " if grep -q '\\[' /var/log/exim4/mainlog; then";
echo " tail -n 50 /var/log/exim4/mainlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_mainlog";
echo ' chown Debian-exim:adm /tmp/.exim4_mainlog';
echo ' mv /tmp/.exim4_mainlog /var/log/exim4/mainlog';
echo ' fi';
echo 'fi';
echo 'if [ -f /var/log/exim4/rejectlog ]; then';
echo " if grep -q '\\[' /var/log/exim4/rejectlog; then";
echo " tail -n 50 /var/log/exim4/rejectlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_rejectlog";
echo ' chown Debian-exim:adm /tmp/.exim4_rejectlog';
echo ' mv /tmp/.exim4_rejectlog /var/log/exim4/rejectlog';
echo ' fi';
echo 'fi'; } > /usr/bin/exim_log_tidy
chown +x /usr/bin/exim_log_tidy
cron_add_mins 1 '/usr/bin/exim_log_tidy'
}
# NOTE: deliberately no exit 0

View File

@ -107,6 +107,7 @@ if [ -d "$PROJECT_DIR" ]; then
apt-get -yq -t stretch-backports install certbot
email_install_tls
email_disable_chunking
remove_ip_addresses_from_email_logs
rm /etc/exim4/exim4.conf.template.bak*
email_update_onion_domain
prevent_mail_process_overrun

View File

@ -1096,6 +1096,9 @@ function setup_email {
function_check install_email
install_email
function_check remove_ip_addresses_from_email_logs
remove_ip_addresses_from_email_logs
function_check create_procmail
create_procmail