Skip to content

Commit cda177a

Browse files
author
Marius Burkard
committed
- fixed vhost settings for nginx
- fixed rspamd settings - fixed errors in webserver plugin - fixed error in dkim domain handling
1 parent 41b988f commit cda177a

File tree

9 files changed

+39
-24
lines changed

9 files changed

+39
-24
lines changed

install/tpl/nginx_ispconfig.vhost.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ server {
22
listen {vhost_port}{ssl_on};
33
listen [::]:{vhost_port} ipv6only=on{ssl_on};
44

5-
{ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
5+
{ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
66
{ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
77
{ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
88
{ssl_comment}ssl_ciphers 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';

install/tpl/rspamd_users.conf.master

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ settings {
44
authenticated = yes;
55
#apply "default" { groups_disabled = ["rbl", "spf"]; }
66
apply "default" {
7-
symbols_enabled = [];
7+
#symbols_enabled = [];
88
symbols_disabled = [];
9-
groups_enabled = [];
10-
groups_disabled = [];
9+
#groups_enabled = [];
10+
groups_disabled = ["rbl"];
1111
}
1212
}
1313
whitelist {

interface/web/mail/mail_domain_edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function onAfterInsert() {
318318
$soaDomain = $this->dataRecord['domain'].'.';
319319
while ((!isset($soa) && (substr_count($soaDomain,'.') > 1))) {
320320
$soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $soaDomain);
321-
$soaDomain = preg_replace("/^\w+\./","",$soaDomain);
321+
$soaDomain = preg_replace("/^[^\.]+\./","",$soaDomain);
322322
}
323323
if ( isset($soa) && !empty($soa) ) $this->update_dns($this->dataRecord, $soa);
324324
}
@@ -444,7 +444,7 @@ function onAfterUpdate() {
444444
$soaDomain = $this->dataRecord['domain'].'.';
445445
while ((!isset($soa) && (substr_count($soaDomain,'.') > 1))) {
446446
$soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $soaDomain);
447-
$soaDomain = preg_replace("/^\w+\./","",$soaDomain);
447+
$soaDomain = preg_replace("/^[^\.]+\./","",$soaDomain);
448448
}
449449

450450
if ( ($selector || $dkim_private || $dkim_active) && $dkim_active )

server/conf/nginx_vhost.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ server {
2828
</tmpl_if>
2929
</tmpl_if>
3030
listen <tmpl_var name='ip_address'>:<tmpl_var name='https_port'> ssl{tmpl_if name='enable_http2' op='==' value='y'} http2{/tmpl_if}{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if};
31-
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
31+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
3232
# ssl_ciphers 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
3333
# ssl_prefer_server_ciphers on;
3434
<tmpl_if name='ipv6_enabled'>

server/lib/classes/plugin_webserver_base.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ public function eventDelete($event_name, $data, $server_type = 'apache') {
17191719
$this->action = 'update';
17201720
$this->update_letsencrypt = true;
17211721
// just run the update function
1722-
$this->update($event_name, $data);
1722+
$this->eventUpdate($event_name, $data, 'update', $server_type);
17231723

17241724
} else {
17251725
$conf_prefix = '';

server/lib/classes/plugin_webserver_nginx.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ public function processRewriteRules(&$tpl, &$data, &$vhost_data) {
632632
if(count($server_alias) > 0) {
633633
$server_alias_str = '';
634634
foreach($server_alias as $tmp_alias) {
635-
$server_alias_str .= $tmp_alias;
635+
$server_alias_str .= ' ' . $tmp_alias;
636636
}
637637
unset($tmp_alias);
638638

server/plugins-available/mail_plugin_dkim.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ function get_amavis_config() {
104104
function check_system($data) {
105105
global $app, $mail_config;
106106

107+
/** TODO: FIX IF ONLY RSPAMD IS INSTALLED AND NO AMAVIS! **/
108+
107109
$app->uses('getconf');
108110
$check=true;
109111

server/plugins-available/nginx_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function update($event_name, $data) {
9898

9999
if($this->action != 'insert') $this->action = 'update';
100100

101-
$app->plugins_webserver_base->eventUpdate($event_name, $data, 'nginx');
101+
$app->plugin_webserver_base->eventUpdate($event_name, $data, $this->action, 'nginx');
102102

103103
//* Unset action to clean it for next processed vhost.
104104
$this->action = '';

server/plugins-available/rspamd_plugin.inc.php

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function spamfilter_users_update($event_name, $data) {
8888
$app->uses('getconf,system,functions');
8989
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
9090

91-
if($mail_config['content_filter'] == 'rspamd'){
91+
if(is_dir('/etc/rspamd')) {
9292
$policy = $app->db->queryOneRecord("SELECT * FROM spamfilter_policy WHERE id = ?", intval($data['new']['policy_id']));
9393

9494
//* Create the config file
@@ -129,10 +129,14 @@ function spamfilter_users_update($event_name, $data) {
129129

130130
$app->system->file_put_contents($user_file, $tpl->grab());
131131
} else {
132-
if(is_file($user_file)) unlink($user_file);
132+
if(is_file($user_file)) {
133+
unlink($user_file);
134+
}
135+
}
136+
137+
if($mail_config['content_filter'] == 'rspamd'){
138+
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
133139
}
134-
//if(is_file('/etc/init.d/rspamd')) exec('/etc/init.d/rspamd reload &> /dev/null');
135-
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
136140
}
137141
}
138142

@@ -143,11 +147,14 @@ function spamfilter_users_delete($event_name, $data) {
143147
$app->uses('getconf');
144148
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
145149

146-
if($mail_config['content_filter'] == 'rspamd'){
150+
if(is_dir('/etc/rspamd')) {
147151
//* delete the config file
148152
$user_file = $this->users_config_dir.'spamfilter_user_'.intval($data['old']['id']).'.conf';
149153
if(is_file($user_file)) unlink($user_file);
150-
//if(is_file('/etc/init.d/rspamd')) exec('/etc/init.d/rspamd reload &> /dev/null');
154+
155+
}
156+
157+
if($mail_config['content_filter'] == 'rspamd') {
151158
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
152159
}
153160
}
@@ -166,7 +173,7 @@ function spamfilter_wblist_update($event_name, $data) {
166173
$app->uses('getconf,system,functions');
167174
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
168175

169-
if($mail_config['content_filter'] == 'rspamd'){
176+
if(is_dir('/etc/rspamd')) {
170177
$recipient = $app->db->queryOneRecord("SELECT email FROM spamfilter_users WHERE id = ?", intval($data['new']['rid']));
171178
//* Create the config file
172179
$wblist_file = $this->users_config_dir.'spamfilter_wblist_'.intval($data['new']['wblist_id']).'.conf';
@@ -191,8 +198,10 @@ function spamfilter_wblist_update($event_name, $data) {
191198
} else {
192199
if(is_file($wblist_file)) unlink($wblist_file);
193200
}
194-
//if(is_file('/etc/init.d/rspamd')) exec('/etc/init.d/rspamd reload &> /dev/null');
195-
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
201+
202+
if($mail_config['content_filter'] == 'rspamd'){
203+
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
204+
}
196205
}
197206
}
198207

@@ -202,12 +211,14 @@ function spamfilter_wblist_delete($event_name, $data) {
202211
$app->uses('getconf');
203212
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
204213

205-
if($mail_config['content_filter'] == 'rspamd'){
214+
if(is_dir('/etc/rspamd')) {
206215
//* delete the config file
207216
$wblist_file = $this->users_config_dir.'spamfilter_wblist_'.intval($data['old']['wblist_id']).'.conf';
208217
if(is_file($wblist_file)) unlink($wblist_file);
209-
//if(is_file('/etc/init.d/rspamd')) exec('/etc/init.d/rspamd reload &> /dev/null');
210-
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
218+
219+
if($mail_config['content_filter'] == 'rspamd'){
220+
if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload');
221+
}
211222
}
212223
}
213224

@@ -220,7 +231,7 @@ function server_ip($event_name, $data) {
220231

221232
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
222233

223-
if($mail_config['content_filter'] == 'rspamd'){
234+
if(is_dir('/etc/rspamd')) {
224235
$tpl = new tpl();
225236
$tpl->newTemplate('rspamd_users.conf.master');
226237

@@ -234,7 +245,9 @@ function server_ip($event_name, $data) {
234245
$tpl->setLoop('whitelist_ips', $whitelist_ips);
235246
$app->system->file_put_contents('/etc/rspamd/local.d/users.conf', $tpl->grab());
236247

237-
$app->services->restartServiceDelayed('rspamd', 'reload');
248+
if($mail_config['content_filter'] == 'rspamd'){
249+
$app->services->restartServiceDelayed('rspamd', 'reload');
250+
}
238251
}
239252
}
240253

0 commit comments

Comments
 (0)