diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index a4ec514db39eeeaee433ca3962b79014563924f5..4167f0ee960e48e4de152bda6a083d9ff1e9cc38 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -625,6 +625,21 @@ class installer_base { $command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m'; if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $server_ini_rec = $this->db->queryOneRecord("SELECT config FROM server WHERE server_id = ".$conf['server_id']); + $server_ini_array = ini_to_array(stripslashes($server_ini_rec['config'])); + unset($server_ini_rec); + + //* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update + $rbl_list = ''; + if ($server_ini_array['mail']['realtime_blackhole_list'] != '') { + $rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list'])); + foreach ($rbl_hosts as $key => $value) { + $rbl_list .= ", reject_rbl_client ". $value; + } + } + unset($rbl_hosts); + unset($server_ini_array); + $postconf_commands = array ( 'myhostname = '.$conf['hostname'], 'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain', @@ -641,7 +656,7 @@ class installer_base { 'smtpd_sasl_auth_enable = yes', 'broken_sasl_auth_clients = yes', 'smtpd_sasl_authenticated_header = yes', - 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination', + 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination'. $rbl_list, 'smtpd_use_tls = yes', 'smtpd_tls_security_level = may', 'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert', diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 469823c6b371e6a12716b6d9e5edfa85f0e349d5..d7a27e01a7d92c5542a5e80bb4fe66cd98d82197 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -30,6 +30,7 @@ relayhost_user= relayhost_password= mailbox_size_limit=0 message_size_limit=0 +realtime_blackhole_list= [getmail] getmail_config_dir=/etc/getmail diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index fe2a1c66e582b6695ca052e9392572bfdba3437a..1c4683171623eb2e2d922cff54d8903f3124121d 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -282,6 +282,14 @@ $form["tabs"]['mail'] = array( 'width' => '10', 'maxlength' => '15' ), + 'realtime_blackhole_list' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), ################################## # ENDE Datatable fields ################################## diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng index ec91e01c66a6f3a7b96112a31bbfeda932395d23..956abdd818fedcf591a3734b93e15c04c9d0de8b 100644 --- a/interface/web/admin/lib/lang/en_server_config.lng +++ b/interface/web/admin/lib/lang/en_server_config.lng @@ -149,5 +149,6 @@ $wb["do_not_try_rescue_mysql_txt"] = 'Disable MySQL monitoring'; $wb["do_not_try_rescue_mail_txt"] = 'Disable Email monitoring'; $wb["rescue_description_txt"] = 'Information: If you want to shut down mysql you have to select the "Disable MySQL monitor" checkbox and then wait 2-3 minutes.
if you do not wait 2-3 minutes, rescue will try to restart mysql!'; $wb["enable_sni_txt"] = 'Enable SNI'; - +$wb["realtime_blackhole_list_txt"] = 'Real-time Blackhole List'; +$wb["realtime_blackhole_list_note_txt"] = '(Separate RBL\'s with commas)'; ?> \ No newline at end of file diff --git a/interface/web/admin/templates/server_config_mail_edit.htm b/interface/web/admin/templates/server_config_mail_edit.htm index 94dff004590fec093a9e113b62a418f9b48285a0..11399b319e6c303da1699cd4a81064310613a1f8 100644 --- a/interface/web/admin/templates/server_config_mail_edit.htm +++ b/interface/web/admin/templates/server_config_mail_edit.htm @@ -71,6 +71,10 @@  MB +
+ +  {tmpl_var name='realtime_blackhole_list_note_txt'} +
@@ -80,5 +84,4 @@ - diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php index e426eb156d2dd699328a0c4c7db03c3309512cab..98dd6751642e22a2ab073f9b40acc255f79c31a4 100644 --- a/server/plugins-available/postfix_server_plugin.inc.php +++ b/server/plugins-available/postfix_server_plugin.inc.php @@ -106,7 +106,22 @@ class postfix_server_plugin { } else { exec("postconf -e 'relayhost ='"); } - + + if($mail_config['realtime_blackhole_list'] != '') { + $rbl_hosts = explode(",",str_replace(" ", "", $mail_config['realtime_blackhole_list'])); + $options = explode(", ", exec("postconf -h smtpd_recipient_restrictions")); + foreach ($options as $key => $value) { + if (!preg_match('/reject_rbl_client/', $value)) { + $new_options[] = $value; + } + } + foreach ($rbl_hosts as $key => $value) { + $new_options[] = "reject_rbl_client ".$value; + } + + exec("postconf -e 'smtpd_recipient_restrictions = ".implode(", ", $new_options)."'"); + } + exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'");