Skip to content

Commit 3cabaa6

Browse files
author
Till Brehm
committed
Fixed #5343 Buster/Dovecot stats-writer
1 parent b951b64 commit 3cabaa6

File tree

7 files changed

+132
-0
lines changed

7 files changed

+132
-0
lines changed

install/dist/lib/debian60.lib.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ public function configure_dovecot()
136136
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
137137
}
138138
}
139+
//remove #2.3+ comment
140+
$content = file_get_contents($config_dir.'/'.$configfile);
141+
$content = str_replace('#2.3+','',$content);
142+
file_put_contents($config_dir.'/'.$configfile,$content);
143+
unset($content);
144+
139145
} else {
140146
// remove settings which are not supported in Dovecot < 2.3
141147
removeLine($config_dir.'/'.$configfile, 'ssl_min_protocol =');

install/dist/lib/fedora.lib.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,38 @@ public function configure_dovecot()
449449
file_put_contents($config_dir.'/'.$configfile,$content);
450450
unset($content);
451451
}
452+
if(version_compare($dovecot_version,2.3) >= 0) {
453+
// Remove deprecated setting(s)
454+
removeLine($config_dir.'/'.$configfile, 'ssl_protocols =');
455+
456+
// Check if we have a dhparams file and if not, create it
457+
if(!file_exists('/etc/dovecot/dh.pem')) {
458+
swriteln('Creating new DHParams file, this takes several minutes. Do not interrupt the script.');
459+
if(file_exists('/var/lib/dovecot/ssl-parameters.dat')) {
460+
// convert existing ssl parameters file
461+
$command = 'dd if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dhparam -inform der > /etc/dovecot/dh.pem';
462+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
463+
} else {
464+
/*
465+
Create a new dhparams file. We use 2048 bit only as it simply takes too long
466+
on smaller systems to generate a 4096 bit dh file (> 30 minutes). If you need
467+
a 4096 bit file, create it manually before you install ISPConfig
468+
*/
469+
$command = 'openssl dhparam -out /etc/dovecot/dh.pem 2048';
470+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
471+
}
472+
}
473+
//remove #2.3+ comment
474+
$content = file_get_contents($config_dir.'/'.$configfile);
475+
$content = str_replace('#2.3+','',$content);
476+
file_put_contents($config_dir.'/'.$configfile,$content);
477+
unset($content);
478+
479+
} else {
480+
// remove settings which are not supported in Dovecot < 2.3
481+
removeLine($config_dir.'/'.$configfile, 'ssl_min_protocol =');
482+
removeLine($config_dir.'/'.$configfile, 'ssl_dh =');
483+
}
452484
replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
453485
replaceLine($config_dir.'/'.$configfile, 'postmaster_address = webmaster@localhost', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
454486
} else {

install/lib/installer_base.lib.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,38 @@ public function configure_dovecot() {
13041304
file_put_contents($config_dir.'/'.$configfile,$content);
13051305
unset($content);
13061306
}
1307+
if(version_compare($dovecot_version,2.3) >= 0) {
1308+
// Remove deprecated setting(s)
1309+
removeLine($config_dir.'/'.$configfile, 'ssl_protocols =');
1310+
1311+
// Check if we have a dhparams file and if not, create it
1312+
if(!file_exists('/etc/dovecot/dh.pem')) {
1313+
swriteln('Creating new DHParams file, this takes several minutes. Do not interrupt the script.');
1314+
if(file_exists('/var/lib/dovecot/ssl-parameters.dat')) {
1315+
// convert existing ssl parameters file
1316+
$command = 'dd if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dhparam -inform der > /etc/dovecot/dh.pem';
1317+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1318+
} else {
1319+
/*
1320+
Create a new dhparams file. We use 2048 bit only as it simply takes too long
1321+
on smaller systems to generate a 4096 bit dh file (> 30 minutes). If you need
1322+
a 4096 bit file, create it manually before you install ISPConfig
1323+
*/
1324+
$command = 'openssl dhparam -out /etc/dovecot/dh.pem 2048';
1325+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1326+
}
1327+
}
1328+
//remove #2.3+ comment
1329+
$content = file_get_contents($config_dir.'/'.$configfile);
1330+
$content = str_replace('#2.3+','',$content);
1331+
file_put_contents($config_dir.'/'.$configfile,$content);
1332+
unset($content);
1333+
1334+
} else {
1335+
// remove settings which are not supported in Dovecot < 2.3
1336+
removeLine($config_dir.'/'.$configfile, 'ssl_min_protocol =');
1337+
removeLine($config_dir.'/'.$configfile, 'ssl_dh =');
1338+
}
13071339
}
13081340

13091341
//* dovecot-lmtpd

install/tpl/debian6_dovecot2.conf.master

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,20 @@ protocol lmtp {
6868
postmaster_address = webmaster@localhost
6969
mail_plugins = quota sieve
7070
}
71+
72+
mail_plugins = $mail_plugins quota
73+
74+
#2.3+ service stats {
75+
#2.3+ unix_listener stats-reader {
76+
#2.3+ user = vmail
77+
#2.3+ group = vmail
78+
#2.3+ mode = 0660
79+
#2.3+ }
80+
#2.3+
81+
#2.3+ unix_listener stats-writer {
82+
#2.3+ user = vmail
83+
#2.3+ group = vmail
84+
#2.3+ mode = 0660
85+
#2.3+ }
86+
#2.3+ }
87+

install/tpl/debian_dovecot2.conf.master

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,19 @@ protocol lmtp {
6464
postmaster_address = webmaster@localhost
6565
mail_plugins = quota sieve
6666
}
67+
6768
mail_plugins = $mail_plugins quota
69+
70+
#2.3+ service stats {
71+
#2.3+ unix_listener stats-reader {
72+
#2.3+ user = vmail
73+
#2.3+ group = vmail
74+
#2.3+ mode = 0660
75+
#2.3+ }
76+
#2.3+
77+
#2.3+ unix_listener stats-writer {
78+
#2.3+ user = vmail
79+
#2.3+ group = vmail
80+
#2.3+ mode = 0660
81+
#2.3+ }
82+
#2.3+ }

install/tpl/fedora_dovecot2.conf.master

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,19 @@ protocol lmtp {
6161
postmaster_address = webmaster@localhost
6262
mail_plugins = quota sieve
6363
}
64+
6465
mail_plugins = $mail_plugins quota
66+
67+
#2.3+ service stats {
68+
#2.3+ unix_listener stats-reader {
69+
#2.3+ user = vmail
70+
#2.3+ group = vmail
71+
#2.3+ mode = 0660
72+
#2.3+ }
73+
#2.3+
74+
#2.3+ unix_listener stats-writer {
75+
#2.3+ user = vmail
76+
#2.3+ group = vmail
77+
#2.3+ mode = 0660
78+
#2.3+ }
79+
#2.3+ }

install/tpl/opensuse_dovecot2.conf.master

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,19 @@ protocol lmtp {
6060
postmaster_address = webmaster@localhost
6161
mail_plugins = quota sieve
6262
}
63+
6364
mail_plugins = $mail_plugins quota
65+
66+
#2.3+ service stats {
67+
#2.3+ unix_listener stats-reader {
68+
#2.3+ user = vmail
69+
#2.3+ group = vmail
70+
#2.3+ mode = 0660
71+
#2.3+ }
72+
#2.3+
73+
#2.3+ unix_listener stats-writer {
74+
#2.3+ user = vmail
75+
#2.3+ group = vmail
76+
#2.3+ mode = 0660
77+
#2.3+ }
78+
#2.3+ }

0 commit comments

Comments
 (0)