initial commit of file from CVS for smeserver-spamassassin on Mon 10 Jul 08:42:51 BST 2023
This commit is contained in:
@@ -0,0 +1 @@
|
||||
yes
|
@@ -0,0 +1 @@
|
||||
all
|
@@ -0,0 +1 @@
|
||||
all
|
@@ -0,0 +1 @@
|
||||
0
|
@@ -0,0 +1 @@
|
||||
0
|
@@ -0,0 +1 @@
|
||||
medium
|
@@ -0,0 +1 @@
|
||||
0
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
[SPAM]
|
@@ -0,0 +1 @@
|
||||
disabled
|
@@ -0,0 +1 @@
|
||||
5
|
@@ -0,0 +1 @@
|
||||
0
|
@@ -0,0 +1 @@
|
||||
disabled
|
@@ -0,0 +1 @@
|
||||
service
|
46
root/etc/e-smith/db/configuration/migrate/10spamassassin
Normal file
46
root/etc/e-smith/db/configuration/migrate/10spamassassin
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
my $sa = $DB->get("spamassassin") or return;
|
||||
|
||||
my %old2new = (
|
||||
required_hits => "TagLevel",
|
||||
skip_rbl_checks => "SkipRBLChecks",
|
||||
sort_spam => "SortSpam",
|
||||
use_bayes => "UseBayes",
|
||||
);
|
||||
|
||||
for my $key (keys %old2new)
|
||||
{
|
||||
next unless (exists $spamassassin{$key});
|
||||
|
||||
my $value = $DB->get_prop_and_delete('spamassassin', $key);
|
||||
|
||||
$DB->set_prop('spamassassin', $old2new{$key}, $value);
|
||||
}
|
||||
|
||||
my $sortspam = $DB->get_prop('spamassassin', 'SortSpam');
|
||||
|
||||
if ($sortspam eq "0" or $sortspam eq "1")
|
||||
{
|
||||
$DB->set_prop('spamassassin', 'SortSpam',
|
||||
($sortspam eq "1") ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
my $value = $DB->get_prop_and_delete('spamassassin', 'rewrite_subject');
|
||||
|
||||
if (defined $value)
|
||||
{
|
||||
$DB->set_prop('spamassassin', 'SubjectTag',
|
||||
($value ? 'enabled' : 'disabled'));
|
||||
}
|
||||
|
||||
# migrate only interesting value from spamd and delete it
|
||||
my $spamd = $DB->get("spamd");
|
||||
if ($spamd){
|
||||
my $SpamLearning = $DB->get_prop('spamassassin', 'SpamLearning') || "empty";
|
||||
if ( exists $spamd{'SpamLearning'} && ! exists $spamassassin{'SpamLearning'} ) {
|
||||
$DB->set_prop('spamassassin', 'SpamLearning', $spamd{'SpamLearning'});
|
||||
}
|
||||
$spamd->delete;
|
||||
}
|
||||
|
||||
}
|
11
root/etc/e-smith/db/configuration/migrate/20sortspam
Normal file
11
root/etc/e-smith/db/configuration/migrate/20sortspam
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
my $dt = $DB->get_prop("qmail", "DeliveryType");
|
||||
my $di = $DB->get_prop("qmail", "DeliveryInstruction");
|
||||
|
||||
return unless ($dt and $di);
|
||||
|
||||
return unless ($dt eq 'program' and $di eq 'sortspam');
|
||||
|
||||
$DB->set_prop("qmail", "DeliveryType", "");
|
||||
$DB->set_prop("qmail", "DeliveryInstruction", "");
|
||||
}
|
@@ -0,0 +1 @@
|
||||
list
|
@@ -0,0 +1 @@
|
||||
list
|
16
root/etc/e-smith/templates-user/.qmail/15sortspam
Normal file
16
root/etc/e-smith/templates-user/.qmail/15sortspam
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
use esmith::AccountsDB;
|
||||
|
||||
my $db = esmith::AccountsDB->open_ro or return "# AccountsDB: open failed";
|
||||
|
||||
my $user = $db->get($USERNAME) or return "# AccountsDB: No user $USERNAME";
|
||||
|
||||
my $do_sortspam = $user->prop('SortSpam')
|
||||
|| $spamassassin{SortSpam}
|
||||
|| "enabled";
|
||||
|
||||
return "# sortspam disabled" unless ($do_sortspam eq "enabled");
|
||||
|
||||
return qq(| condredirect $USERNAME-junkmail headermatch 'X-Spam-Status: Yes');
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
return "dns_available " . ($spamassassin{DNSAvailable} || 'yes');
|
||||
}
|
@@ -0,0 +1 @@
|
||||
{ "internal_networks $LocalIP" }
|
@@ -0,0 +1 @@
|
||||
{ "lock_method flock" }
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
$langs = ($spamassassin{OkLanguages} || 'all');
|
||||
return "" if $langs eq 'all';
|
||||
$OUT = "loadplugin Mail::SpamAssassin::Plugin::TextCat\n";
|
||||
$OUT .= "ok_languages $langs";
|
||||
return $OUT;
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
return "ok_locales " . ($spamassassin{OkLocales} || 'all');
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
bayes_path /var/spool/spamd/.spamassassin/bayes
|
||||
bayes_file_mode 750
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
return "report_safe " . ($spamassassin{ReportSafe} || 0);
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
{
|
||||
my $sens = $spamassassin{Sensitivity} || 'medium';
|
||||
|
||||
my %sens2hits = (
|
||||
'veryhigh' => 2,
|
||||
'high' => 3,
|
||||
'medium' => 5,
|
||||
'low' => 7,
|
||||
'verylow' => 9,
|
||||
);
|
||||
|
||||
my $hits = ($sens eq 'custom') ? $spamassassin{TagLevel}
|
||||
: $sens2hits{$sens};
|
||||
|
||||
return "required_score $hits";
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
return "" unless ($spamassassin{SubjectTag} eq 'enabled');
|
||||
|
||||
return "" unless ($spamassassin{Subject});
|
||||
|
||||
return "rewrite_header Subject $spamassassin{Subject}";
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
return "skip_rbl_checks " . ($spamassassin{SkipRBLChecks} || 0);
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
{
|
||||
$OUT = "clear_trusted_networks\n";
|
||||
$OUT .= "trusted_networks $LocalIP " . ($spamassassin{TrustedNetworks} || '');
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
if (($spamassassin{UseAutoWhitelist} || "0") eq "1")
|
||||
{
|
||||
$OUT = "use_auto_whitelist 1\n";
|
||||
$OUT .= "auto_whitelist_path /var/spool/spamd/.spamassassin/auto-whitelist\n";
|
||||
$OUT .= "auto_whitelist_file_mode 750\n";
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
return "use_bayes " . ($spamassassin{UseBayes} || 0);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
{
|
||||
return "# bayes disabled" unless $spamassassin{UseBayes};
|
||||
|
||||
my $AutoLearn = $spamassassin{UseBayesAutoLearn} || 0;
|
||||
# default SA value of 12 is too high
|
||||
my $BayesAutoLearnThresholdSpam = $spamassassin{'BayesAutoLearnThresholdSpam'}||6;
|
||||
# 0.10 is spamassassin default but it is too high, set to -1.15.
|
||||
my $BayesAutoLearnThresholdNonspam = $spamassassin{'BayesAutoLearnThresholdNonSpam'}|| -1.15;
|
||||
|
||||
# should get at least 6: 3 from body and 3 from header.
|
||||
# http://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Plugin_AutoLearnThreshold.html
|
||||
$BayesAutoLearnThresholdSpam = 6 unless $BayesAutoLearnThresholdSpam >= 6;
|
||||
|
||||
$OUT = "bayes_auto_learn $AutoLearn\n";
|
||||
return unless $AutoLearn == 1;
|
||||
$OUT .= "bayes_auto_learn_threshold_nonspam $BayesAutoLearnThresholdNonspam\n";
|
||||
$OUT .= "bayes_auto_learn_threshold_spam $BayesAutoLearnThresholdSpam\n";
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ autolearn=_AUTOLEARN_
|
||||
add_header all Details _REPORT_
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
my $pyzor_timeout = ($spamassassin{PyzorTimeout} || 0);
|
||||
if ($pyzor_timeout ne '0')
|
||||
{
|
||||
return "pyzor_timeout " . ($pyzor_timeout);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
{
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $dbh = esmith::ConfigDB->open_ro('spamassassin')
|
||||
|| die "Unable to open spamassassin configuration dbase.";
|
||||
my %wbl = $dbh->get('wbl.global')->props;
|
||||
|
||||
$OUT = '';
|
||||
my $parameter = "";
|
||||
my $value = "";
|
||||
while (($parameter,$value) = each(%wbl)) {
|
||||
if ($parameter eq "type") {next;}
|
||||
|
||||
if ($value eq "White") {
|
||||
$OUT .= "whitelist_from " . $parameter . "\n";
|
||||
} elsif ($value eq "Black") {
|
||||
$OUT .= "blacklist_from " . $parameter . "\n";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
{
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $dbh = esmith::ConfigDB->open_ro('spamassassin')
|
||||
|| die "Unable to open spamassassin configuration dbase.";
|
||||
my %wbl = $dbh->get('wbl.global_to')->props;
|
||||
|
||||
$OUT = '';
|
||||
my $parameter = "";
|
||||
my $value = "";
|
||||
while (($parameter,$value) = each(%wbl)) {
|
||||
if ($parameter eq "type") {next;}
|
||||
|
||||
if ($value eq "White") {
|
||||
$OUT .= "whitelist_to " . $parameter . "\n";
|
||||
} elsif ($value eq "Black") {
|
||||
$OUT .= "blacklist_to " . $parameter . "\n";
|
||||
}
|
||||
}
|
||||
}
|
5
root/etc/e-smith/templates/etc/rsyslog.conf/32spamd
Normal file
5
root/etc/e-smith/templates/etc/rsyslog.conf/32spamd
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
#spamd
|
||||
:programname, isequal, "spamd" /var/log/spamd/spamd.log
|
||||
& stop
|
||||
|
@@ -0,0 +1,18 @@
|
||||
{
|
||||
|
||||
# Default options to spamd
|
||||
#SPAMDOPTIONS="-c -m5 -H --razor-home-dir='/var/lib/razor/' --razor-log-file='sys-syslog'"
|
||||
# previous sme9 options
|
||||
# -u spamd --syslog=stderr --ipv4-only
|
||||
my @args = qw(-u spamd -c -m5 -H --ipv4-only --razor-home-dir='/var/lib/razor/' --razor-log-file='sys-syslog');
|
||||
|
||||
my $bayes = $spamassassin{'UseBayes'} || '0';
|
||||
my $tell = $spamassassin{'SpamLearning'} || 'disabled';
|
||||
|
||||
if ($bayes =~ m/^1|yes|on|enabled$/ && $tell =~ m/^1|yes|on|enabled$/){
|
||||
push @args, '--allow-tell';
|
||||
}
|
||||
|
||||
$OUT .= "SPAMDOPTIONS=\"@args\"";
|
||||
|
||||
}
|
13
root/etc/logrotate.d/spamd
Normal file
13
root/etc/logrotate.d/spamd
Normal file
@@ -0,0 +1,13 @@
|
||||
/var/log/spamd/spamd.log
|
||||
{
|
||||
missingok
|
||||
notifempty
|
||||
sharedscripts
|
||||
delaycompress
|
||||
su root root
|
||||
create 600 root root
|
||||
postrotate
|
||||
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
|
Reference in New Issue
Block a user