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_with mysql40 # use with mysql 4.0
12 %include /usr/lib/rpm/macros.perl
13 Summary: A library and Mail Delivery Agent for Bayesian spam filtering
14 Summary(pl.UTF-8): Biblioteka i MDA do bayesowskiego filtrowania spamu
19 Group: Applications/Mail
20 Source0: http://dspam.nuclearelephant.com/sources/%{name}-%{version}.tar.gz
21 # Source0-md5: 056b8c8b3ad9415a52c01b22ff1e64cf
22 Patch0: %{name}-webui.patch
23 Patch1: %{name}-config.patch
24 Patch2: %{name}-speedup.patch
25 Patch3: %{name}-autotools.patch
27 Source2: %{name}-apache.conf
28 URL: http://dspam.nuclearelephant.com/
29 BuildRequires: autoconf
30 BuildRequires: automake
31 BuildRequires: clamav-devel
32 BuildRequires: libtool
33 %{?with_mysql:BuildRequires: mysql-devel}
34 BuildRequires: openldap-devel >= 2.4.6
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
42 Requires: %{name}-common = %{version}-%{release}
43 Requires: %{name}-driver = %{version}-%{release}
45 Buildroot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
47 %define _webapps /etc/webapps
48 %define _webapp %{name}
51 DSPAM (as in De-Spam) is an open-source project to create a new kind
52 of anti-spam mechanism, and is currently effective as both a
53 server-side agent for UNIX email servers and a developer's library for
54 mail clients, other anti-spam tools, and similar projects requiring
55 drop-in spam filtering.
57 The DSPAM agent masquerades as the email server's local delivery agent
58 and filters/learns spams using an advanced Bayesian statistical
59 approach (based on Bayes's theorem of combined probabilities) which
60 provides an administratively maintenance-free, easy-learning Anti-Spam
61 service custom tailored to each individual user's behavior. Advanced
62 because on top of standard Bayesian filtering is also incorporated the
63 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
64 works great with Sendmail and Exim, and should work well with any
65 other MTA that supports an external local delivery agent (postfix,
68 %description -l pl.UTF-8
69 DSPAM (czyli De-Spam) to projekt o otwartych źródłach mający na celu
70 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
71 efektywny zarówno jako działający po stronie serwera agent dla
72 uniksowych serwerów pocztowych jak i biblioteka dla programistów
73 klientów pocztowych, innych narzędzi antyspamowych i innych projektów
74 wymagających filtrowania spamu w locie.
76 Agent DSPAM zachowuje się jak lokalny agent dostarczania poczty (MDA)
77 i filtruje/uczy się spamu przy użyciu zaawansowanego bayesowskiego
78 przybliżenia statystycznego (opartego na twierdzeniu Bayesa o
79 połączonych prawdopodobieństwach), dając nie wymagającą obsługi
80 administracyjnej, łatwo uczącą się usługę antyspamową dostosowaną do
81 zachowania każdego użytkownika. Metoda jest zaawansowana ponieważ na
82 podstawie standardowego filtrowania bayesowskiego wprowadzono użycie
83 tokenów łańcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
84 DSPAM działa wspaniale z Sendmailem i Eximem, powinien działać dobrze
85 z każdym innym MTA obsługującym zewnętrznego agenta MDA (postfiksem,
90 Summary(pl.UTF-8): Klient dspam
91 Requires: %{name}-common
92 Group: Applications/Mail
97 %description client -l pl.UTF-8
101 Summary: Common files for dspam packages
102 Summary(pl.UTF-8): Wspólne pliki dla pakietów z dspamem
103 Group: Applications/Mail
106 Common files for dspam and dspam-client packages.
108 %description client -l pl.UTF-8
109 Wspólne pliki dla pakietów dspam i dspam-client.
112 Summary: A library for Bayesian spam filtering
113 Summary(pl.UTF-8): Biblioteka do bayesowskiego filtrowania spamu
115 Obsoletes: dspam-driver-db
118 DSPAM (as in De-Spam) is an open-source project to create a new kind
119 of anti-spam mechanism, and is currently effective as both a
120 server-side agent for UNIX email servers and a developer's library for
121 mail clients, other anti-spam tools, and similar projects requiring
122 drop-in spam filtering.
124 This package contains the library.
126 %description libs -l pl.UTF-8
127 DSPAM (czyli De-Spam) to projekt o otwartych źródłach mający na celu
128 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
129 efektywny zarówno jako działający po stronie serwera agent dla
130 uniksowych serwerów pocztowych jak i biblioteka dla programistów
131 klientów pocztowych, innych narzędzi antyspamowych i innych projektów
132 wymagających filtrowania spamu w locie.
134 Ten pakiet zawiera wspomnianą bibliotekę.
137 Summary: Header files for the DSPAM library
138 Summary(pl.UTF-8): Pliki nagłówkowe biblioteki DSPAM
139 Group: Development/Libraries
140 Requires: %{name}-libs = %{version}-%{release}
143 DSPAM has had its core engine moved into a separate library, libdspam.
144 This library can be used by developers to provide 'drop-in' spam
145 filtering for their mail client applications, other anti-spam tools,
148 %description devel -l pl.UTF-8
149 Główny silnik DSPAM został przeniesiony do oddzielnej biblioteki
150 libdspam, która może być używana przez programistów do zapewnienia
151 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
152 narzędzi antyspamowych i podobnych projektów.
155 Summary: Static DSPAM library
156 Summary(pl.UTF-8): Statyczna biblioteka DSPAM
157 Group: Development/Libraries
158 Requires: %{name}-devel = %{version}-%{release}
161 Static DSPAM library.
163 %description static -l pl.UTF-8
164 Statyczna biblioteka DSPAM.
167 Summary: HASH driver for DSPAM
168 Summary(pl.UTF-8): Sterownik HASH dla DSPAM-a
170 Requires(post): sed >= 4.0
171 Requires: %{name} = %{version}-%{release}
172 Provides: %{name}-driver = %{version}-%{release}
174 %description driver-hash
175 HASH driver for DSPAM.
177 %description driver-hash -l pl.UTF-8
178 Sterownik HASH dla DSPAM-a.
180 %package driver-mysql
181 Summary: MySQL driver for DSPAM
182 Summary(pl.UTF-8): Sterownik MySQL dla DSPAM-a
184 Requires(post): sed >= 4.0
185 Requires: %{name} = %{version}-%{release}
186 Provides: %{name}-driver = %{version}-%{release}
188 %description driver-mysql
189 MySQL driver for DSPAM.
191 %description driver-mysql -l pl.UTF-8
192 Sterownik MySQL dla DSPAM-a.
194 %package driver-pgsql
195 Summary: PostgreSQL driver for DSPAM
196 Summary(pl.UTF-8): Sterownik PostgreSQL dla DSPAM-a
198 Requires(post): sed >= 4.0
199 Requires: %{name} = %{version}-%{release}
200 Provides: %{name}-driver = %{version}-%{release}
202 %description driver-pgsql
203 PostgreSQL driver for DSPAM.
205 %description driver-pgsql -l pl.UTF-8
206 Sterownik PostgreSQL dla DSPAM-a.
208 %package driver-sqlite
209 Summary: SQLite driver for DSPAM
210 Summary(pl.UTF-8): Sterownik SQLite dla DSPAM-a
212 Requires(post): sed >= 4.0
213 Requires: %{name} = %{version}-%{release}
214 Provides: %{name}-driver = %{version}-%{release}
216 %description driver-sqlite
217 SQLite driver for DSPAM.
219 %description driver-sqlite -l pl.UTF-8
220 Sterownik SQLite dla DSPAM-a.
223 Summary: DSPAM Web UI
224 Summary(pl.UTF-8): Interfejs WWW do programu DSPAM
225 Group: Applications/WWW
228 Requires: %{name} = %{version}-%{release}
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.
241 %description webui -l pl.UTF-8
242 Interfejs użytkownika WWW (klient CGI) może być uruchamiany z
243 dowolnego wykonywalnego miejsca na serwerze WWW i rozpoznaje tożsamość
244 użytkownika ze zmiennej środowiskowej REMOTE_USER. Oznacza to, że
245 trzeba użyć uwietrzytelnienia HTTP z hasłem do dostępu do CGI (działać
246 będzie dowolny rodzaj uwierzytelnienia obsługiwany przez moduły
247 Apache'a). Jest to o tyle wygodne, że można skonfigurować
248 uwierzytelnianie dla prawie każdego istniejącego systemu. Jedynym
249 wymogiem jest, żeby nazwy użytkowników pokrywały się z nazwami
250 użytkowników DSPAM-a używanymi w systemie. Kopia pliku shadow
251 wystarczy dla większości popularnych instalacji.
259 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
260 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
261 sed -i -e 's,/usr/local/dspam/bin,/usr/bin,' ./scripts/train.pl
271 %{?with_mysql:mysql_drv}
272 %{?with_pgsql:pgsql_drv}
273 %{?with_sqlite:sqlite3_drv}
276 --disable-dependency-tracking \
277 %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
278 --enable-trusted-user-security \
279 --enable-large-scale \
280 --with-dspam-home=/var/lib/%{name} \
281 --with-dspam-home-owner=none \
282 --with-dspam-home-group=none \
283 --with-dspam-owner=none \
284 --with-dspam-group=none \
287 --enable-preferences-extension \
288 --enable-long-usernames \
289 --enable-virtual-users \
290 --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
292 --with-mysql-includes=%{_includedir}/mysql \
293 --with-mysql-libraries=%{_libdir} \
296 --with-pgsql-includes=%{_includedir}/postgresql \
297 --with-pgsql-libraries=%{_libdir} \
301 --with-sqlite-includes=%{_includedir} \
302 --with-sqlite-libraries=%{_libdir} \
307 # --enable-dclassify-extension needs libdclassify
312 rm -rf $RPM_BUILD_ROOT
313 install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}} \
314 $RPM_BUILD_ROOT/var/lib/%{name}/{txt,data}
317 DESTDIR=$RPM_BUILD_ROOT
319 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
321 cp -a txt/*.txt $RPM_BUILD_ROOT/var/lib/%{name}/txt
323 # install devel files
324 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
325 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
327 # provide maintenance scripts
328 install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
329 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
331 exec %{_bindir}/%{name}_clean -s -p
334 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
337 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
340 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
345 This file can only contain 5 lines with the following values:
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 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
396 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
399 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
402 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite3_drv.so,' /etc/dspam.conf
404 %triggerin webui -- apache1 < 1.3.37-3, apache1-base
405 %webapp_register apache %{_webapp}
407 %triggerun webui -- apache1 < 1.3.37-3, apache1-base
408 %webapp_unregister apache %{_webapp}
410 %triggerin webui -- apache < 2.2.0, apache-base
411 %webapp_register httpd %{_webapp}
413 %triggerun webui -- apache < 2.2.0, apache-base
414 %webapp_unregister httpd %{_webapp}
417 %defattr(644,root,root,755)
418 %doc README CHANGELOG RELEASE.NOTES UPGRADING
419 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
420 %doc scripts/train.pl
421 %dir %attr(775,root,mail) /var/run/dspam
422 %dir %attr(750,root,mail) /var/lib/%{name}
423 %dir %attr(770,root,mail) /var/lib/%{name}/data
424 %dir /var/lib/%{name}/txt
425 %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/txt/*.txt
426 %dir %attr(770,root,mail) /var/log/dspam
427 %attr(754,root,root) /etc/rc.d/init.d/dspam
428 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
429 %attr(755,root,root) %{_bindir}/%{name}
430 %attr(755,root,root) %{_bindir}/%{name}_logrotate
431 %attr(755,root,root) %{_bindir}/%{name}_clean
432 %attr(755,root,root) %{_bindir}/%{name}_crc
433 %attr(755,root,root) %{_bindir}/%{name}_dump
434 %attr(755,root,root) %{_bindir}/%{name}_stats
435 %attr(755,root,root) %{_bindir}/%{name}_merge
436 %attr(755,root,root) %{_bindir}/%{name}_2sql
437 %attr(755,root,root) %{_bindir}/%{name}_admin
438 %attr(755,root,root) %{_bindir}/%{name}_train
439 %{_mandir}/man?/%{name}*
442 %defattr(644,root,root,755)
443 %attr(755,root,root) %{_bindir}/%{name}c
446 %defattr(644,root,root,755)
447 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
450 %defattr(644,root,root,755)
451 %attr(755,root,root) %{_libdir}/libdspam.so.7.0.0
452 %attr(755,root,root) %ghost %{_libdir}/libdspam.so.7
455 %defattr(644,root,root,755)
456 %attr(755,root,root) %{_libdir}/libdspam.so
457 %attr(755,root,root) %{_libdir}/lib*_drv.so
458 %{_libdir}/libdspam.la
459 %{_libdir}/lib*_drv.la
460 %{_includedir}/%{name}
461 %{_mandir}/man3/libdspam.3*
462 %{_pkgconfigdir}/*.pc
465 %defattr(644,root,root,755)
466 %{_libdir}/libdspam.a
467 %{_libdir}/lib*_drv.a
470 %defattr(644,root,root,755)
471 %attr(755,root,root) %{_bindir}/css*
472 %attr(755,root,root) %{_libdir}/libhash_drv.so.7.0.0
473 %attr(755,root,root) %ghost %{_libdir}/libhash_drv.so.7
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.7.0.0
481 %attr(755,root,root) %ghost %{_libdir}/libmysql_drv.so.7
486 %defattr(644,root,root,755)
487 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
488 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
489 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
490 %attr(755,root,root) %{_libdir}/libpgsql_drv.so.7.0.0
491 %attr(755,root,root) %ghost %{_libdir}/libpgsql_drv.so.7
496 %defattr(644,root,root,755)
497 %doc doc/sqlite_drv.txt
498 %attr(755,root,root) %{_libdir}/libsqlite3_drv.so.7.0.0
499 %attr(755,root,root) %ghost %{_libdir}/libsqlite3_drv.so.7
503 %defattr(644,root,root,755)
504 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
505 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
506 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
507 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
508 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
509 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
510 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
512 %dir %{_datadir}/dspam
513 %dir %{_datadir}/dspam/cgi
514 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
515 %{_datadir}/dspam/cgi/templates
516 %{_datadir}/dspam/htdocs