first working amavis config form

This commit is contained in:
Kay Marquardt (Gnadelwartz)
2018-03-02 17:52:18 +01:00
parent e89e4e5902
commit 159eb9b4f9
8 changed files with 63 additions and 36 deletions

View File

@@ -9,8 +9,6 @@ sub acl_security_form
print "<tr> <td valign=top><b>$text{'acl_avail'}</b></td>\n";
print "<td><select name=avail rows=6 multiple>\n";
local %avail = map { $_, 1 } split(/,/, $_[0]->{'avail'});
foreach $a ('white', 'score', 'report', 'user', 'header', 'priv', 'setup', 'procmail',
'amavisd', 'db', 'awl', 'manual') {
printf "<option value=%s %s>%s</option>\n",

View File

@@ -21,21 +21,53 @@ $conf = &get_amavis_config();
print &text('amavisd_desc'),"<p>\n";
# Find the existing recipe
# Find the existing config
&start_form("save_amavis.cgi", $text{'score_header'});
print &ui_form_start("save_procmail.cgi", "post");
print &ui_table_start(undef, undef, 2);
# spam tag2 level, when is classiefied as spam
$hits = &amavis_find('sa_tag2_level_deflt', $conf);
print &ui_table_row($text{'score_hits'},
&opt_field('sa_tag2_level_deflt', $hits, 7, "6.5"));
# Spam destination inputs
# ....
# amavis quarantine spam level
$hits = &amavis_find('sa_kill_level_deflt', $conf);
print &ui_table_row($text{'amavis_quarantine_level'},
&opt_field('sa_kill_level_deflt', $hits, 7, "6.5"));
use Data::Dump qw(dump);
print "<pre>";
dump(@conf);
print "</pre>";
# amavis delete spam level
$hits = &amavis_find('sa_quarantine_cutoff_level', $conf);
print &ui_table_row($text{'amavis_delete_level'},
&opt_field('sa_quarantine_cutoff_level', $hits, 5, "undef"));
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'amavisd_ok'} ] ]);
print &ui_table_hr();
# should amavis rewrite subject
$rewrite = &amavis_find('sa_spam_modifies_subj', $conf);
print &ui_table_row($text{'report_rewrite'},
&yes_no_field("rewrite_subject", $rewrite, 0));
# do how to modify subject
$hits = &amavis_find('sa_spam_subject_tag', $conf);
print &ui_table_row($text{'report_rsubject'},
&opt_field('sa_spam_subject_tag', $hits, 9, "undef"));
# insert X-Spam header
$hits = &amavis_find('sa_spam_report_header', $conf);
print &ui_table_row($text{'report_rsubject'},
&yes_no_field('sa_spam_report_header', $hits, 0));
# do not check mail larger then
$hits = &amavis_find('sa_mail_body_size_limit', $conf);
print &ui_table_row($text{'amavis_size_limit'},
&opt_field('sa_mail_body_size_limit', $hits, 9, "undef"));
# network checks enabled?
$rewrite = &amavis_find('sa_local_tests_only', $conf);
print &ui_table_row($text{'amavis_local_tests_only'},
&yes_no_field('sa_local_tests_only', $rewrite, 0));
&end_form(undef, $text{'amavisd_ok'});
&ui_print_footer($redirect_url, $text{'index_return'});

View File

@@ -10,7 +10,7 @@ require './spam-lib.pl';
$conf = &get_config();
print "$text{'report_desc'}<p>\n";
print &ui_alert_box($text{'score_other'}, 'info') if ($warn_procmail != 1);
print &ui_alert_box($text{'amavis_warn'}, 'info') if ($warn_procmail != 1);
&start_form("save_report.cgi", $text{'report_header'});
if (&version_atleast(3.0)) {

View File

@@ -16,7 +16,7 @@ print "$text{'score_desc'}<p>\n";
# Required score before considering spam
$hits_param = &version_atleast(3.0) ? "required_score" : "required_hits";
$hits = &find($hits_param, $conf);
$score_other="<br><tt>$text{'amavis_warn'}</tt>" if ($warn_procmail != 1);
$score_other="<br><small><tt>$text{'amavis_warn'}</tt><small>" if ($warn_procmail != 1);
print &ui_table_row($text{'score_hits'}.$score_other,
&opt_field($hits_param, $hits, 5, "5"));

View File

@@ -5,8 +5,7 @@
require './spam-lib.pl';
&ReadParse();
$hsl = $module_info{'usermin'} ? undef :
&help_search_link("spamassassin", "perl", "google");
&set_config_file_in(\%in);
&help_search_link("spamassassin procmail amavisd", "man","doc", "google");
if (!&has_command($config{'spamassassin'}) ||
(!$module_info{'usermin'} && !($vers = &get_spamassassin_version(\$out)))) {

View File

@@ -9,7 +9,11 @@ after_ecmd=Nach dem Speichern-Befehl fehlgeschlagen: $1
amavisd_desc=Das Formular kann verwendet werden, um in der Amavisd-Konfiguration festzulegen wann Nachrichten als unerw&uuml;scht eingestuft und wie diese behandelt werden.
amavisd_ok=&auml;ndere Amavisd Konfiguration
amavisd_title=Amavisd Spam Konfiguration
amavis_warn=Hinweis: Wenn Du Amavisd als Spam Filter benutzt, werden einige Einstellungen ignoriert.
amavis_warn=Wenn Du Amavisd als Spam Filter benutzt, werden einige Einstellungen ignoriert.
amavis_quarantine_level=Spam Wert, ab dem eine Spam-Mail in Quarant&auml;ne geschickt wird.
amavis_delete_level=Spam Wert, ab dem eine Spam-Mail in gel&ouml;scht wird.
amavis_size_limit=Gr&ouml;&szlig;e in Byte ab der eine Mail nicht mehr auf Spam &uuml;berpr&uuml;ft wird.
amavis_local_tests_only=Keine Internet Dienste zum Klassifizieren der Mail verwenden?
apply_err=Konnte &Auml;nderungen nicht anwenden
apply_none=Es wurde kein SpamAssassin-Daemon-Prozess gefunden!
awl_black=Permanentes Ablehnen
@@ -238,10 +242,10 @@ report_leave=Unver&auml;ndert lassen
report_noclear=F&uuml;ge folgenden Test der Standard-Nachricht hinzu ...
report_report=Report, welcher E-Mails angef&uuml;gt wird, die die Spam-Schwelle &uuml;bersteigen
report_rewrite=&Auml;ndere den Betreff-E-Mail-Header von Spam?
report_rfrom=Vor dem From:-Header einstellen
report_rfrom=Spam Markierung vor dem From:-Header.
report_rheader=F&uuml;ge den Report in den X-Spam-Status: E-Mail-Header statt in den Textk&ouml;rper ein?
report_rsubject=Vor dem Betreff:-Header einstellen
report_rto=Vor dem An:-Header einstellen
report_rsubject=Spam Markierung vor dem Betreff:-Header.
report_rto=Spam Markierung vor dem An:-Header.
report_safe2=Ja, als Reintext
report_safe=F&uuml;ge die Original-E-Mail nicht dem Dateianhang hinzu?
report_stars=X-Spam-Level: E-Mail-Header benutzen?

View File

@@ -288,7 +288,11 @@ razor_failed=.. failed! See the error output above for the reason why.
amavisd_title=Amavisd Spam Delivery
amavisd_ok=Change Amavisd Delivery
amavis_desc=The form can be used to change the Amavisd configuration that determines what happens to messages classified as spam.
amavis_warn=Note: If you use Amavisd for Spam filtering, some options will be ignored.
amavis_warn=If you use Amavisd for Spam filtering, some options will be ignored.
amavis_quarantine_level=Hits above which a Spam message is quarantined.
amavis_delete_level=Hits above which a Spam message is deleted.
amavis_size_limit=Message size in bytes above witch a message is not checked for Spam.
amavis_local_tests_only=Disable Internet sources for Spam checks?
procmail_title=Procmail Spam Delivery
procmail_ok=Change Procmail Delivery
procmail_desc=The form can be used to change the Procmail configuration that determines what happens to messages classified as spam.

View File

@@ -13,24 +13,24 @@ local(@rv, $line);
open(CONF, $config{'amavisdconf'});
while(<CONF>) {
s/\r|\n//g;
if (/^\s*#|^\s*$/) { $line++; next; }
if (/^\s*\$(\S+)\s*=\s*"(.*)";/ ||
/^\s*\$(\S+)\s*=\s*'(.*)';/) {
# static config option
# STRING config option
push(@rv, { 'name' => $1,
'value' => &perl_unescape($2),
'line' => $line,
'eline' => $line });
#print "<pre>$line: $1 = $2</pre>";
}
elsif (/^\s*\$(\S+)\s*=\s*(.*);/) {
# computed config option
# VALUE or computed config option
push(@rv, { 'name' => $1,
'value' => $2,
'computed' => 1,
'line' => $line,
'eline' => $line });
#print "<pre>$line: $1 = $2</pre>";
}
# ignore multiline options for now ....
$line++;
}
close(CONF);
@@ -182,15 +182,5 @@ $in{$_[1]} =~ s/\r//g;
&save_amavis_directive($_[0], $_[1], $in{$_[1]}, 1);
}
# amavis_help()
# returns majordomo help link
sub amavis_help
{
local $rv= &help_search_link("amavisd", "man", "doc", "google");
return $rv;
}
1;