Explorar el Código

Remove ip addresses from email logs

Bob Mottram hace 7 años
padre
commit
e803b6b130
Se han modificado 3 ficheros con 24 adiciones y 0 borrados
  1. 20
    0
      src/freedombone-base-email
  2. 1
    0
      src/freedombone-upgrade
  3. 3
    0
      src/freedombone-utils-setup

+ 20
- 0
src/freedombone-base-email Ver fichero

@@ -1694,4 +1694,24 @@ function install_email {
1694 1694
     mark_completed "${FUNCNAME[0]}"
1695 1695
 }
1696 1696
 
1697
+function remove_ip_addresses_from_email_logs {
1698
+    { echo '#!/bin/bash';
1699
+      echo 'if [ -f /var/log/exim4/mainlog ]; then';
1700
+      echo "    if grep -q '\\[' /var/log/exim4/mainlog; then";
1701
+      echo "        tail -n 50 /var/log/exim4/mainlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_mainlog";
1702
+      echo '        chown Debian-exim:adm /tmp/.exim4_mainlog';
1703
+      echo '        mv /tmp/.exim4_mainlog /var/log/exim4/mainlog';
1704
+      echo '    fi';
1705
+      echo 'fi';
1706
+      echo 'if [ -f /var/log/exim4/rejectlog ]; then';
1707
+      echo "    if grep -q '\\[' /var/log/exim4/rejectlog; then";
1708
+      echo "        tail -n 50 /var/log/exim4/rejectlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_rejectlog";
1709
+      echo '        chown Debian-exim:adm /tmp/.exim4_rejectlog';
1710
+      echo '        mv /tmp/.exim4_rejectlog /var/log/exim4/rejectlog';
1711
+      echo '    fi';
1712
+      echo 'fi'; } > /usr/bin/exim_log_tidy
1713
+    chown +x /usr/bin/exim_log_tidy
1714
+    cron_add_mins 1 '/usr/bin/exim_log_tidy'
1715
+}
1716
+
1697 1717
 # NOTE: deliberately no exit 0

+ 1
- 0
src/freedombone-upgrade Ver fichero

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

+ 3
- 0
src/freedombone-utils-setup Ver fichero

@@ -1096,6 +1096,9 @@ function setup_email {
1096 1096
     function_check install_email
1097 1097
     install_email
1098 1098
 
1099
+    function_check remove_ip_addresses_from_email_logs
1100
+    remove_ip_addresses_from_email_logs
1101
+
1099 1102
     function_check create_procmail
1100 1103
     create_procmail
1101 1104