2 # - support for libdclassify
4 # - messages from default install of cron with mysql driver Memory fault
5 # - installing dspam and dspam-client on same host causes
6 # /etc/dspam.conf being owned by both packages and .rpmnew files being
7 # created. move the config to -libs? -common? patch code to use
8 # different config for client?
11 %bcond_without mysql # disable MySQL storage driver
12 %bcond_without pgsql # disable PostgreSQL storage driver
13 %bcond_without sqlite # disable SQLite3 storage driver
14 %bcond_with mysql40 # use with mysql 4.0
16 %include /usr/lib/rpm/macros.perl
17 Summary: A library and Mail Delivery Agent for Bayesian spam filtering
18 Summary(pl.UTF-8): Biblioteka i MDA do bayesowskiego filtrowania spamu
23 Group: Applications/Mail
24 Source0: http://dspam.nuclearelephant.com/sources/%{name}-%{version}.tar.gz
25 # Source0-md5: c4b1a7079690ee16d8b0f36b2a2a90a4
26 Patch0: %{name}-webui.patch
27 Patch1: %{name}-config.patch
28 Patch2: %{name}-speedup.patch
30 Source2: %{name}-apache.conf
31 URL: http://dspam.nuclearelephant.com/
32 BuildRequires: autoconf
33 BuildRequires: automake
34 BuildRequires: clamav-devel
35 BuildRequires: libtool
36 %{?with_mysql:BuildRequires: mysql-devel}
37 BuildRequires: openldap-devel
38 %{?with_pgsql:BuildRequires: postgresql-devel}
39 BuildRequires: rpm-perlprov >= 4.1-13
40 BuildRequires: rpmbuild(macros) >= 1.268
41 BuildRequires: sed >= 4.0
42 %{?with_sqlite:BuildRequires: sqlite3-devel}
43 BuildRequires: zlib-devel
44 Requires(post,preun): /sbin/chkconfig
46 Buildroot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48 %define _webapps /etc/webapps
49 %define _webapp %{name}
52 DSPAM (as in De-Spam) is an open-source project to create a new kind
53 of anti-spam mechanism, and is currently effective as both a
54 server-side agent for UNIX email servers and a developer's library for
55 mail clients, other anti-spam tools, and similar projects requiring
56 drop-in spam filtering.
58 The DSPAM agent masquerades as the email server's local delivery agent
59 and filters/learns spams using an advanced Bayesian statistical
60 approach (based on Bayes's theorem of combined probabilities) which
61 provides an administratively maintenance-free, easy-learning Anti-Spam
62 service custom tailored to each individual user's behavior. Advanced
63 because on top of standard Bayesian filtering is also incorporated the
64 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
65 works great with Sendmail and Exim, and should work well with any
66 other MTA that supports an external local delivery agent (postfix,
69 %description -l pl.UTF-8
70 DSPAM (czyli De-Spam) to projekt o otwartych źródłach mający na celu
71 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
72 efektywny zarówno jako działający po stronie serwera agent dla
73 uniksowych serwerów pocztowych jak i biblioteka dla programistów
74 klientów pocztowych, innych narzędzi antyspamowych i innych projektów
75 wymagających filtrowania spamu w locie.
77 Agent DSPAM zachowuje się jak lokalny agent dostarczania poczty (MDA)
78 i filtruje/uczy się spamu przy użyciu zaawansowanego bayesowskiego
79 przybliżenia statystycznego (opartego na twierdzeniu Bayesa o
80 połączonych prawdopodobieństwach), dając nie wymagającą obsługi
81 administracyjnej, łatwo uczącą się usługę antyspamową dostosowaną do
82 zachowania każdego użytkownika. Metoda jest zaawansowana ponieważ na
83 podstawie standardowego filtrowania bayesowskiego wprowadzono użycie
84 tokenów łańcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
85 DSPAM działa wspaniale z Sendmailem i Eximem, powinien działać dobrze
86 z każdym innym MTA obsługującym zewnętrznego agenta MDA (postfiksem,
91 Summary(pl.UTF-8): Klient dspam
92 Group: Applications/Mail
93 # to get the same dspam.conf when both installed
94 Conflicts: dspam < %{version}-%{release}
95 Conflicts: dspam > %{version}-%{release}
100 %description client -l pl.UTF-8
104 Summary: A library for Bayesian spam filtering
105 Summary(pl.UTF-8): Biblioteka do bayesowskiego filtrowania spamu
107 Requires: %{name}-driver = %{version}-%{release}
108 Obsoletes: dspam-driver-db
111 DSPAM (as in De-Spam) is an open-source project to create a new kind
112 of anti-spam mechanism, and is currently effective as both a
113 server-side agent for UNIX email servers and a developer's library for
114 mail clients, other anti-spam tools, and similar projects requiring
115 drop-in spam filtering.
117 This package contains the library.
119 %description libs -l pl.UTF-8
120 DSPAM (czyli De-Spam) to projekt o otwartych źródłach mający na celu
121 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
122 efektywny zarówno jako działający po stronie serwera agent dla
123 uniksowych serwerów pocztowych jak i biblioteka dla programistów
124 klientów pocztowych, innych narzędzi antyspamowych i innych projektów
125 wymagających filtrowania spamu w locie.
127 Ten pakiet zawiera wspomnianą bibliotekę.
130 Summary: Header files for the DSPAM library
131 Summary(pl.UTF-8): Pliki nagłówkowe biblioteki DSPAM
132 Group: Development/Libraries
133 Requires: %{name}-libs = %{version}-%{release}
136 DSPAM has had its core engine moved into a separate library, libdspam.
137 This library can be used by developers to provide 'drop-in' spam
138 filtering for their mail client applications, other anti-spam tools,
141 %description devel -l pl.UTF-8
142 Główny silnik DSPAM został przeniesiony do oddzielnej biblioteki
143 libdspam, która może być używana przez programistów do zapewnienia
144 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
145 narzędzi antyspamowych i podobnych projektów.
148 Summary: Static DSPAM library
149 Summary(pl.UTF-8): Statyczna biblioteka DSPAM
150 Group: Development/Libraries
151 Requires: %{name}-devel = %{version}-%{release}
154 Static DSPAM library.
156 %description static -l pl.UTF-8
157 Statyczna biblioteka DSPAM.
160 Summary: HASH driver for DSPAM
161 Summary(pl.UTF-8): Sterownik HASH dla DSPAM-a
163 Requires(post): sed >= 4.0
164 Requires: %{name}-libs = %{version}-%{release}
165 Provides: %{name}-driver = %{version}-%{release}
167 %description driver-hash
168 HASH driver for DSPAM.
170 %description driver-hash -l pl.UTF-8
171 Sterownik HASH dla DSPAM-a.
173 %package driver-mysql
174 Summary: MySQL driver for DSPAM
175 Summary(pl.UTF-8): Sterownik MySQL dla DSPAM-a
177 Requires(post): sed >= 4.0
178 Requires: %{name}-libs = %{version}-%{release}
179 Provides: %{name}-driver = %{version}-%{release}
181 %description driver-mysql
182 MySQL driver for DSPAM.
184 %description driver-mysql -l pl.UTF-8
185 Sterownik MySQL dla DSPAM-a.
187 %package driver-pgsql
188 Summary: PostgreSQL driver for DSPAM
189 Summary(pl.UTF-8): Sterownik PostgreSQL dla DSPAM-a
191 Requires(post): sed >= 4.0
192 Requires: %{name}-libs = %{version}-%{release}
193 Provides: %{name}-driver = %{version}-%{release}
195 %description driver-pgsql
196 PostgreSQL driver for DSPAM.
198 %description driver-pgsql -l pl.UTF-8
199 Sterownik PostgreSQL dla DSPAM-a.
201 %package driver-sqlite
202 Summary: SQLite driver for DSPAM
203 Summary(pl.UTF-8): Sterownik SQLite dla DSPAM-a
205 Requires(post): sed >= 4.0
206 Requires: %{name}-libs = %{version}-%{release}
207 Provides: %{name}-driver = %{version}-%{release}
209 %description driver-sqlite
210 SQLite driver for DSPAM.
212 %description driver-sqlite -l pl.UTF-8
213 Sterownik SQLite dla DSPAM-a.
216 Summary: DSPAM Web UI
217 Summary(pl.UTF-8): Interfejs WWW do programu DSPAM
218 Group: Applications/WWW
221 Requires: %{name} = %{version}-%{release}
224 The Web UI (CGI client) can be run from any executable location on a
225 web server, and detects its user's identity from the REMOTE_USER
226 environment variable. This means you'll need to use HTTP password
227 authentication to access the CGI (Any type of authentication will
228 work, so long as Apache supports the module). This is also convenient
229 in that you can set up authentication using almost any existing system
230 you have. The only catch is that you'll need the usernames to match
231 the actual DSPAM usernames used the system. A copy of the shadow
232 password file will suffice for most common installs.
234 %description webui -l pl.UTF-8
235 Interfejs użytkownika WWW (klient CGI) może być uruchamiany z
236 dowolnego wykonywalnego miejsca na serwerze WWW i rozpoznaje tożsamość
237 użytkownika ze zmiennej środowiskowej REMOTE_USER. Oznacza to, że
238 trzeba użyć uwietrzytelnienia HTTP z hasłem do dostępu do CGI (działać
239 będzie dowolny rodzaj uwierzytelnienia obsługiwany przez moduły
240 Apache'a). Jest to o tyle wygodne, że można skonfigurować
241 uwierzytelnianie dla prawie każdego istniejącego systemu. Jedynym
242 wymogiem jest, żeby nazwy użytkowników pokrywały się z nazwami
243 użytkowników DSPAM-a używanymi w systemie. Kopia pliku shadow
244 wystarczy dla większości popularnych instalacji.
251 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
252 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
253 sed -i -e 's,/usr/local/dspam/bin,/usr/bin,' ./scripts/train.pl
263 %{?with_mysql:mysql_drv}
264 %{?with_pgsql:pgsql_drv}
265 %{?with_sqlite:sqlite_drv}
268 --disable-dependency-tracking \
269 %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
270 --enable-trusted-user-security \
272 --enable-large-scale \
273 --with-userdir=/var/lib/%{name} \
274 --with-userdir-owner=none \
275 --with-userdir-group=none \
276 --with-dspam-home=/var/lib/%{name} \
277 --with-dspam-home-owner=none \
278 --with-dspam-home-group=none \
279 --with-dspam-owner=none \
280 --with-dspam-group=none \
281 --with-signature-life=14 \
284 --enable-preferences-extension \
285 --enable-long-usernames \
286 --enable-neural-networking \
287 --enable-virtual-users \
288 --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
290 --with-mysql-includes=%{_includedir}/mysql \
291 --with-mysql-libraries=%{_libdir} \
294 --with-pgsql-includes=%{_includedir}/postgresql \
295 --with-pgsql-libraries=%{_libdir} \
298 --with-sqlite3-includes=%{_includedir} \
299 --with-sqlite3-libraries=%{_libdir} \
303 # --enable-dclassify-extension needs libdclassify
308 rm -rf $RPM_BUILD_ROOT
309 install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}} \
310 $RPM_BUILD_ROOT/var/lib/%{name}/{txt,data}
313 DESTDIR=$RPM_BUILD_ROOT
315 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
317 cp -a txt/*.txt $RPM_BUILD_ROOT/var/lib/%{name}/txt
319 # install devel files
320 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
321 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
323 # provide maintenance scripts
324 install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
325 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
327 exec %{_bindir}/%{name}_clean -s -p
330 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
333 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
336 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
341 This file can only contain 5 lines with the following values:
352 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
357 This file can only contain 5 lines with the following values:
367 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
368 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
369 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
370 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
373 /sbin/chkconfig --add dspam
374 %service dspam restart "dspam daemon"
377 if [ "$1" = "0" ]; then
379 /sbin/chkconfig --del dspam
383 rm -rf $RPM_BUILD_ROOT
385 %post libs -p /sbin/ldconfig
386 %postun libs -p /sbin/ldconfig
389 if [ "$1" = "1" ]; then
390 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
394 if [ "$1" = "1" ]; then
395 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
399 if [ "$1" = "1" ]; then
400 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
404 if [ "$1" = "1" ]; then
405 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
408 %triggerin webui -- apache1 < 1.3.37-3, apache1-base
409 %webapp_register apache %{_webapp}
411 %triggerun webui -- apache1 < 1.3.37-3, apache1-base
412 %webapp_unregister apache %{_webapp}
414 %triggerin webui -- apache < 2.2.0, apache-base
415 %webapp_register httpd %{_webapp}
417 %triggerun webui -- apache < 2.2.0, apache-base
418 %webapp_unregister httpd %{_webapp}
421 %defattr(644,root,root,755)
422 %doc README CHANGELOG RELEASE.NOTES UPGRADING
423 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
424 %doc scripts/train.pl
425 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
426 %dir %attr(775,root,mail) /var/run/dspam
427 %dir %attr(750,root,mail) /var/lib/%{name}
428 %dir %attr(770,root,mail) /var/lib/%{name}/data
429 %dir /var/lib/%{name}/txt
430 %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/txt/*.txt
431 %dir %attr(770,root,mail) /var/log/dspam
432 %attr(754,root,root) /etc/rc.d/init.d/dspam
433 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
434 %attr(755,root,root) %{_bindir}/%{name}
435 %attr(755,root,root) %{_bindir}/%{name}_logrotate
436 %attr(755,root,root) %{_bindir}/%{name}_clean
437 %attr(755,root,root) %{_bindir}/%{name}_crc
438 %attr(755,root,root) %{_bindir}/%{name}_dump
439 %attr(755,root,root) %{_bindir}/%{name}_stats
440 %attr(755,root,root) %{_bindir}/%{name}_merge
441 %attr(755,root,root) %{_bindir}/%{name}_2sql
442 %attr(755,root,root) %{_bindir}/%{name}_admin
443 %attr(755,root,root) %{_bindir}/%{name}_train
444 %{_mandir}/man?/%{name}*
447 %defattr(644,root,root,755)
448 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
449 %attr(755,root,root) %{_bindir}/%{name}c
452 %defattr(644,root,root,755)
453 %doc README CHANGELOG
454 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
455 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
458 %defattr(644,root,root,755)
459 %attr(755,root,root) %{_libdir}/lib*.so
460 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
462 %{_includedir}/%{name}
463 %{_mandir}/man3/libdspam*
464 %{_pkgconfigdir}/*.pc
467 %defattr(644,root,root,755)
471 %defattr(644,root,root,755)
472 %attr(755,root,root) %{_bindir}/css*
473 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
477 %defattr(644,root,root,755)
478 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
479 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
480 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
485 %defattr(644,root,root,755)
486 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
487 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
488 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
489 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
494 %defattr(644,root,root,755)
495 %doc doc/sqlite_drv.txt
496 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
500 %defattr(644,root,root,755)
501 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
502 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
503 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
504 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
505 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
506 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
507 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
509 %dir %{_datadir}/dspam
510 %dir %{_datadir}/dspam/cgi
511 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
512 %{_datadir}/dspam/cgi/templates
513 %{_datadir}/dspam/htdocs