From ca0b6394830366fe1fbb00cf71d6443b0df68b27 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Thu, 26 Oct 2023 11:25:44 +0100 Subject: [PATCH] initial commit of file from CVS for smeserver-dovecot on Thu 26 Oct 11:25:44 BST 2023 --- .gitignore | 4 + Makefile | 21 ++ README.md | 19 +- contriborbase | 1 + createlinks | 27 ++ root/etc/dovecot/ssl/.gitignore | 0 .../db/configuration/defaults/dovecot/Quotas | 1 + .../db/configuration/defaults/dovecot/status | 1 + .../db/configuration/defaults/dovecot/type | 1 + .../db/configuration/defaults/imap/TCPPort | 1 + .../db/configuration/defaults/imap/access | 1 + .../db/configuration/defaults/imap/status | 1 + .../db/configuration/defaults/imap/type | 1 + .../db/configuration/defaults/imaps/TCPPort | 1 + .../db/configuration/defaults/imaps/access | 1 + .../db/configuration/defaults/imaps/status | 1 + .../db/configuration/defaults/imaps/type | 1 + .../db/configuration/defaults/pop3/TCPPort | 1 + .../db/configuration/defaults/pop3/access | 1 + .../db/configuration/defaults/pop3/status | 1 + .../db/configuration/defaults/pop3/type | 1 + .../db/configuration/defaults/pop3s/TCPPort | 1 + .../db/configuration/defaults/pop3s/access | 1 + .../db/configuration/defaults/pop3s/status | 1 + .../db/configuration/defaults/pop3s/type | 1 + .../db/configuration/force/dovecot/status | 1 + .../db/configuration/force/imap/status | 1 + .../db/configuration/migrate/ImapsLimits | 12 + .../db/configuration/migrate/PopMemLimit | 23 ++ .../e-smith/db/configuration/migrate/dovecot | 5 + .../etc/e-smith/events/actions/adjust-dovecot | 34 +++ .../events/ssl-update/services2adjust/dovecot | 2 + .../etc/dovecot/ssl/imapd.pem | 4 + .../dovecot/dovecot.conf/10protocols10Imap | 8 + .../etc/dovecot/dovecot.conf/10protocols10Pop | 8 + .../etc/dovecot/dovecot.conf/11protocols | 1 + .../etc/dovecot/dovecot.conf/12usernameFormat | 6 + .../templates/etc/dovecot/dovecot.conf/15auth | 23 ++ .../templates/etc/dovecot/dovecot.conf/20log | 4 + .../templates/etc/dovecot/dovecot.conf/25mail | 3 + .../etc/dovecot/dovecot.conf/27Limits | 22 ++ .../etc/dovecot/dovecot.conf/28LimitsPop3 | 23 ++ .../etc/dovecot/dovecot.conf/30listener | 66 +++++ .../etc/dovecot/dovecot.conf/31listenerPop3 | 54 ++++ .../templates/etc/dovecot/dovecot.conf/35ssl | 19 ++ .../etc/dovecot/dovecot.conf/45pluginStart | 6 + .../etc/dovecot/dovecot.conf/50pluginQuotas | 16 ++ .../etc/dovecot/dovecot.conf/55pluginLogs | 21 ++ .../etc/dovecot/dovecot.conf/60pluginFts | 20 ++ .../etc/dovecot/dovecot.conf/90pluginEnd | 7 + .../etc/dovecot/dovecot.conf/99idle_notify | 7 + .../etc/dovecot/master.users/10admin | 1 + .../templates/etc/pam.d/dovecotadmin/10All | 5 + .../etc/pam.d/dovecotadmin/template-begin | 9 + .../templates/etc/rsyslog.conf/32dovecot | 6 + .../50koozali.conf/40service | 10 + .../50koozali.conf/80install | 2 + root/etc/logrotate.d/dovecot | 18 ++ .../system/dovecot.service.d/.gitignore | 0 root/var/log/dovecot/.gitignore | 0 smeserver-dovecot.spec | 230 ++++++++++++++++++ 61 files changed, 766 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 contriborbase create mode 100644 createlinks create mode 100644 root/etc/dovecot/ssl/.gitignore create mode 100644 root/etc/e-smith/db/configuration/defaults/dovecot/Quotas create mode 100644 root/etc/e-smith/db/configuration/defaults/dovecot/status create mode 100644 root/etc/e-smith/db/configuration/defaults/dovecot/type create mode 100644 root/etc/e-smith/db/configuration/defaults/imap/TCPPort create mode 100644 root/etc/e-smith/db/configuration/defaults/imap/access create mode 100644 root/etc/e-smith/db/configuration/defaults/imap/status create mode 100644 root/etc/e-smith/db/configuration/defaults/imap/type create mode 100644 root/etc/e-smith/db/configuration/defaults/imaps/TCPPort create mode 100644 root/etc/e-smith/db/configuration/defaults/imaps/access create mode 100644 root/etc/e-smith/db/configuration/defaults/imaps/status create mode 100644 root/etc/e-smith/db/configuration/defaults/imaps/type create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3/TCPPort create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3/access create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3/status create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3/type create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3s/access create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3s/status create mode 100644 root/etc/e-smith/db/configuration/defaults/pop3s/type create mode 100644 root/etc/e-smith/db/configuration/force/dovecot/status create mode 100644 root/etc/e-smith/db/configuration/force/imap/status create mode 100644 root/etc/e-smith/db/configuration/migrate/ImapsLimits create mode 100644 root/etc/e-smith/db/configuration/migrate/PopMemLimit create mode 100644 root/etc/e-smith/db/configuration/migrate/dovecot create mode 100644 root/etc/e-smith/events/actions/adjust-dovecot create mode 100644 root/etc/e-smith/events/ssl-update/services2adjust/dovecot create mode 100644 root/etc/e-smith/templates.metadata/etc/dovecot/ssl/imapd.pem create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Imap create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/11protocols create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/12usernameFormat create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/20log create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/25mail create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/45pluginStart create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/50pluginQuotas create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/55pluginLogs create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/60pluginFts create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/90pluginEnd create mode 100644 root/etc/e-smith/templates/etc/dovecot/dovecot.conf/99idle_notify create mode 100644 root/etc/e-smith/templates/etc/dovecot/master.users/10admin create mode 100644 root/etc/e-smith/templates/etc/pam.d/dovecotadmin/10All create mode 100644 root/etc/e-smith/templates/etc/pam.d/dovecotadmin/template-begin create mode 100644 root/etc/e-smith/templates/etc/rsyslog.conf/32dovecot create mode 100644 root/etc/e-smith/templates/usr/lib/systemd/system/dovecot.service.d/50koozali.conf/40service create mode 100644 root/etc/e-smith/templates/usr/lib/systemd/system/dovecot.service.d/50koozali.conf/80install create mode 100644 root/etc/logrotate.d/dovecot create mode 100644 root/usr/lib/systemd/system/dovecot.service.d/.gitignore create mode 100644 root/var/log/dovecot/.gitignore create mode 100644 smeserver-dovecot.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e594810 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.rpm +*.log +*spec-20* +*.tar.xz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0be33f0 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# Makefile for source rpm: smeserver-dovecot +# $Id: Makefile,v 1.1 2016/02/05 23:44:06 stephdl Exp $ +NAME := smeserver-dovecot +SPECFILE = $(firstword $(wildcard *.spec)) + +define find-makefile-common +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +endef + +MAKEFILE_COMMON := $(shell $(find-makefile-common)) + +ifeq ($(MAKEFILE_COMMON),) +# attept a checkout +define checkout-makefile-common +test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 +endef + +MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) +endif + +include $(MAKEFILE_COMMON) diff --git a/README.md b/README.md index 5e1cd1b..d7f54c6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ -# smeserver-dovecot +# smeserver-dovecot -SMEServer Koozali developed git repo for smeserver-dovecot smeserver \ No newline at end of file +SMEServer Koozali developed git repo for smeserver-dovecot smeserver + +## Wiki +
https://wiki.koozali.org/Dovecot-extras +
https://wiki.koozali.org/Smeserver-dovecot-extras + +## Bugzilla +Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-dovecot&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED) + +## Description + +
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.* +*Once it has been checked, then this comment will be deleted* +
+ +Dovecot is an open source software service that provides secure access to emails, calendars, and other applications for both users and administrators. It works by creating a secure connection between a mail server and an email client, allowing users to securely sync and download their emails, calendar events, contacts, and other data. Dovecot also provides a secure authentication process to ensure that only users with the proper credentials can access the email server. It is highly reliable and scalable, making it a popular choice for large and small businesses alike. Additionally, Dovecot is easy to install and configure, so businesses can get started quickly and easily. diff --git a/contriborbase b/contriborbase new file mode 100644 index 0000000..ef36a67 --- /dev/null +++ b/contriborbase @@ -0,0 +1 @@ +sme10 diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..35e727e --- /dev/null +++ b/createlinks @@ -0,0 +1,27 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + + +templates2events("/etc/dovecot/dovecot.conf", qw(email-update bootstrap-console-save ssl-update smeserver-dovecot-update ip-change)); +templates2events("/etc/dovecot/ssl/imapd.pem", qw(email-update bootstrap-console-save ssl-update smeserver-dovecot-update ip-change)); +templates2events("/etc/dovecot/master.users", qw(email-update bootstrap-console-save smeserver-dovecot-update)); +templates2events("/etc/pam.d/dovecotadmin", qw(email-update bootstrap-console-save smeserver-dovecot-update)); + +safe_symlink("sigusr2", "root/etc/e-smith/events/email-update/services2adjust/dovecot"); + +event_link("adjust-dovecot", "email-update", "02"); +event_link("adjust-dovecot", "bootstrap-console-save", "02"); + +#smeserver-dovecot-update +safe_symlink("restart", "root/etc/e-smith/events/smeserver-dovecot-update/services2adjust/dovecot"); +safe_symlink("restart", "root/etc/e-smith/events/smeserver-dovecot-update/services2adjust/rsyslog"); +event_link("adjust-dovecot", "smeserver-dovecot-update", "02"); +event_link("systemd-reload", "smeserver-dovecot-update", "89"); +event_link("systemd-default", "smeserver-dovecot-update", "88"); +templates2events("/etc/rsyslog.conf","smeserver-dovecot-update"); +templates2events("/usr/lib/systemd/system/dovecot.service.d/50koozali.conf", qw(bootstrap-console-save console-save post-install post-upgrade smeserver-dovecot-update )); + +# in case the ip change +safe_symlink("sigusr2", "root/etc/e-smith/events/ip-change/services2adjust/dovecot"); + diff --git a/root/etc/dovecot/ssl/.gitignore b/root/etc/dovecot/ssl/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/db/configuration/defaults/dovecot/Quotas b/root/etc/e-smith/db/configuration/defaults/dovecot/Quotas new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dovecot/Quotas @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/dovecot/status b/root/etc/e-smith/db/configuration/defaults/dovecot/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dovecot/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/dovecot/type b/root/etc/e-smith/db/configuration/defaults/dovecot/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dovecot/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/db/configuration/defaults/imap/TCPPort b/root/etc/e-smith/db/configuration/defaults/imap/TCPPort new file mode 100644 index 0000000..fba7ed5 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imap/TCPPort @@ -0,0 +1 @@ +143 diff --git a/root/etc/e-smith/db/configuration/defaults/imap/access b/root/etc/e-smith/db/configuration/defaults/imap/access new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imap/access @@ -0,0 +1 @@ +private diff --git a/root/etc/e-smith/db/configuration/defaults/imap/status b/root/etc/e-smith/db/configuration/defaults/imap/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imap/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/imap/type b/root/etc/e-smith/db/configuration/defaults/imap/type new file mode 100644 index 0000000..f92f363 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imap/type @@ -0,0 +1 @@ +configuration diff --git a/root/etc/e-smith/db/configuration/defaults/imaps/TCPPort b/root/etc/e-smith/db/configuration/defaults/imaps/TCPPort new file mode 100644 index 0000000..783646d --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imaps/TCPPort @@ -0,0 +1 @@ +993 diff --git a/root/etc/e-smith/db/configuration/defaults/imaps/access b/root/etc/e-smith/db/configuration/defaults/imaps/access new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imaps/access @@ -0,0 +1 @@ +private diff --git a/root/etc/e-smith/db/configuration/defaults/imaps/status b/root/etc/e-smith/db/configuration/defaults/imaps/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imaps/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/imaps/type b/root/etc/e-smith/db/configuration/defaults/imaps/type new file mode 100644 index 0000000..f92f363 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/imaps/type @@ -0,0 +1 @@ +configuration diff --git a/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort b/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort new file mode 100644 index 0000000..bc6298e --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort @@ -0,0 +1 @@ +110 diff --git a/root/etc/e-smith/db/configuration/defaults/pop3/access b/root/etc/e-smith/db/configuration/defaults/pop3/access new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3/access @@ -0,0 +1 @@ +private diff --git a/root/etc/e-smith/db/configuration/defaults/pop3/status b/root/etc/e-smith/db/configuration/defaults/pop3/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/pop3/type b/root/etc/e-smith/db/configuration/defaults/pop3/type new file mode 100644 index 0000000..f92f363 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3/type @@ -0,0 +1 @@ +configuration diff --git a/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort b/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort new file mode 100644 index 0000000..6e1fc58 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort @@ -0,0 +1 @@ +995 diff --git a/root/etc/e-smith/db/configuration/defaults/pop3s/access b/root/etc/e-smith/db/configuration/defaults/pop3s/access new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3s/access @@ -0,0 +1 @@ +private diff --git a/root/etc/e-smith/db/configuration/defaults/pop3s/status b/root/etc/e-smith/db/configuration/defaults/pop3s/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3s/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/pop3s/type b/root/etc/e-smith/db/configuration/defaults/pop3s/type new file mode 100644 index 0000000..f92f363 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/pop3s/type @@ -0,0 +1 @@ +configuration diff --git a/root/etc/e-smith/db/configuration/force/dovecot/status b/root/etc/e-smith/db/configuration/force/dovecot/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/force/dovecot/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/force/imap/status b/root/etc/e-smith/db/configuration/force/imap/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/force/imap/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/migrate/ImapsLimits b/root/etc/e-smith/db/configuration/migrate/ImapsLimits new file mode 100644 index 0000000..38a5270 --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/ImapsLimits @@ -0,0 +1,12 @@ +{ + +# Those limits are now defined on the imap entry +foreach my $prop (qw/ConcurrencyLimit ConcurrencyLimitPerIP ProcessMemoryLimit/){ + my $imaps_value = $DB->get_prop_and_delete('imaps', $prop); + next unless ($imaps_value); + my $imap_value = $DB->get_prop('imap', $prop); + next if ($imap_value); + $DB->set_prop('imap', $prop, $imaps_value); +} + +} diff --git a/root/etc/e-smith/db/configuration/migrate/PopMemLimit b/root/etc/e-smith/db/configuration/migrate/PopMemLimit new file mode 100644 index 0000000..c9d925a --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/PopMemLimit @@ -0,0 +1,23 @@ +{ + +# This limit is renamed after ProcessMemoryLimit for consistency with imap entry +foreach my $prop (qw/MemLimit/){ + my $pop_value = $DB->get_prop_and_delete('pop3', $prop); + next unless ($pop_value); + my $curpop_value = $DB->get_prop('pop3', 'ProcessMemoryLimit'); + next if ($curpop_value); + $DB->set_prop('pop3', 'ProcessMemoryLimit', $pop_value); +} + +# Those limits are now defined on the pop entry +foreach my $prop (qw/MemLimit/){ + my $pops_value = $DB->get_prop_and_delete('pop3s', $prop); + next unless ($pops_value); + my $pop_value = $DB->get_prop('pop3', 'ProcessMemoryLimit'); + next if ($pop_value); + $DB->set_prop('pop3', 'ProcessMemoryLimit' , $imaps_value); +} + + +} + diff --git a/root/etc/e-smith/db/configuration/migrate/dovecot b/root/etc/e-smith/db/configuration/migrate/dovecot new file mode 100644 index 0000000..90a9b3c --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/dovecot @@ -0,0 +1,5 @@ +{ + foreach my $sservice qw(imap imaps pop3 pop3s) { + $DB->set_prop($sservice, "type", "configuration") if ${$sservice}{type} eq "service"; + } +} diff --git a/root/etc/e-smith/events/actions/adjust-dovecot b/root/etc/e-smith/events/actions/adjust-dovecot new file mode 100644 index 0000000..137650d --- /dev/null +++ b/root/etc/e-smith/events/actions/adjust-dovecot @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w + + +# This script just ensure the dovecot service is enabled +# if imap or imaps is enabled +# It will also entirely disable the dovecot service if both imap, +# imaps pop3 and pop3s are disabled + +use esmith::ConfigDB; + +my $c = esmith::ConfigDB->open() or die "Couldn't open Config DB\n"; + +my $imap = $c->get('imap'); +my $imaps = $c->get('imaps'); +my $pop = $c->get('pop3'); +my $pops = $c->get('pop3s'); +my $dovecot = $c->get('dovecot') || $c->new_record('dovecot', + { type => 'service', + status => 'enabled'}); + +my $imapStatus = $imap->prop('status') || 'enabled'; +my $imapsStatus = $imaps->prop('status') || 'enabled'; +my $popStatus = $pop->prop('status') || 'enabled'; +my $popsStatus = $pops->prop('status') || 'enabled'; + +if ($imapStatus eq 'enabled' or $imapsStatus eq 'enabled' or $popStatus eq 'enabled' or $popsStatus eq 'enabled'){ + $dovecot->set_prop('status', 'enabled'); +} +else{ + $dovecot->set_prop('status', 'disabled'); +} + +# also if /etc/pam.d/pop3 exists we unlink it, as it was needed by former e-smith-pop3 +unlink('/etc/pam.d/pop3'); diff --git a/root/etc/e-smith/events/ssl-update/services2adjust/dovecot b/root/etc/e-smith/events/ssl-update/services2adjust/dovecot new file mode 100644 index 0000000..14303df --- /dev/null +++ b/root/etc/e-smith/events/ssl-update/services2adjust/dovecot @@ -0,0 +1,2 @@ +sigusr1 +sighup diff --git a/root/etc/e-smith/templates.metadata/etc/dovecot/ssl/imapd.pem b/root/etc/e-smith/templates.metadata/etc/dovecot/ssl/imapd.pem new file mode 100644 index 0000000..f78afb5 --- /dev/null +++ b/root/etc/e-smith/templates.metadata/etc/dovecot/ssl/imapd.pem @@ -0,0 +1,4 @@ +TEMPLATE_PATH="/home/e-smith/ssl.pem" +OUTPUT_FILENAME="/etc/dovecot/ssl/imapd.pem" +GID="stunnel" +PERMS=0640 diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Imap b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Imap new file mode 100644 index 0000000..7542662 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Imap @@ -0,0 +1,8 @@ +{ +our $proto = ''; +if ((($imap{'status'} || 'disabled') eq 'enabled') || + (($imaps{'status'} || 'disabled') eq 'enabled')){ + $proto .= "imap"; +} +$OUT .= ""; +} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop new file mode 100644 index 0000000..ce5850c --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop @@ -0,0 +1,8 @@ +{ +if ((($pop3{'status'} || 'disabled') eq 'enabled') || +(($pop3s{'status'} || 'disabled') eq 'enabled')) { + $proto .= " pop3"; + } + +$OUT .= ""; +} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/11protocols b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/11protocols new file mode 100644 index 0000000..be3965b --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/11protocols @@ -0,0 +1 @@ +protocols = {$proto} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/12usernameFormat b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/12usernameFormat new file mode 100644 index 0000000..6b23f0f --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/12usernameFormat @@ -0,0 +1,6 @@ +{ +$OUT = "#only accept username as default, not " unless ($dovecot{AcceptFullEmail} || "enabled" ) eq "enabled"; + +$OUT = "auth_username_format = \%n"; + +} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth new file mode 100644 index 0000000..ce09e8e --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth @@ -0,0 +1,23 @@ +{ +our $args = $dovecot{PassDBArgs} || ''; +} +passdb \{ + driver = pam + { $OUT .= ($args ne '') ? "args = $args\n" : ''; } +\} +{ +if (($dovecot{'AdminIsMaster'} || 'disabled') eq 'enabled'){ + $OUT .=<<"HERE"; + +passdb { + driver = pam + args = $args dovecotadmin + master = yes +} +auth_master_user_separator = * +HERE +} +} +userdb \{ + driver = passwd +\} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/20log b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/20log new file mode 100644 index 0000000..fdbd178 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/20log @@ -0,0 +1,4 @@ +log_path = syslog +# we choose same as rsyslog for SME "%b %e %H:%M:%S " and not "%b %d %H:%M:%S " +log_timestamp = "%b %e %H:%M:%S " +auth_verbose = yes diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/25mail b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/25mail new file mode 100644 index 0000000..9a52c84 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/25mail @@ -0,0 +1,3 @@ +mail_location = maildir:~/Maildir +first_valid_uid = 101 + diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits new file mode 100644 index 0000000..019374d --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits @@ -0,0 +1,22 @@ +{ + +my $ConcurrencyLimit = $imap{ConcurrencyLimit} || '400'; +my $ConcurrencyLimitPerIP = $imap{ConcurrencyLimitPerIP} || '12'; +my $ProcessMemoryLimit = $imap{ProcessMemoryLimit} || '256000000'; + +my $greeting = $imap{'Greeting'} || $dovecot{'Greeting'} || 'SME Server IMAP service powered by dovecot'; + +$OUT .=<<"END"; + +service imap { + process_limit = $ConcurrencyLimit + vsz_limit = $ProcessMemoryLimit + client_limit = 1 +} +protocol imap { + login_greeting = $greeting + mail_max_userip_connections = $ConcurrencyLimitPerIP +} +END + +} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 new file mode 100644 index 0000000..5db3f49 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 @@ -0,0 +1,23 @@ +{ + +my $ConcurrencyLimit = $pop3{ConcurrencyLimit} || '40'; +my $ConcurrencyLimitPerIP = $pop3{ConcurrencyLimitPerIP} || '4'; +my $ProcessMemoryLimit = $pop3{ProcessMemoryLimit} || '40000000'; + +my $greeting = $pop3{'Greeting'} || $dovecot{'Greeting'} || 'SME Server POP3 service powered by dovecot'; + +$OUT .=<<"END"; + +service pop3 { + process_limit = $ConcurrencyLimit + vsz_limit = $ProcessMemoryLimit + client_limit = 1 +} +protocol pop3 { + mail_max_userip_connections = $ConcurrencyLimitPerIP + login_greeting = $greeting +} +END + +} + diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener new file mode 100644 index 0000000..d8ce599 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener @@ -0,0 +1,66 @@ +{ +# (($imap{'status'} || 'disabled') eq 'disabled') to remove if we use for pop3, to test +if ((($imap{'status'} || 'disabled') eq 'disabled') || + (($imap{'AllowPlainText'} || 'enabled') eq 'disabled')){ + $OUT .= "disable_plaintext_auth = yes\n"; +} +else { + $OUT .= "disable_plaintext_auth = no\n"; +} +} + +{ +# TODO IPV6 :: +$LOCALIP = $LocalIP; +$EXTERNALIP = $ExternalIP || ""; +$imapPort = $imap{'TCPPort'} || '110'; +$imapsPort = $imaps{'TCPPort'} || '995'; +$imapStatus = $imap{'status'} || 'disabled'; +$imapsStatus = $imaps{'status'} || 'disabled'; +$imapAccess = $imap{'access'} || 'localhost'; +$imapsAccess = $imaps{'access'} || 'private'; +$imapListenIP = $imap{'ListenIP'} || ''; +$imapsListenIP = $imaps{'ListenIP'} || ''; + +if ($imapStatus eq 'disabled') { + $imapAddress = '127.0.0.1'; + $imapPort='0'; +} elsif ($imapAccess eq 'localhost') { + $imapAddress = '127.0.0.1'; +} elsif ($imapAccess eq 'private') { + $imapAddress = "127.0.0.1 $LOCALIP"; +} elsif ($imapAccess eq 'public') { + $imapAddress = "127.0.0.1 $LOCALIP $EXTERNALIP"; +} +$imapAddress .= " $imapListenIP"; + + +if ($imapsStatus eq 'disabled') { + $imapsAddress = '127.0.0.1'; + $imapsPort='0'; +} elsif ($imapsAccess eq 'localhost') { + $imapsAddress = '127.0.0.1'; +} elsif ($imapsAccess eq 'private') { + $imapsAddress = "127.0.0.1 $LOCALIP"; +} elsif ($imapsAccess eq 'public') { + $imapsAddress = "127.0.0.1 $LOCALIP $EXTERNALIP"; +} +$imapsAddress .= " $imapsListenIP"; + +$OUT .= "service imap-login \{ + inet_listener imap \{ + port = $imapPort + address = $imapAddress + \} + inet_listener imaps \{ + port = $imapsPort + ssl = yes + address = $imapsAddress + \} + + service_count = 0 + process_min_avail = 2 + +\}"; + +} diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 new file mode 100644 index 0000000..8fa41ab --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 @@ -0,0 +1,54 @@ +{ +# TODO IPV6 :: +$LOCALIP = $LocalIP; +$EXTERNALIP = $ExternalIP || ""; +$popPort = $pop3{'TCPPort'} || '110'; +$popsPort = $pop3s{'TCPPort'} || '995'; +$popStatus = $pop3{'status'} || 'disabled'; +$popsStatus = $pop3s{'status'} || 'disabled'; +$popAccess = $pop3{'access'} || 'localhost'; +$popsAccess = $pop3s{'access'} || 'private'; +$popListenIP = $pop3{'ListenIP'} || ''; +$popsListenIP = $pop3s{'ListenIP'} || ''; +if ($popStatus eq 'disabled') { + $popAddress = '127.0.0.1'; + $popPort='0'; +} elsif ($popAccess eq 'localhost') { + $popAddress = '127.0.0.1'; +} elsif ($popAccess eq 'private') { + $popAddress = "127.0.0.1 $LOCALIP"; +} elsif ($popAccess eq 'public') { + $popAddress = "127.0.0.1 $LOCALIP $EXTERNALIP"; +} +$popAddress .= " $popListenIP"; + + +if ($popsStatus eq 'disabled') { + $popsAddress = '127.0.0.1'; + $popsPort='0'; +} elsif ($popsAccess eq 'localhost') { + $popsAddress = '127.0.0.1'; +} elsif ($popsAccess eq 'private') { + $popsAddress = "127.0.0.1 $LOCALIP"; +} elsif ($popsAccess eq 'public') { + $popsAddress = "127.0.0.1 $LOCALIP $EXTERNALIP"; +} +$popsAddress .= " $popsListenIP"; + +$OUT .= "service pop3-login \{ + inet_listener pop3 \{ + port = $popPort + address = $popAddress + \} + inet_listener pop3s \{ + port = $popsPort + ssl = yes + address = $popsAddress + \} + + service_count = 0 + process_min_avail = 2 + +\}" +} + diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl new file mode 100644 index 0000000..aa46a56 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl @@ -0,0 +1,19 @@ +ssl = {$OUT .= ( (($imaps{'status'} || 'enabled') eq 'enabled') || (($pops{'status'} || 'enabled') eq 'enabled') ) ? 'yes':'no';} +ssl_cert = = 5.2.0 +Requires: dovecot >= 2.0.9 + +Provides: e-smith-imap +Provides: e-smith-pop3 +Obsoletes: e-smith-imap +Obsoletes: e-smith-pop3 +Obsoletes: e-smith-ssl-imap +Obsoletes: e-smith-wu-imap +Obsoletes: imap +Obsoletes: m4 <= 1.4.5 +Obsoletes: mailfront <= 1.10 +Obsoletes: stunnel <= 4.15 +Obsoletes: stunnel-tls <= 3.22 + +%description +Configure the dovecot IMAP server with sieve scripts support, +quota, ACL, extended logging, master user + +%changelog +* Thu Oct 26 2023 cvs2git.sh aka Brian Read 1.6.0-22.sme +- Roll up patches and move to git repo [SME: 12338] + +* Thu Oct 26 2023 BogusDateBot +- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday, + by assuming the date is correct and changing the weekday. + +* Tue Aug 15 2023 Jean-Philippe Pialasse 1.6.0-21.sme +- force imap and dovecot satus=enabled to allow auth for webmail and smtp [SME: 12399] + also migrate imap imaps pop3 pop3s as configuration, not service + +* Mon Aug 14 2023 Jean-Philippe Pialasse 1.6.0-20.sme +- remove obsoletes word as it prevents unrelated packages to install [SME: 12393] + +* Sun May 30 2021 Jean-Philippe Pialasse 1.6.0-19.sme +- ssl pem update via template expand in place of copy [SME: 11601] + +* Tue Mar 16 2021 Jean-Philippe Pialasse 1.6.0-18.sme +- clean rsyslog syntax for dovecot [SME: 11422] + +* Sat Jan 02 2021 Jean-Philipe Pialasse 1.6.0-17.sme +- add Restart=always [SME: 11101] + +* Mon Dec 14 2020 Jean-Philipe Pialasse 1.6.0-16.sme +- fix path for event -update [SME: 11101] + +* Tue Dec 08 2020 Jean-Philipe Pialasse 1.6.0-15.sme +- cleanup /var/service/dovecot [SME: 11101] + close logger and service from previous runit instance before starting systemd one + +* Mon Dec 07 2020 Jean-Philipe Pialasse 1.6.0-14.sme +- add systemd drop-in expand in bootstrap-console-save, console-save, post-install, post-upgrade [SME: 11101] + +* Sun Dec 06 2020 Jean-Philipe Pialasse 1.6.0-13.sme +- move service to systemd [SME: 11101] +- add imap idle notify interval setting [SME: 10947] + +* Mon May 04 2020 Jean-Philipe Pialasse 1.6.0-12.sme +- fix typo in enabling TLSv1.2 as default [SME: 10934] + +* Mon May 04 2020 John Crisp 1.6.0-10.sme +- fix typo in 35ssl template [SME: 10934] + +* Mon May 04 2020 John Crisp 1.6.0-9.sme +- fix typo in createlinks [SME: 10932] + +* Sat May 02 2020 Jean-Philipe Pialasse 1.6.0-8.sme +- revert property names with period in it [SME: 10934] + +* Sat May 02 2020 Jean-Philipe Pialasse 1.6.0-7.sme +- add property AcceptFullEmail with enabled as default [SME: 9865] + * this allow to login using either username or username@domain.tld + dovecot get the username part. + +* Fri May 01 2020 Jean-Philipe Pialasse 1.6.0-5.sme +- set TLSv1 and TLSv1.1 disabled as default [SME: 10934] + * Amend cipher list + * force cipher order + * 4096 default dh parameter + * property names without period to avoid issues + +* Sun Apr 26 2020 Jean-Philipe Pialasse 1.6.0-3.sme +- Use Dovecot for pop3 and pop3s [SME: 7510] + *delete /etc/pam.d/pop3 if exists + *listen on internal and external interface instead of * + *update the service on ip-change + *reuse the ListenIP prop in pop3* and added to imap* + *migrate pop3* MemLimit to pop3 ProcessMemoryLimit as per imap + *TODO make it ipv6 ready +- smeserver-dovecot-upgrade event for update without reboot [SME: 10932] + +* Thu Feb 23 2017 Daniel Berteaud 1.6.0-2.sme +- Better default cipher suite, and honor global suite [SME: 10110] + +* Sat Feb 06 2016 stephane de Labrusse 1.6.0-1.sme +- Initial release to sme10 + +* Wed Jan 13 2016 Daniel Berteaud - 1.4.0-20.sme +- Hook into the new ssl-update event [SME: 9152] + +* Thu Jan 7 2016 Daniel Berteaud - 1.4.0-19.sme +- Allow settings SSL protocols from DB (and set TLSv1 back to enabled + on a default install) [SME: 9175] + +* Wed Jan 6 2016 Daniel Berteaud - 1.4.0-18.sme +- Disable TLSv1 [SME: 9175] + +* Wed Jan 7 2015 Daniel Berteaud - 1.4.0-17.sme +- Allow custom passdb args [SME: 8778] + +* Thu Jan 23 2014 Daniel Berteaud - 1.4.0-16.sme +- Remove limit props from the imaps DB entry [SME: 8082] + +* Tue Dec 24 2013 Daniel Berteaud - 1.4.0-15.sme +- Apply process limits [SME: 8082] + +* Sun Jun 23 2013 Daniel Berteaud - 1.4.0-14.sme +- Listen on loopback if disabled [SME: 7697] + +* Wed May 29 2013 chris burnat - 1.4.0-13.sme +- Reverse changes made in 1.4.0-12 [SME: 7597] + +* Fri May 24 2013 chris burnat - 1.4.0-12.sme +- Fix IMAP folders dont present correctly in Outlook 2007 [SME: 7597] + +* Sat May 18 2013 Daniel Berteaud - 1.4.0-11.sme +- Fix permissions on imapd.pem as it's used by pop3s [SME: 7570] + +* Wed Apr 24 2013 Daniel Berteaud - 1.4.0-10.sme +- Do not obsolete bglibs, it's required for cvm [SME: 7509] + +* Tue Apr 16 2013 Daniel Berteaud - 1.4.0-9.sme +- Allow plaintext (unless explicitly disabled) [SME: 7549] + +* Wed Apr 10 2013 Daniel Berteaud - 1.4.0-8.sme +- Do not obsolete cvm, it's still needed for qpsmtpd [SME: 7509] + +* Thu Feb 28 2013 Shad L. Lords - 1.4.0-7.sme +- Obsolete another el5 required by requires [SME: 7273] + +* Thu Feb 28 2013 Shad L. Lords - 1.4.0-6.sme +- Fix Obsolete el5 mailfront version [SME: 7273] + +* Thu Feb 28 2013 Shad L. Lords - 1.4.0-5.sme +- Obsolete el5 packages that were required by old requires [SME: 7273] + +* Thu Feb 28 2013 Shad L. Lords - 1.4.0-4.sme +- Obsolete older requires that are no longer needed [SME: 7273] + +* Thu Feb 28 2013 Shad L. Lords - 1.4.0-3.sme +- Remove requires for packages no longer needed [SME: 7405] + +* Thu Feb 28 2013 Daniel Berteaud - 1.4.0-2.sme +- remove the IMAP acl and Sieve support [SME: 7405] +- remove obsolete changelog (used in my previous buildsys) + +* Tue Feb 26 2013 Daniel Berteaud - 0.1.1-1 +- store sharedmailbox dict file in /home/e-smith/db/dovecot + +* Tue Feb 12 2013 Daniel Berteaud - 0.1.0-1 +- Pass the recipient variable to dovcot-lda + +* Tue Nov 29 2011 Daniel Berteaud - 0.1 +- initial release + +%prep +%setup -q -n %{name}-%{version} +rm -rf root/var/service +mkdir -p root/etc/dovecot/ssl +mkdir -p root/usr/lib/systemd/system/dovecot.service.d +mkdir -p root/etc/e-smith/templates/usr/lib/systemd/system/dovecot.service.d/50koozali.conf + +%build +perl createlinks + +%install +/bin/rm -rf $RPM_BUILD_ROOT +(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) +/bin/rm -f %{name}-%{version}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ + --file /sbin/e-smith/systemd/dovecot-control 'attr(0554,root,root)'\ + --dir /var/log/dovecot 'attr(0750,smelog,smelog)' \ + > %{name}-%{version}-filelist + +%files -f %{name}-%{version}-filelist +%defattr(-,root,root) + +%clean +rm -rf $RPM_BUILD_ROOT + + +%pre +if [ $1 -gt 1 ] ; then + if [ -e /var/service/dovecot/run ] ; then + /usr/bin/sv d dovecot + /usr/bin/sv d dovecot/log + fi + if [ -e /var/service/dovecot ] ; then + rm -rf /var/service/dovecot + fi + if [ -e /var/service/pop3 ] ; then + rm -rf /var/service/pop3 + fi + if [ -e /var/service/pop3s ] ; then + rm -rf /var/service/pop3s + fi + +fi +%post + +%preun +