2 # - support for libdclassify
4 # - messages from default install of cron with mysql driver Memory fault
5 # - install drivers in /usr/lib/dspam
8 %bcond_without mysql # disable MySQL storage driver
9 %bcond_without pgsql # disable PostgreSQL storage driver
10 %bcond_without sqlite # disable SQLite3 storage driver
11 %bcond_with mysql40 # use with mysql 4.0
13 %include /usr/lib/rpm/macros.perl
14 Summary: A library and Mail Delivery Agent for Bayesian spam filtering
15 Summary(pl.UTF-8): Biblioteka i MDA do bayesowskiego filtrowania spamu
20 Group: Applications/Mail
21 Source0: http://dspam.nuclearelephant.com/sources/%{name}-%{version}.tar.gz
22 # Source0-md5: 056b8c8b3ad9415a52c01b22ff1e64cf
23 Patch0: %{name}-webui.patch
24 Patch1: %{name}-config.patch
25 Patch2: %{name}-speedup.patch
26 Patch3: %{name}-autotools.patch
28 Source2: %{name}-apache.conf
29 URL: http://dspam.nuclearelephant.com/
30 BuildRequires: autoconf
31 BuildRequires: automake
32 BuildRequires: clamav-devel
33 BuildRequires: libtool
34 %{?with_mysql:BuildRequires: mysql-devel}
35 BuildRequires: openldap-devel >= 2.4.6
36 %{?with_pgsql:BuildRequires: postgresql-devel}
37 BuildRequires: rpm-perlprov >= 4.1-13
38 BuildRequires: rpmbuild(macros) >= 1.268
39 BuildRequires: sed >= 4.0
40 %{?with_sqlite:BuildRequires: sqlite3-devel}
41 BuildRequires: zlib-devel
42 Requires(post,preun): /sbin/chkconfig
43 Requires: %{name}-common = %{version}-%{release}
44 Requires: %{name}-driver = %{version}-%{release}
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 Requires: %{name}-common
98 %description client -l pl.UTF-8
102 Summary: Common files for dspam packages
103 Summary(pl.UTF-8): Wspólne pliki dla pakietów z dspamem
104 Group: Applications/Mail
107 Common files for dspam and dspam-client packages.
109 %description client -l pl.UTF-8
110 Wspólne pliki dla pakietów dspam i dspam-client.
113 Summary: A library for Bayesian spam filtering
114 Summary(pl.UTF-8): Biblioteka do bayesowskiego filtrowania spamu
116 Obsoletes: dspam-driver-db
119 DSPAM (as in De-Spam) is an open-source project to create a new kind
120 of anti-spam mechanism, and is currently effective as both a
121 server-side agent for UNIX email servers and a developer's library for
122 mail clients, other anti-spam tools, and similar projects requiring
123 drop-in spam filtering.
125 This package contains the library.
127 %description libs -l pl.UTF-8
128 DSPAM (czyli De-Spam) to projekt o otwartych źródłach mający na celu
129 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
130 efektywny zarówno jako działający po stronie serwera agent dla
131 uniksowych serwerów pocztowych jak i biblioteka dla programistów
132 klientów pocztowych, innych narzędzi antyspamowych i innych projektów
133 wymagających filtrowania spamu w locie.
135 Ten pakiet zawiera wspomnianą bibliotekę.
138 Summary: Header files for the DSPAM library
139 Summary(pl.UTF-8): Pliki nagłówkowe biblioteki DSPAM
140 Group: Development/Libraries
141 Requires: %{name}-libs = %{version}-%{release}
144 DSPAM has had its core engine moved into a separate library, libdspam.
145 This library can be used by developers to provide 'drop-in' spam
146 filtering for their mail client applications, other anti-spam tools,
149 %description devel -l pl.UTF-8
150 Główny silnik DSPAM został przeniesiony do oddzielnej biblioteki
151 libdspam, która może być używana przez programistów do zapewnienia
152 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
153 narzędzi antyspamowych i podobnych projektów.
156 Summary: Static DSPAM library
157 Summary(pl.UTF-8): Statyczna biblioteka DSPAM
158 Group: Development/Libraries
159 Requires: %{name}-devel = %{version}-%{release}
162 Static DSPAM library.
164 %description static -l pl.UTF-8
165 Statyczna biblioteka DSPAM.
168 Summary: HASH driver for DSPAM
169 Summary(pl.UTF-8): Sterownik HASH dla DSPAM-a
171 Requires(post): sed >= 4.0
172 Requires: %{name} = %{version}-%{release}
173 Provides: %{name}-driver = %{version}-%{release}
175 %description driver-hash
176 HASH driver for DSPAM.
178 %description driver-hash -l pl.UTF-8
179 Sterownik HASH dla DSPAM-a.
181 %package driver-mysql
182 Summary: MySQL driver for DSPAM
183 Summary(pl.UTF-8): Sterownik MySQL dla DSPAM-a
185 Requires(post): sed >= 4.0
186 Requires: %{name} = %{version}-%{release}
187 Provides: %{name}-driver = %{version}-%{release}
189 %description driver-mysql
190 MySQL driver for DSPAM.
192 %description driver-mysql -l pl.UTF-8
193 Sterownik MySQL dla DSPAM-a.
195 %package driver-pgsql
196 Summary: PostgreSQL driver for DSPAM
197 Summary(pl.UTF-8): Sterownik PostgreSQL dla DSPAM-a
199 Requires(post): sed >= 4.0
200 Requires: %{name} = %{version}-%{release}
201 Provides: %{name}-driver = %{version}-%{release}
203 %description driver-pgsql
204 PostgreSQL driver for DSPAM.
206 %description driver-pgsql -l pl.UTF-8
207 Sterownik PostgreSQL dla DSPAM-a.
209 %package driver-sqlite3
210 Summary: SQLite driver for DSPAM
211 Summary(pl.UTF-8): Sterownik SQLite dla DSPAM-a
213 Requires(post): sed >= 4.0
214 Requires: %{name} = %{version}-%{release}
215 Provides: %{name}-driver = %{version}-%{release}
216 Obsoletes: dspam-driver-sqlite
218 %description driver-sqlite3
219 SQLite driver for DSPAM.
221 %description driver-sqlite3 -l pl.UTF-8
222 Sterownik SQLite dla DSPAM-a.
225 Summary: DSPAM Web UI
226 Summary(pl.UTF-8): Interfejs WWW do programu DSPAM
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.
243 %description webui -l pl.UTF-8
244 Interfejs użytkownika WWW (klient CGI) może być uruchamiany z
245 dowolnego wykonywalnego miejsca na serwerze WWW i rozpoznaje tożsamość
246 użytkownika ze zmiennej środowiskowej REMOTE_USER. Oznacza to, że
247 trzeba użyć uwietrzytelnienia HTTP z hasłem do dostępu do CGI (działać
248 będzie dowolny rodzaj uwierzytelnienia obsługiwany przez moduły
249 Apache'a). Jest to o tyle wygodne, że można skonfigurować
250 uwierzytelnianie dla prawie każdego istniejącego systemu. Jedynym
251 wymogiem jest, żeby nazwy użytkowników pokrywały się z nazwami
252 użytkowników DSPAM-a używanymi w systemie. Kopia pliku shadow
253 wystarczy dla większości popularnych instalacji.
261 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
262 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
263 sed -i -e 's,/usr/local/dspam/bin,/usr/bin,' ./scripts/train.pl
273 %{?with_mysql:mysql_drv}
274 %{?with_pgsql:pgsql_drv}
275 %{?with_sqlite:sqlite3_drv}
278 --disable-dependency-tracking \
279 %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
280 --enable-trusted-user-security \
281 --enable-large-scale \
282 --with-dspam-home=/var/lib/%{name} \
283 --with-dspam-home-owner=none \
284 --with-dspam-home-group=none \
285 --with-dspam-owner=none \
286 --with-dspam-group=none \
289 --enable-preferences-extension \
290 --enable-long-usernames \
291 --enable-virtual-users \
292 --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
294 --with-mysql-includes=%{_includedir}/mysql \
295 --with-mysql-libraries=%{_libdir} \
298 --with-pgsql-includes=%{_includedir}/postgresql \
299 --with-pgsql-libraries=%{_libdir} \
303 --with-sqlite-includes=%{_includedir} \
304 --with-sqlite-libraries=%{_libdir} \
309 # --enable-dclassify-extension needs libdclassify
314 rm -rf $RPM_BUILD_ROOT
315 install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}} \
316 $RPM_BUILD_ROOT/var/lib/%{name}/{txt,data}
319 DESTDIR=$RPM_BUILD_ROOT
321 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
323 cp -a txt/*.txt $RPM_BUILD_ROOT/var/lib/%{name}/txt
325 # install devel files
326 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
327 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
329 # provide maintenance scripts
330 install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
331 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
333 exec %{_bindir}/%{name}_clean -s -p
336 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
339 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
342 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
347 This file can only contain 5 lines with the following values:
358 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
363 This file can only contain 5 lines with the following values:
373 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
374 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
375 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
376 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
379 /sbin/chkconfig --add dspam
380 %service dspam restart "dspam daemon"
383 if [ "$1" = "0" ]; then
385 /sbin/chkconfig --del dspam
389 rm -rf $RPM_BUILD_ROOT
391 %post libs -p /sbin/ldconfig
392 %postun libs -p /sbin/ldconfig
395 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
398 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
401 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
404 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite3_drv.so,' /etc/dspam.conf
406 %triggerin webui -- apache1 < 1.3.37-3, apache1-base
407 %webapp_register apache %{_webapp}
409 %triggerun webui -- apache1 < 1.3.37-3, apache1-base
410 %webapp_unregister apache %{_webapp}
412 %triggerin webui -- apache < 2.2.0, apache-base
413 %webapp_register httpd %{_webapp}
415 %triggerun webui -- apache < 2.2.0, apache-base
416 %webapp_unregister httpd %{_webapp}
419 %defattr(644,root,root,755)
420 %doc README CHANGELOG RELEASE.NOTES UPGRADING
421 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
422 %doc scripts/train.pl
423 %dir %attr(775,root,mail) /var/run/dspam
424 %dir %attr(750,root,mail) /var/lib/%{name}
425 %dir %attr(770,root,mail) /var/lib/%{name}/data
426 %dir /var/lib/%{name}/txt
427 %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/txt/*.txt
428 %dir %attr(770,root,mail) /var/log/dspam
429 %attr(754,root,root) /etc/rc.d/init.d/dspam
430 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
431 %attr(755,root,root) %{_bindir}/%{name}
432 %attr(755,root,root) %{_bindir}/%{name}_logrotate
433 %attr(755,root,root) %{_bindir}/%{name}_clean
434 %attr(755,root,root) %{_bindir}/%{name}_crc
435 %attr(755,root,root) %{_bindir}/%{name}_dump
436 %attr(755,root,root) %{_bindir}/%{name}_stats
437 %attr(755,root,root) %{_bindir}/%{name}_merge
438 %attr(755,root,root) %{_bindir}/%{name}_2sql
439 %attr(755,root,root) %{_bindir}/%{name}_admin
440 %attr(755,root,root) %{_bindir}/%{name}_train
441 %{_mandir}/man?/%{name}*
444 %defattr(644,root,root,755)
445 %attr(755,root,root) %{_bindir}/%{name}c
448 %defattr(644,root,root,755)
449 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
452 %defattr(644,root,root,755)
453 %attr(755,root,root) %{_libdir}/libdspam.so.7.0.0
454 %attr(755,root,root) %ghost %{_libdir}/libdspam.so.7
457 %defattr(644,root,root,755)
458 %attr(755,root,root) %{_libdir}/libdspam.so
459 %{_libdir}/libdspam.la
460 %{_libdir}/lib*_drv.la
461 %{_includedir}/%{name}
462 %{_mandir}/man3/libdspam.3*
463 %{_pkgconfigdir}/*.pc
466 %defattr(644,root,root,755)
467 %{_libdir}/libdspam.a
468 %{_libdir}/lib*_drv.a
471 %defattr(644,root,root,755)
472 %attr(755,root,root) %{_bindir}/css*
473 %attr(755,root,root) %{_libdir}/libhash_drv.so.7.0.0
474 %attr(755,root,root) %ghost %{_libdir}/libhash_drv.so.7
475 %{_libdir}/libhash_drv.so
479 %defattr(644,root,root,755)
480 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
481 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
482 %attr(755,root,root) %{_libdir}/libmysql_drv.so.7.0.0
483 %attr(755,root,root) %ghost %{_libdir}/libmysql_drv.so.7
484 %{_libdir}/libmysql_drv.so
489 %defattr(644,root,root,755)
490 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
491 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
492 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
493 %attr(755,root,root) %{_libdir}/libpgsql_drv.so.7.0.0
494 %attr(755,root,root) %ghost %{_libdir}/libpgsql_drv.so.7
495 %{_libdir}/libpgsql_drv.so
499 %files driver-sqlite3
500 %defattr(644,root,root,755)
501 %doc doc/sqlite_drv.txt
502 %attr(755,root,root) %{_libdir}/libsqlite3_drv.so.7.0.0
503 %attr(755,root,root) %ghost %{_libdir}/libsqlite3_drv.so.7
504 %{_libdir}/libsqlite3_drv.so
508 %defattr(644,root,root,755)
509 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
510 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
511 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
512 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
513 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
514 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
515 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
517 %dir %{_datadir}/dspam
518 %dir %{_datadir}/dspam/cgi
519 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
520 %{_datadir}/dspam/cgi/templates
521 %{_datadir}/dspam/htdocs