|
32
|
1 |
ospam
|
|
1
|
2 |
|
|
|
3 |
diff --git a/source/custom/ospam/FrugalBuild b/source/custom/ospam/FrugalBuild
|
|
|
4 |
new file mode 100644
|
|
|
5 |
index 0000000..d1191b7
|
|
|
6 |
--- /dev/null
|
|
|
7 |
+++ b/source/custom/ospam/FrugalBuild
|
|
|
8 |
@@ -0,0 +1,25 @@
|
|
|
9 |
+# Maintainer: Tomas Zeman <tzeman@volny.cz>
|
|
|
10 |
+
|
|
|
11 |
+pkgname=ospam
|
|
|
12 |
+pkgver=0.01
|
|
|
13 |
+pkgrel=1
|
|
|
14 |
+pkgdesc=""
|
|
|
15 |
+url="http://omail.omnis.ch/ospam/"
|
|
|
16 |
+archs=(i686)
|
|
|
17 |
+up2date="lynx $url?M=D -dump -nolist|grep 'tar.gz'|head -1|sed -e 's/.*$pkgname-\(.*\)\.tar\.gz.*$/\1/'"
|
|
|
18 |
+depends=('spamassassin' 'clamav' 'conn-tools' 'qmail' 'perl-dbd-mysql' 'mess822')
|
|
|
19 |
+backup=(etc/ospam/ospam-dotqmail etc/ospam/spamclam)
|
|
|
20 |
+source=($url/$pkgname-$pkgver.tar.gz spamclam ospam.patch)
|
|
|
21 |
+sha1sums=('7a47fbdedddc16d8fe04ca400daee00a962408da' \
|
|
|
22 |
+ 'acd24f2b9daa5f15e2e9360050d9ea0bd96c1dbc' \
|
|
|
23 |
+ '7e8aa8d7d8b9a0ac5e88e5304a0f69d4b267a784')
|
|
|
24 |
+
|
|
|
25 |
+build() {
|
|
|
26 |
+ Fcd
|
|
|
27 |
+ Fpatchall
|
|
|
28 |
+ Fmkdir /usr/bin /usr/share/$pkgname /etc/$pkgname
|
|
|
29 |
+ Finstall 755 $pkgname-$pkgver/ospam-dotqmail.pl /usr/bin/ospam-dotqmail
|
|
|
30 |
+ Finstall 755 spamclam /usr/bin
|
|
|
31 |
+ Finstall 644 $pkgname-$pkgver/sql/nospam.sql /usr/share/ospam/dbschema.sql
|
|
|
32 |
+}
|
|
|
33 |
+# vim: ft=sh
|
|
|
34 |
diff --git a/source/custom/ospam/ospam.patch b/source/custom/ospam/ospam.patch
|
|
|
35 |
new file mode 100644
|
|
|
36 |
index 0000000..36535a7
|
|
|
37 |
--- /dev/null
|
|
|
38 |
+++ b/source/custom/ospam/ospam.patch
|
|
|
39 |
@@ -0,0 +1,82 @@
|
|
|
40 |
+diff -u ospam-0.01.orig/ospam-dotqmail.pl ospam-0.01/ospam-dotqmail.pl
|
|
|
41 |
+--- ospam-0.01.orig/ospam-dotqmail.pl 2003-05-04 04:21:26.000000000 +0200
|
|
|
42 |
++++ ospam-0.01/ospam-dotqmail.pl 2007-12-16 00:13:19.000000000 +0100
|
|
|
43 |
+@@ -32,50 +32,52 @@
|
|
|
44 |
+
|
|
|
45 |
+ # SETUP:
|
|
|
46 |
+
|
|
|
47 |
+-my $debug = 1;
|
|
|
48 |
++our $debug = 1;
|
|
|
49 |
+
|
|
|
50 |
+ # emails:
|
|
|
51 |
+
|
|
|
52 |
+-my $debug_bcc_mail = ''; # keep empty after testing
|
|
|
53 |
+-my $admin_mail = ''; # for error notices
|
|
|
54 |
+-my $mail_sender = 'oSpam system <ospam@your-domain-here.ext>';
|
|
|
55 |
++our $debug_bcc_mail = ''; # keep empty after testing
|
|
|
56 |
++our $admin_mail = ''; # for error notices
|
|
|
57 |
++our $mail_sender = 'oSpam system <ospam@your-domain-here.ext>';
|
|
|
58 |
+
|
|
|
59 |
+ # database:
|
|
|
60 |
+
|
|
|
61 |
+-my $db_username = "nospam";
|
|
|
62 |
+-my $db_password = "*********";
|
|
|
63 |
+-my $db_hostname = "localhost";
|
|
|
64 |
+-my $db_database = "nospam";
|
|
|
65 |
++our $db_username = "nospam";
|
|
|
66 |
++our $db_password = "*********";
|
|
|
67 |
++our $db_hostname = "localhost";
|
|
|
68 |
++our $db_database = "nospam";
|
|
|
69 |
+
|
|
|
70 |
+-my $tb_userpref = "userpref"; # SA sql table
|
|
|
71 |
+-my $tb_dotqmail = "dotqmail"; # ospam data
|
|
|
72 |
++our $tb_userpref = "userpref"; # SA sql table
|
|
|
73 |
++our $tb_dotqmail = "dotqmail"; # ospam data
|
|
|
74 |
+
|
|
|
75 |
+ # file & cmd path:
|
|
|
76 |
+
|
|
|
77 |
+-my $cmd_preline = "/var/qmail/bin/preline";
|
|
|
78 |
+-my $cmd_spamc = "/usr/bin/spamc";
|
|
|
79 |
+-my $cmd_vdeliver = "/usr/local/bin/vdeliver";
|
|
|
80 |
+-my $cmd_filepipe = "/usr/local/nospam/filepipe";
|
|
|
81 |
+-my $cmd_ifspamh = "/usr/local/nospam/ifspamh";
|
|
|
82 |
+-my $spamc_options = "-f";
|
|
|
83 |
+-my $cmd_md5sum = "/usr/bin/md5sum";
|
|
|
84 |
+-my $cmd_chown = "/bin/chown";
|
|
|
85 |
+-my $cmd_chmod = "/bin/chmod";
|
|
|
86 |
+-my $cmd_sendmail = "/usr/sbin/sendmail";
|
|
|
87 |
+-my $sendmail_opt = "-oem -oi -t";
|
|
|
88 |
++our $cmd_preline = "/var/qmail/bin/preline";
|
|
|
89 |
++our $cmd_spamc = "/usr/bin/spamc";
|
|
|
90 |
++our $cmd_vdeliver = "/usr/local/bin/vdeliver";
|
|
|
91 |
++our $cmd_filepipe = "/usr/local/nospam/filepipe";
|
|
|
92 |
++our $cmd_ifspamh = "/usr/local/nospam/ifspamh";
|
|
|
93 |
++our $spamc_options = "-f";
|
|
|
94 |
++our $cmd_md5sum = "/usr/bin/md5sum";
|
|
|
95 |
++our $cmd_chown = "/bin/chown";
|
|
|
96 |
++our $cmd_chmod = "/bin/chmod";
|
|
|
97 |
++our $cmd_sendmail = "/usr/sbin/sendmail";
|
|
|
98 |
++our $sendmail_opt = "-oem -oi -t";
|
|
|
99 |
+
|
|
|
100 |
+ # qmail setup:
|
|
|
101 |
+
|
|
|
102 |
+-my $cfg_virtualdomains = "/var/qmail/control/virtualdomains";
|
|
|
103 |
+-my $cfg_rcpthosts = "/var/qmail/control/rcpthosts";
|
|
|
104 |
+-my $dot_qmail_prefix = ".qmail-";
|
|
|
105 |
++our $cfg_virtualdomains = "/var/qmail/control/virtualdomains";
|
|
|
106 |
++our $cfg_rcpthosts = "/var/qmail/control/rcpthosts";
|
|
|
107 |
++our $dot_qmail_prefix = ".qmail-";
|
|
|
108 |
+
|
|
|
109 |
+ # internal values
|
|
|
110 |
+
|
|
|
111 |
+ my $version = 1; # integer
|
|
|
112 |
+ my $internal_version = 1000; # incrementing this number will force re-generation of all .qmail-files
|
|
|
113 |
+
|
|
|
114 |
++my $cfg_file = "/etc/ospam/ospam-dotqmail";
|
|
|
115 |
+
|
|
|
116 |
++do $cfg_file if (-f $cfg_file);
|
|
|
117 |
+
|
|
|
118 |
+ #################################################
|
|
|
119 |
+
|
|
|
120 |
+Only in ospam-0.01: ospam-dotqmail.pl~
|
|
|
121 |
+Common subdirectories: ospam-0.01.orig/sql and ospam-0.01/sql
|
|
32
|
122 |
diff --git a/source/custom/ospam/spamclam b/source/custom/ospam/spamclam
|
|
|
123 |
new file mode 100755
|
|
|
124 |
index 0000000..dae445b
|
|
|
125 |
--- /dev/null
|
|
|
126 |
+++ b/source/custom/ospam/spamclam
|
|
|
127 |
@@ -0,0 +1,97 @@
|
|
|
128 |
+#!/bin/sh
|
|
|
129 |
+
|
|
|
130 |
+[ -f /etc/ospam/spamclam ] && . /etc/ospam/spamclam
|
|
|
131 |
+
|
|
|
132 |
+# CONFIG
|
|
|
133 |
+SPAMC=${SPAMC:-/usr/bin/spamc}
|
|
|
134 |
+CLAMDSCAN=${CLAMDSCAN:-/usr/bin/clamdscan}
|
|
|
135 |
+FORWARDBIN=${FORWARDBIN:-/var/qmail/bin/forward}
|
|
|
136 |
+M822FIELD=${M822FIELD:-/usr/bin/822field}
|
|
|
137 |
+FILEPIPE=${FILEPIPE:-/command/seekablepipe} #/usr/bin/filepipe
|
|
|
138 |
+VDELIVER=${VDELIVER:-/usr/bin/vdeliver}
|
|
|
139 |
+TMP=${TMP:-.}
|
|
|
140 |
+
|
|
|
141 |
+[ -x $SPAMC -a -x $CLAMDSCAN -a -x $FORWARDBIN -a -x $M822FIELD ] || {
|
|
|
142 |
+ echo -e "$0: Required programs do not exist"
|
|
|
143 |
+ cat | $FILEPIPE $VDELIVER
|
|
|
144 |
+ exit 0
|
|
|
145 |
+}
|
|
|
146 |
+
|
|
|
147 |
+ADDR_QUARANTINE="$1"
|
|
|
148 |
+DELIVER_VIRUS="$2"
|
|
|
149 |
+ADDR_SPAM="$3"
|
|
|
150 |
+DELIVER_SPAM="$4"
|
|
|
151 |
+MAILUSER="$5"
|
|
|
152 |
+
|
|
|
153 |
+if [ -z "$ADDR_QUARANTINE" -o -z "$ADDR_SPAM" -o -z "$DELIVER_VIRUS" -o -z "$DELIVER_SPAM" ]; then
|
|
|
154 |
+ echo -e "Usage: $0 quarantine_address deliver_virus_to_recipient(0/1) spam_address deliver_spam_to_recipient(0/1) [mailuser address]"
|
|
|
155 |
+ echo -e "address may be: _ignore_ -> checking of that feature is ignored"
|
|
|
156 |
+ echo -e " _noaddr_ -> if infected, do not forward"
|
|
|
157 |
+ cat
|
|
|
158 |
+ exit 0
|
|
|
159 |
+fi
|
|
|
160 |
+
|
|
|
161 |
+MAILFILE="$TMP/mail.tmp.$$"
|
|
|
162 |
+
|
|
|
163 |
+cat >$MAILFILE
|
|
|
164 |
+
|
|
|
165 |
+VIRUS=0
|
|
|
166 |
+SPAM=0
|
|
|
167 |
+STATUS=0
|
|
|
168 |
+
|
|
|
169 |
+spam_flags=""
|
|
|
170 |
+
|
|
|
171 |
+if [ "$ADDR_QUARANTINE" != "_ignore_" ]; then
|
|
|
172 |
+ virus=`$CLAMDSCAN --disable-summary --stdout $MAILFILE | grep FOUND`
|
|
|
173 |
+ if [ ! "$virus" = "" ]; then
|
|
|
174 |
+ VIRUS=1
|
|
|
175 |
+ cat $MAILFILE | sed -e 's/^Subject:/Subject: [virus]/' > $MAILFILE.1
|
|
|
176 |
+ fi
|
|
|
177 |
+fi
|
|
|
178 |
+
|
|
|
179 |
+if [ $VIRUS -eq 0 -a "$ADDR_SPAM" != "_ignore_" ]; then
|
|
|
180 |
+ if [ ! -z $MAILUSER ]; then
|
|
|
181 |
+ spam_flags="-u $MAILUSER"
|
|
|
182 |
+ fi
|
|
|
183 |
+ $SPAMC $spam_flags < $MAILFILE > $MAILFILE.1
|
|
|
184 |
+ isspam=`$M822FIELD X-Spam-Flag < $MAILFILE.1 | grep YES | wc -l`
|
|
|
185 |
+ if [ $isspam -ne 0 ]; then
|
|
|
186 |
+ SPAM=1
|
|
|
187 |
+ fi
|
|
|
188 |
+fi
|
|
|
189 |
+
|
|
|
190 |
+
|
|
|
191 |
+if [ $VIRUS -eq 1 ]; then
|
|
|
192 |
+ STATUS=99
|
|
|
193 |
+ if [ $DELIVER_VIRUS -eq 1 ]; then
|
|
|
194 |
+ cat $MAILFILE.1 | $FILEPIPE $VDELIVER
|
|
|
195 |
+ fi
|
|
|
196 |
+ if [ "$ADDR_QUARANTINE" != "_noaddr_" ]; then
|
|
|
197 |
+ $FORWARDBIN $ADDR_QUARANTINE < $MAILFILE.1
|
|
|
198 |
+ if [ $? -ne 0 ]; then
|
|
|
199 |
+ STATUS=111
|
|
|
200 |
+ fi
|
|
|
201 |
+ fi
|
|
|
202 |
+else
|
|
|
203 |
+if [ $SPAM -eq 1 ]; then
|
|
|
204 |
+ STATUS=99
|
|
|
205 |
+ if [ $DELIVER_SPAM -eq 1 ]; then
|
|
|
206 |
+ cat $MAILFILE.1 | $FILEPIPE $VDELIVER
|
|
|
207 |
+ fi
|
|
|
208 |
+ if [ "$ADDR_SPAM" != "_noaddr_" ]; then
|
|
|
209 |
+ $FORWARDBIN $ADDR_SPAM < $MAILFILE.1
|
|
|
210 |
+ if [ $? -ne 0 ]; then
|
|
|
211 |
+ STATUS=111
|
|
|
212 |
+ fi
|
|
|
213 |
+ fi
|
|
|
214 |
+fi
|
|
|
215 |
+fi
|
|
|
216 |
+
|
|
|
217 |
+if [ $VIRUS -eq 0 -a $SPAM -eq 0 ]; then
|
|
|
218 |
+ cat $MAILFILE | $FILEPIPE $VDELIVER
|
|
|
219 |
+fi
|
|
|
220 |
+
|
|
|
221 |
+rm -f $MAILFILE $MAILFILE.1
|
|
|
222 |
+
|
|
|
223 |
+exit $STATUS
|
|
|
224 |
+
|