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
231 The Web UI (CGI client) can be run from any executable location on a
232 web server, and detects its user's identity from the REMOTE_USER
233 environment variable. This means you'll need to use HTTP password
234 authentication to access the CGI (Any type of authentication will
235 work, so long as Apache supports the module). This is also convenient
236 in that you can set up authentication using almost any existing system
237 you have. The only catch is that you'll need the usernames to match
238 the actual DSPAM usernames used the system. A copy of the shadow
239 password file will suffice for most common installs.
244 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
245 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
255 %{?with_db:libdb4_drv}
256 %{?with_mysql:mysql_drv}
257 %{?with_pgsql:pgsql_drv}
258 %{?with_sqlite:sqlite_drv}
261 %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
262 --enable-trusted-user-security \
264 --enable-large-scale \
265 --with-userdir=/var/lib/%{name} \
266 --with-userdir-owner=none \
267 --with-userdir-group=none \
268 --with-dspam-home=/var/lib/%{name} \
269 --with-dspam-home-owner=none \
270 --with-dspam-home-group=none \
271 --with-dspam-owner=none \
272 --with-dspam-group=none \
273 --with-signature-life=14 \
274 --disable-dependency-tracking \
277 --enable-preferences-extension \
278 --enable-long-usernames \
279 --enable-neural-networking \
280 --enable-virtual-users \
281 --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
283 --with-mysql-includes=%{_includedir}/mysql \
284 --with-mysql-libraries=%{_libdir} \
287 --with-pgsql-includes=%{_includedir}/postgresql \
288 --with-pgsql-libraries=%{_libdir} \
291 --with-sqlite3-includes=%{_includedir} \
292 --with-sqlite3-libraries=%{_libdir} \
296 # --enable-dclassify-extension needs libdclassify
301 rm -rf $RPM_BUILD_ROOT
304 DESTDIR=$RPM_BUILD_ROOT
306 install -d $RPM_BUILD_ROOT/{var/run/dspam,/etc/{rc.d/init.d,sysconfig}}
307 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
310 ln -s /var/log/dspam $RPM_BUILD_ROOT/var/lib/%{name}/log
312 # install devel files
313 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
314 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
316 # provide maintenance scripts
317 install -d $RPM_BUILD_ROOT/etc/cron.daily
318 install -d $RPM_BUILD_ROOT/etc/cron.weekly
320 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
322 exec %{_bindir}/%{name}_clean -s -p
325 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
328 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
331 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
335 install -d $RPM_BUILD_ROOT/var/lib/%{name}
336 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
341 This file can only contain 5 lines with the following values:
353 install -d $RPM_BUILD_ROOT/var/lib/%{name}
354 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
359 This file can only contain 5 lines with the following values:
369 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
370 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
371 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
372 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
375 /sbin/chkconfig --add dspam
376 %service dspam restart "dspam daemon"
379 if [ "$1" = "0" ]; then
381 /sbin/chkconfig --del dspam
385 rm -rf $RPM_BUILD_ROOT
387 %post libs -p /sbin/ldconfig
388 %postun libs -p /sbin/ldconfig
391 if [ "$1" = "1" ]; then
392 sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
396 if [ "$1" = "1" ]; then
397 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
401 if [ "$1" = "1" ]; then
402 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
406 if [ "$1" = "1" ]; then
407 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
411 if [ "$1" = "1" ]; then
412 sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
415 %triggerin webui -- apache1
416 %webapp_register apache %{_webapp}
418 %triggerun webui -- apache1
419 %webapp_unregister apache %{_webapp}
421 %triggerin webui -- apache < 2.2.0, apache-base
422 %webapp_register httpd %{_webapp}
424 %triggerun webui -- apache < 2.2.0, apache-base
425 %webapp_unregister httpd %{_webapp}
428 %defattr(644,root,root,755)
429 %doc README CHANGELOG RELEASE.NOTES UPGRADING
430 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
431 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
432 %dir %attr(750,root,mail) /var/lib/%{name}
433 %dir %attr(770,root,mail) /var/log/dspam
434 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
435 %attr(755,root,root) %{_bindir}/%{name}
436 %attr(755,root,root) %{_bindir}/%{name}_logrotate
437 %attr(755,root,root) %{_bindir}/%{name}_clean
438 %attr(755,root,root) %{_bindir}/%{name}_corpus
439 %attr(755,root,root) %{_bindir}/%{name}_crc
440 %attr(755,root,root) %{_bindir}/%{name}_dump
441 %attr(755,root,root) %{_bindir}/%{name}_genaliases
442 %attr(755,root,root) %{_bindir}/%{name}_stats
443 %attr(755,root,root) %{_bindir}/%{name}_merge
444 %attr(755,root,root) %{_bindir}/%{name}_2sql
445 %attr(755,root,root) %{_bindir}/%{name}_admin
446 %attr(755,root,root) %{_bindir}/%{name}_train
447 %{_mandir}/man?/%{name}*
450 %attr(754,root,root) /etc/rc.d/init.d/dspam
452 %defattr(644,root,root,755)
453 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
454 %attr(770,root,mail) /var/run/dspam
456 %attr(755,root,root) %{_bindir}/%{name}c
459 %defattr(644,root,root,755)
460 %doc README CHANGELOG
461 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
462 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
465 %defattr(644,root,root,755)
466 %attr(755,root,root) %{_libdir}/lib*.so
467 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
469 %{_includedir}/%{name}
470 %{_mandir}/man3/libdspam*
471 %{_pkgconfigdir}/*.pc
474 %defattr(644,root,root,755)
478 %defattr(644,root,root,755)
479 %attr(755,root,root) %{_bindir}/css*
480 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
484 %defattr(644,root,root,755)
485 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
490 %defattr(644,root,root,755)
491 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
492 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
493 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
498 %defattr(644,root,root,755)
499 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
500 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
501 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
502 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
507 %defattr(644,root,root,755)
508 %doc doc/sqlite_drv.txt
509 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
513 %defattr(644,root,root,755)
514 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
515 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
516 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
517 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
518 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
519 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
520 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
522 %dir %{_datadir}/dspam
523 %dir %{_datadir}/dspam/cgi
524 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
525 %{_datadir}/dspam/cgi/templates
526 %{_datadir}/dspam/htdocs