2 # - support for libdclassify
4 # - messages from default install of cron with mysql driver Memory fault
7 %bcond_without mysql # disable MySQL storage driver
8 %bcond_without pgsql # disable PostgreSQL storage driver
9 %bcond_without sqlite # disable SQLite3 storage driver
10 %bcond_without db # disable BerkeleyDB storage driver
11 %bcond_without daemon # disable daemon mode
12 %bcond_with mysql40 # use with mysql 4.0
14 %include /usr/lib/rpm/macros.perl
15 Summary: A library and Mail Delivery Agent for Bayesian spam filtering
16 Summary(pl): Biblioteka i MDA do bayesowskiego filtrowania spamu
21 Group: Applications/Mail
22 Source0: http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
23 # Source0-md5: da4f0e00633bff49d71fde418caaf14b
24 Patch0: %{name}-webui.patch
26 Source2: %{name}-apache.conf
27 URL: http://www.nuclearelephant.com/projects/dspam/
28 BuildRequires: autoconf
29 BuildRequires: automake
30 BuildRequires: clamav-devel
31 %{?with_db:BuildRequires: db-devel}
32 BuildRequires: libtool
33 %{?with_mysql:BuildRequires: mysql-devel}
34 BuildRequires: openldap-devel
35 %{?with_pgsql:BuildRequires: postgresql-devel}
36 BuildRequires: rpm-perlprov >= 4.1-13
37 BuildRequires: rpmbuild(macros) >= 1.268
38 BuildRequires: sed >= 4.0
39 %{?with_sqlite:BuildRequires: sqlite3-devel}
40 BuildRequires: zlib-devel
41 Requires(post,preun): /sbin/chkconfig
43 Buildroot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45 %define _webapps /etc/webapps
46 %define _webapp %{name}
49 DSPAM (as in De-Spam) is an open-source project to create a new kind
50 of anti-spam mechanism, and is currently effective as both a
51 server-side agent for UNIX email servers and a developer's library for
52 mail clients, other anti-spam tools, and similar projects requiring
53 drop-in spam filtering.
55 The DSPAM agent masquerades as the email server's local delivery agent
56 and filters/learns spams using an advanced Bayesian statistical
57 approach (based on Bayes's theorem of combined probabilities) which
58 provides an administratively maintenance-free, easy-learning Anti-Spam
59 service custom tailored to each individual user's behavior. Advanced
60 because on top of standard Bayesian filtering is also incorporated the
61 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
62 works great with Sendmail and Exim, and should work well with any
63 other MTA that supports an external local delivery agent (postfix,
67 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
68 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
69 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
70 uniksowych serwerów pocztowych jak i biblioteka dla programistów
71 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
72 wymagaj±cych filtrowania spamu w locie.
74 Agent DSPAM zachowuje siê jak lokalny agent dostarczania poczty (MDA)
75 i filtruje/uczy siê spamu przy u¿yciu zaawansowanego bayesowskiego
76 przybli¿enia statystycznego (opartego na twierdzeniu Bayesa o
77 po³±czonych prawdopodobieñstwach), daj±c nie wymagaj±c± obs³ugi
78 administracyjnej, ³atwo ucz±c± siê us³ugê antyspamow± dostosowan± do
79 zachowania ka¿dego u¿ytkownika. Metoda jest zaawansowana poniewa¿ na
80 podstawie standardowego filtrowania bayesowskiego wprowadzono u¿ycie
81 tokenów ³añcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
82 DSPAM dzia³a wspaniale z Sendmailem i Eximem, powinien dzia³aæ dobrze
83 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
88 Summary(pl): Klient dspam
89 Group: Applications/Mail
90 # to get the same dspam.conf when both installed
91 Conflicts: dspam < %{version}-%{release}
92 Conflicts: dspam > %{version}-%{release}
97 %description client -l pl
101 Summary: A library for Bayesian spam filtering
102 Summary(pl): Biblioteka do bayesowskiego filtrowania spamu
104 Requires: %{name}-driver = %{version}-%{release}
107 DSPAM (as in De-Spam) is an open-source project to create a new kind
108 of anti-spam mechanism, and is currently effective as both a
109 server-side agent for UNIX email servers and a developer's library for
110 mail clients, other anti-spam tools, and similar projects requiring
111 drop-in spam filtering.
113 This package contains the library.
115 %description libs -l pl
116 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
117 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
118 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
119 uniksowych serwerów pocztowych jak i biblioteka dla programistów
120 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
121 wymagaj±cych filtrowania spamu w locie.
123 Ten pakiet zawiera wspomnian± bibliotekê.
126 Summary: Header files for the DSPAM library
127 Summary(pl): Pliki nag³ówkowe biblioteki DSPAM
128 Group: Development/Libraries
129 Requires: %{name}-libs = %{version}-%{release}
132 DSPAM has had its core engine moved into a separate library, libdspam.
133 This library can be used by developers to provide 'drop-in' spam
134 filtering for their mail client applications, other anti-spam tools,
137 %description devel -l pl
138 G³ówny silnik DSPAM zosta³ przeniesiony do oddzielnej biblioteki
139 libdspam, która mo¿e byæ u¿ywana przez programistów do zapewnienia
140 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
141 narzêdzi antyspamowych i podobnych projektów.
144 Summary: Static DSPAM library
145 Summary(pl): Statyczna biblioteka DSPAM
146 Group: Development/Libraries
147 Requires: %{name}-devel = %{version}-%{release}
150 Static DSPAM library.
152 %description static -l pl
153 Statyczna biblioteka DSPAM.
156 Summary: HASH driver for DSPAM
157 Summary(pl): Sterownik HASH dla DSPAM-a
159 Requires(post): sed >= 4.0
160 Requires: %{name}-libs = %{version}-%{release}
161 Provides: %{name}-driver = %{version}-%{release}
163 %description driver-hash
164 HASH driver for DSPAM.
166 %description driver-hash -l pl
167 Sterownik HASH dla DSPAM-a.
170 Summary: DB driver for DSPAM
171 Summary(pl): Sterownik DB dla DSPAM-a
173 Requires(post): sed >= 4.0
174 Requires: %{name}-libs = %{version}-%{release}
175 Provides: %{name}-driver = %{version}-%{release}
177 %description driver-db
180 %description driver-db -l pl
181 Sterownik DB dla DSPAM-a.
183 %package driver-mysql
184 Summary: MySQL driver for DSPAM
185 Summary(pl): Sterownik MySQL dla DSPAM-a
187 Requires(post): sed >= 4.0
188 Requires: %{name}-libs = %{version}-%{release}
189 Provides: %{name}-driver = %{version}-%{release}
191 %description driver-mysql
192 MySQL driver for DSPAM.
194 %description driver-mysql -l pl
195 Sterownik MySQL dla DSPAM-a.
197 %package driver-pgsql
198 Summary: PostgreSQL driver for DSPAM
199 Summary(pl): Sterownik PostgreSQL dla DSPAM-a
201 Requires(post): sed >= 4.0
202 Requires: %{name}-libs = %{version}-%{release}
203 Provides: %{name}-driver = %{version}-%{release}
205 %description driver-pgsql
206 PostgreSQL driver for DSPAM.
208 %description driver-pgsql -l pl
209 Sterownik PostgreSQL dla DSPAM-a.
211 %package driver-sqlite
212 Summary: SQLite driver for DSPAM
213 Summary(pl): Sterownik SQLite dla DSPAM-a
215 Requires(post): sed >= 4.0
216 Requires: %{name}-libs = %{version}-%{release}
217 Provides: %{name}-driver = %{version}-%{release}
219 %description driver-sqlite
220 SQLite driver for DSPAM.
222 %description driver-sqlite -l pl
223 Sterownik SQLite dla DSPAM-a.
226 Summary: DSPAM Web UI
227 Group: Applications/WWW
230 Requires: %{name} = %{version}-%{release}
233 The Web UI (CGI client) can be run from any executable location on a
234 web server, and detects its user's identity from the REMOTE_USER
235 environment variable. This means you'll need to use HTTP password
236 authentication to access the CGI (Any type of authentication will
237 work, so long as Apache supports the module). This is also convenient
238 in that you can set up authentication using almost any existing system
239 you have. The only catch is that you'll need the usernames to match
240 the actual DSPAM usernames used the system. A copy of the shadow
241 password file will suffice for most common installs.
246 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
247 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
257 %{?with_db:libdb4_drv}
258 %{?with_mysql:mysql_drv}
259 %{?with_pgsql:pgsql_drv}
260 %{?with_sqlite:sqlite_drv}
263 --disable-dependency-tracking \
264 %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
265 --enable-trusted-user-security \
267 --enable-large-scale \
268 --with-userdir=/var/lib/%{name} \
269 --with-userdir-owner=none \
270 --with-userdir-group=none \
271 --with-dspam-home=/var/lib/%{name} \
272 --with-dspam-home-owner=none \
273 --with-dspam-home-group=none \
274 --with-dspam-owner=none \
275 --with-dspam-group=none \
276 --with-signature-life=14 \
279 --enable-preferences-extension \
280 --enable-long-usernames \
281 --enable-neural-networking \
282 --enable-virtual-users \
283 --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
285 --with-mysql-includes=%{_includedir}/mysql \
286 --with-mysql-libraries=%{_libdir} \
289 --with-pgsql-includes=%{_includedir}/postgresql \
290 --with-pgsql-libraries=%{_libdir} \
293 --with-sqlite3-includes=%{_includedir} \
294 --with-sqlite3-libraries=%{_libdir} \
298 # --enable-dclassify-extension needs libdclassify
303 rm -rf $RPM_BUILD_ROOT
306 DESTDIR=$RPM_BUILD_ROOT
308 install -d $RPM_BUILD_ROOT/{var/run/dspam,/etc/{rc.d/init.d,sysconfig}}
309 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
312 ln -s /var/log/dspam $RPM_BUILD_ROOT/var/lib/%{name}/log
314 # install devel files
315 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
316 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
318 # provide maintenance scripts
319 install -d $RPM_BUILD_ROOT/etc/cron.daily
320 install -d $RPM_BUILD_ROOT/etc/cron.weekly
322 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
324 exec %{_bindir}/%{name}_clean -s -p
327 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
330 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
333 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
337 install -d $RPM_BUILD_ROOT/var/lib/%{name}
338 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
343 This file can only contain 5 lines with the following values:
355 install -d $RPM_BUILD_ROOT/var/lib/%{name}
356 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
361 This file can only contain 5 lines with the following values:
371 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
372 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
373 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
374 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
377 /sbin/chkconfig --add dspam
378 %service dspam restart "dspam daemon"
381 if [ "$1" = "0" ]; then
383 /sbin/chkconfig --del dspam
387 rm -rf $RPM_BUILD_ROOT
389 %post libs -p /sbin/ldconfig
390 %postun libs -p /sbin/ldconfig
393 if [ "$1" = "1" ]; then
394 sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
398 if [ "$1" = "1" ]; then
399 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
403 if [ "$1" = "1" ]; then
404 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
408 if [ "$1" = "1" ]; then
409 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
413 if [ "$1" = "1" ]; then
414 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
417 %triggerin webui -- apache1
418 %webapp_register apache %{_webapp}
420 %triggerun webui -- apache1
421 %webapp_unregister apache %{_webapp}
423 %triggerin webui -- apache < 2.2.0, apache-base
424 %webapp_register httpd %{_webapp}
426 %triggerun webui -- apache < 2.2.0, apache-base
427 %webapp_unregister httpd %{_webapp}
430 %defattr(644,root,root,755)
431 %doc README CHANGELOG RELEASE.NOTES UPGRADING
432 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
433 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
434 %dir %attr(750,root,mail) /var/lib/%{name}
435 %dir %attr(770,root,mail) /var/log/dspam
436 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
437 %attr(755,root,root) %{_bindir}/%{name}
438 %attr(755,root,root) %{_bindir}/%{name}_logrotate
439 %attr(755,root,root) %{_bindir}/%{name}_clean
440 %attr(755,root,root) %{_bindir}/%{name}_corpus
441 %attr(755,root,root) %{_bindir}/%{name}_crc
442 %attr(755,root,root) %{_bindir}/%{name}_dump
443 %attr(755,root,root) %{_bindir}/%{name}_genaliases
444 %attr(755,root,root) %{_bindir}/%{name}_stats
445 %attr(755,root,root) %{_bindir}/%{name}_merge
446 %attr(755,root,root) %{_bindir}/%{name}_2sql
447 %attr(755,root,root) %{_bindir}/%{name}_admin
448 %attr(755,root,root) %{_bindir}/%{name}_train
449 %{_mandir}/man?/%{name}*
452 %attr(754,root,root) /etc/rc.d/init.d/dspam
454 %defattr(644,root,root,755)
455 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
456 %attr(770,root,mail) /var/run/dspam
458 %attr(755,root,root) %{_bindir}/%{name}c
461 %defattr(644,root,root,755)
462 %doc README CHANGELOG
463 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
464 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
467 %defattr(644,root,root,755)
468 %attr(755,root,root) %{_libdir}/lib*.so
469 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
471 %{_includedir}/%{name}
472 %{_mandir}/man3/libdspam*
473 %{_pkgconfigdir}/*.pc
476 %defattr(644,root,root,755)
480 %defattr(644,root,root,755)
481 %attr(755,root,root) %{_bindir}/css*
482 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
486 %defattr(644,root,root,755)
487 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
492 %defattr(644,root,root,755)
493 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
494 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
495 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
500 %defattr(644,root,root,755)
501 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
502 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
503 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
504 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
509 %defattr(644,root,root,755)
510 %doc doc/sqlite_drv.txt
511 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
515 %defattr(644,root,root,755)
516 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
517 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
518 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
519 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
520 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
521 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
522 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
524 %dir %{_datadir}/dspam
525 %dir %{_datadir}/dspam/cgi
526 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
527 %{_datadir}/dspam/cgi/templates
528 %{_datadir}/dspam/htdocs