From 032afdba520482843eafc5b283079295930cbda8 Mon Sep 17 00:00:00 2001 From: Chris Blankenship Date: Tue, 26 Apr 2016 10:49:25 -0700 Subject: [PATCH 1/5] Configured Dovecot to log into its own logfile --- setup/mail-dovecot.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/setup/mail-dovecot.sh b/setup/mail-dovecot.sh index e4fbf16f..13195a19 100755 --- a/setup/mail-dovecot.sh +++ b/setup/mail-dovecot.sh @@ -38,7 +38,26 @@ apt_install \ # would be 20 users). Set it to 250 times the number of cores this # machine has, so on a two-core machine that's 500 processes/100 users). tools/editconf.py /etc/dovecot/conf.d/10-master.conf \ - default_process_limit=$(echo "`nproc` * 250" | bc) + default_process_limit=$(echo "`nproc` * 250" | bc) \ + log_path = /var/log/dovecot.log + +# Add logrotate entry for dovecot +cat > /etc/dovecot/conf.d/90-plugin-fts.conf << EOF; +/var/log/dovecot*.log { + missingok + notifempty + delaycompress + sharedscripts + postrotate + doveadm log reopen + endscript +} +EOF + +# Create base log files and set permissions +touch /var/log/dovecot.log +chown syslog:adm /var/log/dovecot.log +chmod 640 /var/log/dovecot.log # The inotify `max_user_instances` default is 128, which constrains # the total number of watched (IMAP IDLE push) folders by open connections. From f3069618852556b931e49d59617ad4cdd3e9579c Mon Sep 17 00:00:00 2001 From: Chris Blankenship Date: Tue, 26 Apr 2016 12:47:55 -0700 Subject: [PATCH 2/5] Corrected logrotate path --- setup/mail-dovecot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/mail-dovecot.sh b/setup/mail-dovecot.sh index 13195a19..98da6d83 100755 --- a/setup/mail-dovecot.sh +++ b/setup/mail-dovecot.sh @@ -42,7 +42,7 @@ tools/editconf.py /etc/dovecot/conf.d/10-master.conf \ log_path = /var/log/dovecot.log # Add logrotate entry for dovecot -cat > /etc/dovecot/conf.d/90-plugin-fts.conf << EOF; +cat > /etc/logrotate.d/dovecot << EOF; /var/log/dovecot*.log { missingok notifempty From 13ffb7e020526b8740caa226eb6489af8a700cd1 Mon Sep 17 00:00:00 2001 From: Chris Blankenship Date: Fri, 6 May 2016 09:44:11 -0700 Subject: [PATCH 3/5] Changed logging from dovecot.log to mail.log --- setup/mail-dovecot.sh | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/setup/mail-dovecot.sh b/setup/mail-dovecot.sh index 98da6d83..040b00a2 100755 --- a/setup/mail-dovecot.sh +++ b/setup/mail-dovecot.sh @@ -39,25 +39,7 @@ apt_install \ # machine has, so on a two-core machine that's 500 processes/100 users). tools/editconf.py /etc/dovecot/conf.d/10-master.conf \ default_process_limit=$(echo "`nproc` * 250" | bc) \ - log_path = /var/log/dovecot.log - -# Add logrotate entry for dovecot -cat > /etc/logrotate.d/dovecot << EOF; -/var/log/dovecot*.log { - missingok - notifempty - delaycompress - sharedscripts - postrotate - doveadm log reopen - endscript -} -EOF - -# Create base log files and set permissions -touch /var/log/dovecot.log -chown syslog:adm /var/log/dovecot.log -chmod 640 /var/log/dovecot.log + log_path = /var/log/mail.log # The inotify `max_user_instances` default is 128, which constrains # the total number of watched (IMAP IDLE push) folders by open connections. From 829390a296e740acf4fb2316e3f613edcb5ad777 Mon Sep 17 00:00:00 2001 From: Chris Blankenship Date: Fri, 6 May 2016 09:45:47 -0700 Subject: [PATCH 4/5] Corrected syntax error --- setup/mail-dovecot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/mail-dovecot.sh b/setup/mail-dovecot.sh index 040b00a2..2c5533ec 100755 --- a/setup/mail-dovecot.sh +++ b/setup/mail-dovecot.sh @@ -39,7 +39,7 @@ apt_install \ # machine has, so on a two-core machine that's 500 processes/100 users). tools/editconf.py /etc/dovecot/conf.d/10-master.conf \ default_process_limit=$(echo "`nproc` * 250" | bc) \ - log_path = /var/log/mail.log + log_path=/var/log/mail.log # The inotify `max_user_instances` default is 128, which constrains # the total number of watched (IMAP IDLE push) folders by open connections. From 7362b2cbc46df8dd89544ae241c3ae8aae019820 Mon Sep 17 00:00:00 2001 From: Chris Blankenship Date: Fri, 6 May 2016 15:20:35 -0700 Subject: [PATCH 5/5] Added log file path for Fail2Ban to properly pick up new Dovecot log file path --- conf/fail2ban/jail.local | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/fail2ban/jail.local b/conf/fail2ban/jail.local index cc741c80..dc338803 100644 --- a/conf/fail2ban/jail.local +++ b/conf/fail2ban/jail.local @@ -23,6 +23,7 @@ enabled = true filter = dovecotimap findtime = 30 maxretry = 20 +logpath = /var/log/mail.log [recidive] enabled = true