/[smecontribs]/rpms/smeserver-learn/contribs10/smeserver-learn-1.0-bz11281-bz10732-bz9524.patch
ViewVC logotype

Annotation of /rpms/smeserver-learn/contribs10/smeserver-learn-1.0-bz11281-bz10732-bz9524.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Tue Feb 23 19:41:54 2021 UTC (3 years, 3 months ago) by jpp
Branch: MAIN
Changes since 1.1: +2 -2 lines
* Tue Feb 23 2021 Jean-Philipe Pialasse <tests@pialasse.com> 1.0-16.sme
- make use of systemd [SME: 11281]
- create an update event to configure the contrib without reboot [SME: 11281]
- untag ham to avoid client to move them back to spamdir [SME: 10732]
- move existing spamdir before creating link to replace them [SME: 9524]

1 jpp 1.1 diff -Nur smeserver-learn-1.0.old/createlinks smeserver-learn-1.0/createlinks
2     --- smeserver-learn-1.0.old/createlinks 2021-02-23 13:32:11.805000000 -0500
3     +++ smeserver-learn-1.0/createlinks 2021-02-23 14:23:16.390000000 -0500
4     @@ -7,3 +7,8 @@
5     safe_touch('root/etc/e-smith/db/configuration/defaults/Learn/Exclude');
6     safe_touch('root/etc/e-smith/db/configuration/defaults/Learn/Include');
7    
8     +my $event="smeserver-learn-update";
9     +templates2events("/etc/cron.d/Learn",$event);
10     +templates2events("/etc/mail/spamassassin/local.cf",$event);
11     +event_link("LearnSpam-init", $event, "04");
12     +event_link("LearnSpam-run", $event, "30");
13     diff -Nur smeserver-learn-1.0.old/root/etc/e-smith/db/configuration/force/spamassassin/status smeserver-learn-1.0/root/etc/e-smith/db/configuration/force/spamassassin/status
14     --- smeserver-learn-1.0.old/root/etc/e-smith/db/configuration/force/spamassassin/status 1969-12-31 19:00:00.000000000 -0500
15     +++ smeserver-learn-1.0/root/etc/e-smith/db/configuration/force/spamassassin/status 2021-02-23 14:19:59.599000000 -0500
16     @@ -0,0 +1 @@
17     +enabled
18     diff -Nur smeserver-learn-1.0.old/root/etc/e-smith/db/configuration/force/spamassassin/UseBayes smeserver-learn-1.0/root/etc/e-smith/db/configuration/force/spamassassin/UseBayes
19     --- smeserver-learn-1.0.old/root/etc/e-smith/db/configuration/force/spamassassin/UseBayes 1969-12-31 19:00:00.000000000 -0500
20     +++ smeserver-learn-1.0/root/etc/e-smith/db/configuration/force/spamassassin/UseBayes 2021-02-23 14:20:19.445000000 -0500
21     @@ -0,0 +1 @@
22     +1
23     diff -Nur smeserver-learn-1.0.old/root/etc/e-smith/events/actions/LearnSpam-init smeserver-learn-1.0/root/etc/e-smith/events/actions/LearnSpam-init
24     --- smeserver-learn-1.0.old/root/etc/e-smith/events/actions/LearnSpam-init 1969-12-31 19:00:00.000000000 -0500
25     +++ smeserver-learn-1.0/root/etc/e-smith/events/actions/LearnSpam-init 2021-02-23 14:32:38.915000000 -0500
26     @@ -0,0 +1,20 @@
27     +#!/bin/bash
28     +
29     +# default is 0, if kept to 0 we can not play there
30     +/sbin/e-smith/db configuration setprop spamassassin UseBayes 1
31     +
32     +# default is empty, we shall set it if we want to have a run
33     +/sbin/e-smith/config getprop spamassassin BayesAutoLearnThresholdSpam >/dev/null|| /sbin/e-smith/config setprop spamassassin BayesAutoLearnThresholdSpam 6.00
34     +/sbin/e-smith/config getprop spamassassin BayesAutoLearnThresholdNonspam >/dev/null|| /sbin/e-smith/config setprop spamassassin BayesAutoLearnThresholdNonspam 0.10
35     +
36     +# we really need spamassassin running
37     +/sbin/e-smith/config setprop spamassassin status enabled
38     +
39     +# default is 0 for no reject
40     +#/sbin/e-smith/config setprop spamassassin RejectLevel 12
41     +
42     +# default is 5
43     +#/sbin/e-smith/config setprop spamassassin TagLevel 4
44     +
45     +# default is medium
46     +#/sbin/e-smith/config setprop spamassassin Sensitivity custom
47     diff -Nur smeserver-learn-1.0.old/root/etc/e-smith/events/actions/LearnSpam-run smeserver-learn-1.0/root/etc/e-smith/events/actions/LearnSpam-run
48     --- smeserver-learn-1.0.old/root/etc/e-smith/events/actions/LearnSpam-run 1969-12-31 19:00:00.000000000 -0500
49     +++ smeserver-learn-1.0/root/etc/e-smith/events/actions/LearnSpam-run 2021-02-23 14:21:17.357000000 -0500
50     @@ -0,0 +1,6 @@
51     +#!/bin/bash
52     +
53     +sa-learn --sync --dbpath /var/spool/spamd/.spamassassin -u spamd
54     +chown spamd.spamd /var/spool/spamd/.spamassassin/bayes_*
55     +chown spamd.spamd /var/spool/spamd/.spamassassin/bayes.mutex
56     +chmod 640 /var/spool/spamd/.spamassassin/bayes_*
57     diff -Nur smeserver-learn-1.0.old/root/usr/bin/Learn.pl smeserver-learn-1.0/root/usr/bin/Learn.pl
58     --- smeserver-learn-1.0.old/root/usr/bin/Learn.pl 2021-02-23 14:26:06.472000000 -0500
59     +++ smeserver-learn-1.0/root/usr/bin/Learn.pl 2021-02-23 14:01:57.297000000 -0500
60     @@ -20,6 +20,7 @@
61     use Digest::MD5 qw(md5 md5_hex md5_base64);
62     use File::Find;
63     use File::Copy;
64     +use File::Copy::Recursive;
65     use File::Basename;
66     use File::Path;
67     use Encode qw/encode decode/;
68     @@ -121,6 +122,10 @@
69     foreach $a (split(",",$Spamlinks)){
70     $a=(substr($a, 0, 1) eq '.')? $a: ".$a";
71     my $Link= $MailDir . "/" . $a;
72     + continue if ( -l $Link);
73     + if (-d $Link) {
74     + dirmove($Link, $junkdir) or die "Can't move folder in place of our wanted link from %Link to $junkdir: $!";
75     + };
76     if (! -e $Link) {
77     Vact(); print "+->create link $Link on $junkdir\n";
78     symlink($junkdir, $Link) or die "Can't create symlink from $Link to $junkdir: $!";
79     @@ -209,6 +214,10 @@
80     for my $test ( quotemeta $subjectTAG , quotemeta $tag) {
81     ($Subject= $Subject) =~ s/$test//;
82     }
83     + # we also remove Spam tag or client will move the mail again in spam dir
84     + $email->header_set("X-Spam-Flag",'NO');
85     + $email->header_set("X-Spam-Level",'*');
86     + $email->header_set("X-Spam-Status",'No, score=0.0 required=4.0 autolearn=disabled');
87     }
88     # encoding as MIME Q (not B) with UTF8 as default.
89     my $cleanTag= encode("MIME-Q",$sadb->get_prop($mode, "tag"));
90     @@ -243,7 +252,7 @@
91    
92     if ($newmd5 ne $md5) {
93     `expand-template /etc/mail/spamassassin/local.cf`;
94 jpp 1.2 + `/usr/bin/systemctl restart spamassassin.service`;
95     - `/etc/init.d/spamd restart`;
96 jpp 1.1 print "\n";
97     }
98    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed