Commit a296ae3c authored by marknl's avatar marknl

FS#553 - option to add RBL entries

parent c930e0a4
......@@ -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',
......
......@@ -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
......
......@@ -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
##################################
......
......@@ -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"] = '<b>Information:</b> If you want to shut down mysql you have to select the "Disable MySQL monitor" checkbox and then wait 2-3 minutes.<br>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
......@@ -71,6 +71,10 @@
<label for="message_size_limit">{tmpl_var name='message_size_limit_txt'}</label>
<input name="message_size_limit" id="message_size_limit" value="{tmpl_var name='message_size_limit'}" size="10" maxlength="15" type="text" class="textInput formLengthLimit" />&nbsp;MB
</div>
<div class="ctrlHolder">
<label for="realtime_blackhole_list">{tmpl_var name='realtime_blackhole_list_txt'}</label>
<input name="realtime_blackhole_list" id="realtime_blackhole_list" value="{tmpl_var name='realtime_blackhole_list'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='realtime_blackhole_list_note_txt'}
</div>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
......@@ -80,5 +84,4 @@
<button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_config_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
</div>
</div>
</div>
......@@ -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)."'");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment