Skip to content

Commit 3118c93

Browse files
author
Marius Burkard
committed
Merge branch '5988-custom-config-postfix-dovecot' into 'develop'
Add new function for custom config usage for Postfix and Dovecot (#5988) Closes #5988 See merge request ispconfig/ispconfig3!1405
2 parents 1d8d8e3 + e753de5 commit 3118c93

File tree

6 files changed

+31
-3
lines changed

6 files changed

+31
-3
lines changed

install/lib/installer_base.lib.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,12 @@ public function configure_postfix($options = '') {
11821182
$content = strtr($content, $postconf_placeholders);
11831183
$postconf_commands = array_merge($postconf_commands, array_filter(explode("\n", $content)));
11841184
}
1185+
$configfile = 'postfix_custom.conf';
1186+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/' . $configfile . '.master')) {
1187+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master');
1188+
$content = strtr($content, $postconf_placeholders);
1189+
$postconf_commands = array_merge($postconf_commands, array_filter(explode("\n", $content)));
1190+
}
11851191

11861192
// Remove comment lines, these would give fatal errors when passed to postconf.
11871193
$postconf_commands = array_filter($postconf_commands, function($line) { return preg_match('/^[^#]/', $line); });
@@ -1535,6 +1541,10 @@ public function configure_dovecot() {
15351541
} else {
15361542
copy('tpl/debian_dovecot2.conf.master', $config_dir.'/'.$configfile);
15371543
}
1544+
// Copy custom config file
1545+
if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/dovecot_custom.conf.master')) {
1546+
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/dovecot_custom.conf.master', $config_dir.'/conf.d/99-ispconfig-custom-config.conf');
1547+
}
15381548
replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
15391549
replaceLine($config_dir.'/'.$configfile, 'postmaster_address = webmaster@localhost', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
15401550
if(version_compare($dovecot_version, 2.1, '<')) {

install/tpl/debian6_dovecot2.conf.master

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Do not change this file, as changes will be overwritten by any ISPConfig update.
2+
# Put your custom settings in /usr/local/ispconfig/server/conf-custom/install/dovecot_custom.conf.master.
3+
# To start using those changes, do a force upgrade and let it reconfigure your services. (ispconfig_update.sh --force)
14
listen = *,[::]
25
protocols = imap pop3
36
auth_mechanisms = plain login
@@ -88,7 +91,7 @@ protocol lmtp {
8891
#2.3+ group = vmail
8992
#2.3+ mode = 0660
9093
#2.3+ }
91-
#2.3+
94+
#2.3+
9295
#2.3+ unix_listener stats-writer {
9396
#2.3+ user = vmail
9497
#2.3+ group = vmail
@@ -131,3 +134,4 @@ namespace inbox {
131134
special_use = \Trash
132135
}
133136
}
137+
!include_try conf.d/99-ispconfig-custom-config.conf

install/tpl/debian_dovecot2.conf.master

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Do not change this file, as changes will be overwritten by any ISPConfig update.
2+
# Put your custom settings in /usr/local/ispconfig/server/conf-custom/install/dovecot_custom.conf.master.
3+
# To start using those changes, do a force upgrade and let it reconfigure your services. (ispconfig_update.sh --force)
14
listen = *,[::]
25
protocols = imap pop3
36
auth_mechanisms = plain login
@@ -86,7 +89,7 @@ protocol lmtp {
8689
#2.3+ group = vmail
8790
#2.3+ mode = 0660
8891
#2.3+ }
89-
#2.3+
92+
#2.3+
9093
#2.3+ unix_listener stats-writer {
9194
#2.3+ user = vmail
9295
#2.3+ group = vmail
@@ -108,3 +111,4 @@ plugin {
108111
quota_status_nouser = DUNNO
109112
quota_status_overquota = "552 5.2.2 Mailbox is full"
110113
}
114+
!include_try conf.d/99-ispconfig-custom-config.conf
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# You can use this file for custom Dovecot settings. The used settings will overrule the settings set by ISPConfig.
2+
# Use with caution!
3+
# Put this file in /usr/local/ispconfig/server/conf-custom/install/ and make your changes there.

install/tpl/fedora_dovecot2.conf.master

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Do not change this file, as changes will be overwritten by any ISPConfig update.
2+
# Put your custom settings in /usr/local/ispconfig/server/conf-custom/install/dovecot_custom.conf.master.
3+
# To start using those changes, do a force upgrade and let it reconfigure your services. (ispconfig_update.sh --force)
14
listen = *,[::]
25
protocols = imap pop3
36
auth_mechanisms = plain login
@@ -82,7 +85,7 @@ protocol lmtp {
8285
#2.3+ group = vmail
8386
#2.3+ mode = 0660
8487
#2.3+ }
85-
#2.3+
88+
#2.3+
8689
#2.3+ unix_listener stats-writer {
8790
#2.3+ user = vmail
8891
#2.3+ group = vmail
@@ -125,3 +128,4 @@ namespace inbox {
125128
special_use = \Trash
126129
}
127130
}
131+
!include_try conf.d/99-ispconfig-custom-config.conf
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# You can use this file for custom Postfix settings. The used settings will overrule the settings set by ISPConfig.
2+
# Use with caution!
3+
# Put this file in /usr/local/ispconfig/server/conf-custom/install/ and make your changes there.

0 commit comments

Comments
 (0)