Skip to content

Commit 6fe4103

Browse files
committed
2 parents 6c2436e + 9f557dd commit 6fe4103

File tree

7 files changed

+101
-61
lines changed

7 files changed

+101
-61
lines changed

install/dist/tpl/gentoo/amavisd-ispconfig.conf.master

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,24 @@ $LOGFILE = "/var/log/amavis.log"; # (defaults to empty, no log)
9494
$log_level = 0; # (defaults to 0)
9595

9696
$inet_socket_port = [10024,10026];
97-
$forward_method = 'smtp:[127.0.0.1]:10025';
98-
$notify_method = 'smtp:[127.0.0.1]:10027';
97+
98+
# *:* = send to IP/HOST:incoming Port + 1
99+
$forward_method = 'smtp:*:*';
100+
$notify_method = 'smtp:*:*';
101+
99102
$interface_policy{'10026'} = 'ORIGINATING';
100103
$policy_bank{'ORIGINATING'} = {
101104
originating => 1,
102105
smtpd_discard_ehlo_keywords => ['8BITMIME'],
103-
forward_method => 'smtp:[127.0.0.1]:10027',
104106
};
105-
@mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12
106-
192.168.0.0/16);
107+
108+
# IP-Addresses for internal networks => load policy MYNETS
109+
# - requires -o smtp_send_xforward_command=yes in postfix master.cf
110+
@mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 [::1] [FE80::]/10 [FEC0::]/10);
111+
112+
# Allow SMTP access from IPs in @inet_acl to amvisd SMTP Port
113+
@inet_acl = qw( 127.0.0.1 [::1] 192.168.0.0/16 );
114+
107115
$signed_header_fields{'received'} = 0; # turn off signing of Received
108116
$enable_dkim_verification = 1;
109117
$enable_dkim_signing = 1;

install/lib/installer_base.lib.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ public function force_configure_app($service, $enable_force=true) {
175175
return $force;
176176
}
177177

178+
public function reconfigure_app($service, $reconfigure_services_answer) {
179+
$reconfigure = false;
180+
if ($reconfigure_services_answer != 'selected') {
181+
$reconfigure = true;
182+
} else {
183+
if(strtolower($this->simple_query("Reconfigure $service", array('y', 'n'), 'y') ) == 'y') {
184+
$reconfigure = true;
185+
} else {
186+
swriteln("Skip reconfigure $service\n");
187+
}
188+
}
189+
return $reconfigure;
190+
}
178191

179192
/** Create the database for ISPConfig */
180193

install/tpl/amavisd_user_config.master

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,24 @@ $LOGFILE = "/var/log/amavis.log"; # (defaults to empty, no log)
7676
$log_level = 0; # (defaults to 0)
7777

7878
$inet_socket_port = [10024,10026];
79-
$forward_method = 'smtp:[127.0.0.1]:10025';
80-
$notify_method = 'smtp:[127.0.0.1]:10027';
79+
80+
# *:* = send to IP/HOST:incoming Port + 1
81+
$forward_method = 'smtp:*:*';
82+
$notify_method = 'smtp:*:*';
8183
$interface_policy{'10026'} = 'ORIGINATING';
8284
$policy_bank{'ORIGINATING'} = {
8385
originating => 1,
8486
smtpd_discard_ehlo_keywords => ['8BITMIME'],
85-
forward_method => 'smtp:[127.0.0.1]:10027',
8687
};
87-
@mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12
88-
192.168.0.0/16);
8988

90-
# DKIM
89+
# IP-Addresses for internal networks => load policy MYNETS
90+
# - requires -o smtp_send_xforward_command=yes in postfix master.cf
91+
@mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 [::1] [FE80::]/10 [FEC0::]/10);
9192

93+
# Allow SMTP access from IPs in @inet_acl to amvisd SMTP Port
94+
@inet_acl = qw( 127.0.0.1 [::1] 192.168.0.0/16 );
95+
96+
# DKIM
9297
$enable_dkim_verification = 1;
9398
$enable_dkim_signing = 1; # load DKIM signing code
9499
$signed_header_fields{'received'} = 0; # turn off signing of Received

install/update.php

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -300,30 +300,35 @@
300300
//}
301301

302302
//** Shall the services be reconfigured during update
303-
$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no'), 'yes','reconfigure_services');
303+
$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no', 'selected'), 'yes','reconfigure_services');
304304

305-
if($reconfigure_services_answer == 'yes') {
305+
if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'selected') {
306306

307307
if($conf['services']['mail']) {
308+
308309
//** Configure postfix
309-
swriteln('Configuring Postfix');
310-
$inst->configure_postfix('dont-create-certs');
310+
if($inst->reconfigure_app('Postfix', $reconfigure_services_answer)) {
311+
swriteln('Configuring Postfix');
312+
$inst->configure_postfix('dont-create-certs');
313+
}
311314

312315
//** Configure mailman
313-
if($conf['mailman']['installed'] == true) {
316+
if($conf['mailman']['installed'] == true && $inst->reconfigure_app('Mailman', $reconfigure_services_answer)) {
314317
swriteln('Configuring Mailman');
315318
$inst->configure_mailman('update');
316319
}
317320

318321
//* Configure Jailkit
319-
swriteln('Configuring Jailkit');
320-
$inst->configure_jailkit();
322+
if($inst->reconfigure_app('Jailkit', $reconfigure_services_answer)) {
323+
swriteln('Configuring Jailkit');
324+
$inst->configure_jailkit();
325+
}
321326

322-
if($conf['dovecot']['installed'] == true) {
327+
if($conf['dovecot']['installed'] == true && $inst->reconfigure_app('Dovecot', $reconfigure_services_answer)) {
323328
//* Configure dovecot
324329
swriteln('Configuring Dovecot');
325330
$inst->configure_dovecot();
326-
} else {
331+
} elseif ($conf['courier']['installed'] == true && $inst->reconfigure_app('Courier', $reconfigure_services_answer)) {
327332
//** Configure saslauthd
328333
swriteln('Configuring SASL');
329334
$inst->configure_saslauthd();
@@ -338,27 +343,25 @@
338343
}
339344

340345
//** Configure Spamasassin
341-
swriteln('Configuring Spamassassin');
342-
$inst->configure_spamassassin();
346+
if($inst->reconfigure_app('Spamassassin', $reconfigure_services_answer)) {
347+
swriteln('Configuring Spamassassin');
348+
$inst->configure_spamassassin();
349+
}
343350

344351
//** Configure Amavis
345-
if($conf['amavis']['installed'] == true) {
352+
if($conf['amavis']['installed'] == true && $inst->reconfigure_app('Amavisd', $reconfigure_services_answer)) {
346353
swriteln('Configuring Amavisd');
347354
$inst->configure_amavis();
348355
}
349356

350357
//** Configure Getmail
351-
swriteln('Configuring Getmail');
352-
$inst->configure_getmail();
353-
}
354-
355-
if($conf['services']['web'] && $conf['pureftpd']['installed'] == true) {
356-
//** Configure Pureftpd
357-
swriteln('Configuring Pureftpd');
358-
$inst->configure_pureftpd();
358+
if ($inst->reconfigure_app('Getmail', $reconfigure_services_answer)) {
359+
swriteln('Configuring Getmail');
360+
$inst->configure_getmail();
361+
}
359362
}
360363

361-
if($conf['services']['dns']) {
364+
if($conf['services']['dns'] && $inst->reconfigure_app('DNS', $reconfigure_services_answer)) {
362365
//* Configure DNS
363366
if($conf['powerdns']['installed'] == true) {
364367
swriteln('Configuring PowerDNS');
@@ -373,37 +376,40 @@
373376
}
374377

375378
if($conf['services']['web']) {
376-
if($conf['webserver']['server_type'] == 'apache'){
377-
//** Configure Apache
378-
swriteln('Configuring Apache');
379-
$inst->configure_apache();
380-
381-
//** Configure vlogger
382-
swriteln('Configuring vlogger');
383-
$inst->configure_vlogger();
384-
} else {
385-
//** Configure nginx
386-
swriteln('Configuring nginx');
387-
$inst->configure_nginx();
379+
380+
if($conf['pureftpd']['installed'] == true && $inst->reconfigure_app('Pureftpd', $reconfigure_services_answer)) {
381+
//** Configure Pureftpd
382+
swriteln('Configuring Pureftpd');
383+
$inst->configure_pureftpd();
388384
}
389385

390-
//** Configure apps vhost
391-
swriteln('Configuring Apps vhost');
392-
$inst->configure_apps_vhost();
393-
}
386+
if($inst->reconfigure_app('Web-Server', $reconfigure_services_answer)) {
387+
if($conf['webserver']['server_type'] == 'apache'){
388+
//** Configure Apache
389+
swriteln('Configuring Apache');
390+
$inst->configure_apache();
391+
392+
//** Configure vlogger
393+
swriteln('Configuring vlogger');
394+
$inst->configure_vlogger();
395+
} else {
396+
//** Configure nginx
397+
swriteln('Configuring nginx');
398+
$inst->configure_nginx();
399+
}
400+
401+
//** Configure apps vhost
402+
swriteln('Configuring Apps vhost');
403+
$inst->configure_apps_vhost();
404+
}
405+
}
394406

395-
if($conf['services']['xmpp']) {
407+
if($conf['services']['xmpp'] && $inst->reconfigure_app('XMPP', $reconfigure_services_answer)) {
396408
//** Configure Metronome XMPP
397409
$inst->configure_xmpp('dont-create-certs');
398410
}
399411

400-
401-
//* Configure DBServer
402-
swriteln('Configuring Database');
403-
$inst->configure_dbserver();
404-
405-
406-
if($conf['services']['firewall']) {
412+
if($conf['services']['firewall'] && $inst->reconfigure_app('Firewall', $reconfigure_services_answer)) {
407413
if($conf['ufw']['installed'] == true) {
408414
//* Configure Ubuntu Firewall
409415
$conf['services']['firewall'] = true;
@@ -416,6 +422,10 @@
416422
}
417423
}
418424

425+
//* Configure DBServer
426+
swriteln('Configuring Database');
427+
$inst->configure_dbserver();
428+
419429
/*
420430
if($conf['squid']['installed'] == true) {
421431
swriteln('Configuring Squid');

interface/web/mail/mail_domain_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function onShowEnd() {
210210
$sql = "SELECT domain, dkim_private, dkim_public, dkim_selector FROM mail_domain WHERE domain_id = ?";
211211
$rec = $app->db->queryOneRecord($sql, $app->functions->intval($_GET['id']));
212212
$dns_key = str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$rec['dkim_public']);
213-
$dns_record = '.' . $rec['dkim_selector'] . '_domainkey._' . $rec['domain'] . '. 3600 TXT v=DKIM1; t=s; p=' . $dns_key;
213+
$dns_record = $rec['dkim_selector'] . '._domainkey.' . $rec['domain'] . '. 3600 TXT v=DKIM1; t=s; p=' . $dns_key;
214214
$app->tpl->setVar('dkim_selector', $rec['dkim_selector']);
215215
$app->tpl->setVar('dkim_private', $rec['dkim_private']);
216216
$app->tpl->setVar('dkim_public', $rec['dkim_public']);

server/lib/classes/monitor_tools.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ public function send_notification_email($template, $placeholders, $recipients) {
702702
$mailSubject = '';
703703
$inHeader = true;
704704
for($l = 0; $l < count($lines); $l++) {
705-
if($lines[$l] == '') {
705+
if(trim($lines[$l]) == '') {
706706
$inHeader = false;
707707
continue;
708708
}

server/plugins-available/mail_plugin_dkim.inc.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ function check_system($data) {
122122
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
123123
if ( isset($mail_config['dkim_path']) &&
124124
!empty($mail_config['dkim_path']) &&
125-
isset($data['new']['dkim_private']) &&
126-
!empty($data['new']['dkim_private']) &&
125+
// isset($data['new']['dkim_private']) &&
126+
// !empty($data['new']['dkim_private']) &&
127127
$mail_config['dkim_path'] != '/'
128128
) {
129129
if (!is_dir($mail_config['dkim_path'])) {
@@ -199,6 +199,10 @@ function restart_amavis() {
199199
function write_dkim_key($key_file, $key_value, $key_domain) {
200200
global $app, $mailconfig;
201201
$success=false;
202+
if ($key_file == '' || $key_value == '' || $key_domain == '') {
203+
$app->log('DKIM internal error for domain '.$key_domain, LOGLEVEL_ERROR);
204+
return $success;
205+
}
202206
if ( $app->system->file_put_contents($key_file.'.private', $key_value) ) {
203207
$app->log('Saved DKIM Private-key to '.$key_file.'.private', LOGLEVEL_DEBUG);
204208
$success=true;
@@ -211,7 +215,7 @@ function write_dkim_key($key_file, $key_value, $key_domain) {
211215
$app->log('Saved DKIM Public to '.$key_domain.'.', LOGLEVEL_DEBUG);
212216
else $app->log('Unable to save DKIM Public to '.$key_domain.'.', LOGLEVEL_DEBUG);
213217
} else {
214-
$app->log('Unable to save DKIM Privte-key to '.$key_file.'.private', LOGLEVEL_ERROR);
218+
$app->log('Unable to save DKIM Private-key to '.$key_file.'.private', LOGLEVEL_ERROR);
215219
}
216220
return $success;
217221
}

0 commit comments

Comments
 (0)