-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10_dovecot_compress.pl 20_dovecot_connections.pl 30_dovecot_namespace.pl 40_dovecot_pfs.pl 50_dovecot_plaintext.pl
- Loading branch information
1 parent
8d90e6d
commit 4c98498
Showing
6 changed files
with
266 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# i-MSCP Listener::Dovecot::Compress listener file | ||
# Copyright (C) 2015-2016 Rene Schuster <mail@reneschuster.de> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
# | ||
## i-MSCP listener file for activating the dovecot compress plugin, to reduce | ||
## the bandwidth usage of IMAP and to also compress the stored mails | ||
## For more information please check: | ||
## http://wiki2.dovecot.org/Plugins/Compress | ||
## http://wiki2.dovecot.org/Plugins/Zlib | ||
# | ||
|
||
package Listener::Dovecot::Compress; | ||
|
||
use strict; | ||
use warnings; | ||
use iMSCP::EventManager; | ||
|
||
iMSCP::EventManager->getInstance()->register('beforePoBuildConf', sub { | ||
my ($cfgTpl, $tplName) = @_; | ||
|
||
my $cfgSnippet = <<EOF; | ||
# BEGIN Listener::Dovecot::Compress | ||
zlib_save = gz | ||
zlib_save_level = 6 | ||
# END Listener::Dovecot::Compress | ||
EOF | ||
|
||
if (index($tplName, 'dovecot.conf') != -1) { | ||
# Enable zlib plugin globally for reading/writing | ||
$$cfgTpl =~ s/^(mail_plugins\s+=.*)/$1 zlib/m; | ||
$$cfgTpl =~ s/^(protocol\simap\s+\{.*?mail_plugins.*?$)/$1 imap_zlib/sm; | ||
# Enable these only if you want compression while saving | ||
$$cfgTpl =~ s/^(plugin\s+\{.*?)(\})/$1$cfgSnippet$2/sm; | ||
} | ||
|
||
0; | ||
}); | ||
|
||
1; | ||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# i-MSCP Listener::Dovecot::Connections listener file | ||
# Copyright (C) 2015-2016 Rene Schuster <mail@reneschuster.de> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
# | ||
## i-MSCP listener file to increase the mail_max_userip_connections | ||
# | ||
|
||
package Listener::Dovecot::Connections; | ||
|
||
use strict; | ||
use warnings; | ||
use iMSCP::EventManager; | ||
|
||
|
||
iMSCP::EventManager->getInstance()->register('beforePoBuildConf', sub { | ||
my ($cfgTpl, $tplName) = @_; | ||
|
||
my $cfgSnippet = <<EOF; | ||
# BEGIN Listener::Dovecot::Connections | ||
mail_max_userip_connections = 50 | ||
# END Listener::Dovecot::Connections | ||
EOF | ||
|
||
$$cfgTpl .= "\n$cfgSnippet" if index($tplName, 'dovecot.conf') != -1; | ||
|
||
0; | ||
}); | ||
|
||
1; | ||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# i-MSCP Listener::Dovecot::Namespace listener file | ||
# Copyright (C) 2015-2016 Rene Schuster <mail@reneschuster.de> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
# | ||
## i-MSCP listener file that creates the INBOX. as a compatibility name, | ||
## so old clients can continue using it while new clients will use the | ||
## empty prefix namespace. | ||
# | ||
|
||
package Listener::Dovecot::Namespace; | ||
|
||
use strict; | ||
use warnings; | ||
use iMSCP::EventManager; | ||
|
||
iMSCP::EventManager->getInstance()->register('beforePoBuildConf', sub { | ||
my ($cfgTpl, $tplName) = @_; | ||
|
||
my $cfgSnippet = <<EOF; | ||
# BEGIN Listener::Dovecot::Namespace | ||
namespace compat { | ||
separator = . | ||
prefix = INBOX. | ||
inbox = no | ||
hidden = yes | ||
list = no | ||
alias_for = | ||
} | ||
# END Listener::Dovecot::Namespace | ||
EOF | ||
|
||
if(index($tplName, 'dovecot.conf') != -1) { | ||
$$cfgTpl =~ s/(separator\s+=\s+)\./$1\//; | ||
$$cfgTpl =~ s/(prefix\s+=\s+)INBOX\./$1/; | ||
$$cfgTpl =~ s/^(namespace\s+inbox\s+\{.*?^\}\n)/$1\n$cfgSnippet/sm; | ||
} | ||
|
||
0; | ||
}); | ||
|
||
1; | ||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# i-MSCP Listener::Dovecot::PFS listener file | ||
# Copyright (C) 2016 Rene Schuster <mail@reneschuster.de> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
# | ||
## i-MSCP listener file to activate the Perfect Forward Secrecy logging | ||
# | ||
|
||
package Listener::Dovecot::PFS; | ||
|
||
use strict; | ||
use warnings; | ||
use iMSCP::EventManager; | ||
|
||
iMSCP::EventManager->getInstance()->register('beforePoBuildConf', sub { | ||
my ($cfgTpl, $tplName) = @_; | ||
|
||
my $cfgSnippet = <<EOF; | ||
# BEGIN Listener::Dovecot::PFS | ||
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c %k session=<%{session}> | ||
# END Listener::Dovecot::PFS | ||
EOF | ||
|
||
$$cfgTpl .= "\n$cfgSnippet" if index($tplName, 'dovecot.conf') != -1; | ||
|
||
0; | ||
}); | ||
|
||
1; | ||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# i-MSCP Listener::Dovecot::Plaintext listener file | ||
# Copyright (C) 2015-2016 Rene Schuster <mail@reneschuster.de> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
# | ||
## i-MSCP listener file to disable plaintext logins and force tls. | ||
## Also remove the authentication mechanisms cram-md5 and digest-md5 | ||
## which won't be supported anymore in i-MSCP 1.3 | ||
# | ||
|
||
package Listener::Dovecot::Plaintext; | ||
|
||
use strict; | ||
use warnings; | ||
use iMSCP::EventManager; | ||
|
||
iMSCP::EventManager->getInstance()->register('beforePoBuildConf', sub { | ||
my ($cfgTpl, $tplName) = @_; | ||
|
||
if (index($tplName, 'dovecot.conf') != -1) { | ||
$$cfgTpl =~ s/\s+cram-md5\s+digest-md5//; | ||
$$cfgTpl =~ s/^(disable_plaintext_auth\s+=\s+).*/$1yes/m; | ||
} | ||
|
||
0; | ||
}); | ||
|
||
1; | ||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters