diff -Nur smeserver-dovecot-1.6.0.old/createlinks smeserver-dovecot-1.6.0/createlinks --- smeserver-dovecot-1.6.0.old/createlinks 2016-02-05 18:43:49.000000000 -0500 +++ smeserver-dovecot-1.6.0/createlinks 2020-04-29 22:14:44.343000000 -0400 @@ -7,9 +7,9 @@ service_link_enhanced("dovecot", "K35", "0"); service_link_enhanced("dovecot", "K35", "1"); -templates2events("/etc/dovecot/dovecot.conf", qw(email-update bootstrap-console-save ssl-update)); -templates2events("/etc/dovecot/master.users", qw(email-update bootstrap-console-save)); -templates2events("/etc/pam.d/dovecotadmin", qw(email-update bootstrap-console-save)); +templates2events("/etc/dovecot/dovecot.conf", 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_touch("root/var/service/dovecot/down"); safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/dovecot'); @@ -21,3 +21,10 @@ 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"); +event_link("adjust-dovecot", "meserver-dovecot-update", "02"); + +# in case the ip change +safe_symlink("sigusr2", "root/etc/e-smith/events/ip-change/services2adjust/dovecot"); + diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/access smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/access --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/access 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/access 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +private diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/status smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/status --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/status 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/status 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +enabled diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/TCPPort 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +110 diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/type smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/type --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3/type 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3/type 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +service diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/access smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/access --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/access 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/access 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +private diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/status smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/status --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/status 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/status 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +enabled diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/TCPPort 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +995 diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/type smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/type --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/defaults/pop3s/type 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/defaults/pop3s/type 2006-03-15 16:34:47.000000000 -0500 @@ -0,0 +1 @@ +service diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/migrate/PopMemLimit smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/migrate/PopMemLimit --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/db/configuration/migrate/PopMemLimit 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/db/configuration/migrate/PopMemLimit 2020-04-29 22:41:55.583000000 -0400 @@ -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 -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/events/actions/adjust-dovecot smeserver-dovecot-1.6.0/root/etc/e-smith/events/actions/adjust-dovecot --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/events/actions/adjust-dovecot 2013-02-26 12:57:10.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/events/actions/adjust-dovecot 2020-04-29 21:42:48.139000000 -0400 @@ -3,8 +3,8 @@ # 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 -# and imaps are disabled +# It will also entirely disable the dovecot service if both imap, +# imaps pop3 and pop3s are disabled use esmith::ConfigDB; @@ -12,17 +12,23 @@ 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'){ +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 -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/10protocols10Pop 2020-04-29 16:47:53.571000000 -0400 @@ -0,0 +1,8 @@ +{ +if ((($pop3{'status'} || 'disabled') eq 'enabled') || +(($pop3s{'status'} || 'disabled') eq 'enabled')) { + $proto .= " pop3"; + } + +$OUT .= ""; +} diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth 2016-02-05 18:43:49.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/15auth 2020-04-26 16:14:34.424000000 -0400 @@ -1,6 +1,4 @@ { -my $greeting = $dovecot{'Greeting'} || 'SME Server IMAP service powered by doveot'; -$OUT .= "login_greeting = \"$greeting\"\n"; our $args = $dovecot{PassDBArgs} || ''; } passdb \{ diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits 2016-02-05 18:43:48.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/27Limits 2020-04-26 16:35:23.507000000 -0400 @@ -4,13 +4,17 @@ 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 -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/28LimitsPop3 2020-04-29 22:42:35.586000000 -0400 @@ -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 -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener 2016-02-05 18:43:48.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/30listener 2020-04-29 22:30:05.085000000 -0400 @@ -1,4 +1,5 @@ { +# (($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"; @@ -8,19 +9,58 @@ } } -service imap-login \{ +{ +# 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 = {$imap{'TCPPort'} || '143'} - address = { ($imap{'access'} || 'private') eq 'localhost' ? '127.0.0.1':'*' } + port = $imapPort + address = $imapAddress \} inet_listener imaps \{ - port = {$imaps{'TCPPort'} || '993'} + port = $imapsPort ssl = yes - address = * + address = $imapsAddress \} service_count = 0 process_min_avail = 2 -\} +\}"; +} diff -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/31listenerPop3 2020-04-29 22:07:56.325000000 -0400 @@ -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 -Nur smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl --- smeserver-dovecot-1.6.0.old/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl 2020-04-26 11:39:44.350000000 -0400 +++ smeserver-dovecot-1.6.0/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/35ssl 2020-04-29 21:03:27.917000000 -0400 @@ -1,4 +1,4 @@ -ssl = {$OUT .= (($imaps{'status'} || 'enabled') eq 'enabled') ? 'yes':'no';} +ssl = {$OUT .= ( (($imaps{'status'} || 'enabled') eq 'enabled') || (($pops{'status'} || 'enabled') eq 'enabled') ) ? 'yes':'no';} ssl_cert =