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 Group: Applications/Mail
92 Requires: %{name}-common
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-sqlite3
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}
215 Obsoletes: dspam-driver-sqlite
217 %description driver-sqlite3
218 SQLite driver for DSPAM.
220 %description driver-sqlite3 -l pl.UTF-8
221 Sterownik SQLite dla DSPAM-a.
224 Summary: DSPAM Web UI
225 Summary(pl.UTF-8): Interfejs WWW do programu DSPAM
226 Group: Applications/WWW
229 Requires: %{name} = %{version}-%{release}
232 The Web UI (CGI client) can be run from any executable location on a
233 web server, and detects its user's identity from the REMOTE_USER
234 environment variable. This means you'll need to use HTTP password
235 authentication to access the CGI (Any type of authentication will
236 work, so long as Apache supports the module). This is also convenient
237 in that you can set up authentication using almost any existing system
238 you have. The only catch is that you'll need the usernames to match
239 the actual DSPAM usernames used the system. A copy of the shadow
240 password file will suffice for most common installs.
242 %description webui -l pl.UTF-8
243 Interfejs użytkownika WWW (klient CGI) może być uruchamiany z
244 dowolnego wykonywalnego miejsca na serwerze WWW i rozpoznaje tożsamość
245 użytkownika ze zmiennej środowiskowej REMOTE_USER. Oznacza to, że
246 trzeba użyć uwietrzytelnienia HTTP z hasłem do dostępu do CGI (działać
247 będzie dowolny rodzaj uwierzytelnienia obsługiwany przez moduły
248 Apache'a). Jest to o tyle wygodne, że można skonfigurować
249 uwierzytelnianie dla prawie każdego istniejącego systemu. Jedynym
250 wymogiem jest, żeby nazwy użytkowników pokrywały się z nazwami
251 użytkowników DSPAM-a używanymi w systemie. Kopia pliku shadow
252 wystarczy dla większości popularnych instalacji.
260 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
261 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
262 sed -i -e 's,/usr/local/dspam/bin,/usr/bin,' ./scripts/train.pl
272 %{?with_mysql:mysql_drv}
273 %{?with_pgsql:pgsql_drv}
274 %{?with_sqlite:sqlite3_drv}
277 --disable-dependency-tracking \
278 %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
279 --enable-trusted-user-security \
280 --enable-large-scale \
281 --with-dspam-home=/var/lib/%{name} \
282 --with-dspam-home-owner=none \
283 --with-dspam-home-group=none \
284 --with-dspam-owner=none \
285 --with-dspam-group=none \
288 --enable-preferences-extension \
289 --enable-long-usernames \
290 --enable-virtual-users \
291 --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
293 --with-mysql-includes=%{_includedir}/mysql \
294 --with-mysql-libraries=%{_libdir} \
297 --with-pgsql-includes=%{_includedir}/postgresql \
298 --with-pgsql-libraries=%{_libdir} \
302 --with-sqlite-includes=%{_includedir} \
303 --with-sqlite-libraries=%{_libdir} \
308 # --enable-dclassify-extension needs libdclassify
313 rm -rf $RPM_BUILD_ROOT
314 install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}} \
315 $RPM_BUILD_ROOT/var/lib/%{name}/{txt,data}
318 DESTDIR=$RPM_BUILD_ROOT
320 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
322 cp -a txt/*.txt $RPM_BUILD_ROOT/var/lib/%{name}/txt
324 # install devel files
325 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
326 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
328 # provide maintenance scripts
329 install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
330 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
332 exec %{_bindir}/%{name}_clean -s -p
335 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
338 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
341 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
346 This file can only contain 5 lines with the following values:
357 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
362 This file can only contain 5 lines with the following values:
372 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
373 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
374 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
375 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
378 /sbin/chkconfig --add dspam
379 %service dspam restart "dspam daemon"
382 if [ "$1" = "0" ]; then
384 /sbin/chkconfig --del dspam
388 rm -rf $RPM_BUILD_ROOT
390 %post libs -p /sbin/ldconfig
391 %postun libs -p /sbin/ldconfig
394 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
397 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
400 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
403 %{__sed} -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite3_drv.so,' /etc/dspam.conf
405 %triggerin webui -- apache1 < 1.3.37-3, apache1-base
406 %webapp_register apache %{_webapp}
408 %triggerun webui -- apache1 < 1.3.37-3, apache1-base
409 %webapp_unregister apache %{_webapp}
411 %triggerin webui -- apache < 2.2.0, apache-base
412 %webapp_register httpd %{_webapp}
414 %triggerun webui -- apache < 2.2.0, apache-base
415 %webapp_unregister httpd %{_webapp}
418 %defattr(644,root,root,755)
419 %doc README CHANGELOG RELEASE.NOTES UPGRADING
420 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
421 %doc scripts/train.pl
422 %dir %attr(775,root,mail) /var/run/dspam
423 %dir %attr(750,root,mail) /var/lib/%{name}
424 %dir %attr(770,root,mail) /var/lib/%{name}/data
425 %dir /var/lib/%{name}/txt
426 %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/txt/*.txt
427 %dir %attr(770,root,mail) /var/log/dspam
428 %attr(754,root,root) /etc/rc.d/init.d/dspam
429 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
430 %attr(755,root,root) %{_bindir}/%{name}
431 %attr(755,root,root) %{_bindir}/%{name}_logrotate
432 %attr(755,root,root) %{_bindir}/%{name}_clean
433 %attr(755,root,root) %{_bindir}/%{name}_crc
434 %attr(755,root,root) %{_bindir}/%{name}_dump
435 %attr(755,root,root) %{_bindir}/%{name}_stats
436 %attr(755,root,root) %{_bindir}/%{name}_merge
437 %attr(755,root,root) %{_bindir}/%{name}_2sql
438 %attr(755,root,root) %{_bindir}/%{name}_admin
439 %attr(755,root,root) %{_bindir}/%{name}_train
440 %{_mandir}/man?/%{name}*
443 %defattr(644,root,root,755)
444 %attr(755,root,root) %{_bindir}/%{name}c
447 %defattr(644,root,root,755)
448 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
451 %defattr(644,root,root,755)
452 %attr(755,root,root) %{_libdir}/libdspam.so.7.0.0
453 %attr(755,root,root) %ghost %{_libdir}/libdspam.so.7
456 %defattr(644,root,root,755)
457 %attr(755,root,root) %{_libdir}/libdspam.so
458 %attr(755,root,root) %{_libdir}/lib*_drv.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
478 %defattr(644,root,root,755)
479 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
480 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
481 %attr(755,root,root) %{_libdir}/libmysql_drv.so.7.0.0
482 %attr(755,root,root) %ghost %{_libdir}/libmysql_drv.so.7
487 %defattr(644,root,root,755)
488 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
489 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
490 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
491 %attr(755,root,root) %{_libdir}/libpgsql_drv.so.7.0.0
492 %attr(755,root,root) %ghost %{_libdir}/libpgsql_drv.so.7
496 %files driver-sqlite3
497 %defattr(644,root,root,755)
498 %doc doc/sqlite_drv.txt
499 %attr(755,root,root) %{_libdir}/libsqlite3_drv.so.7.0.0
500 %attr(755,root,root) %ghost %{_libdir}/libsqlite3_drv.so.7
504 %defattr(644,root,root,755)
505 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
506 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
507 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
508 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
509 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
510 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
511 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
513 %dir %{_datadir}/dspam
514 %dir %{_datadir}/dspam/cgi
515 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
516 %{_datadir}/dspam/cgi/templates
517 %{_datadir}/dspam/htdocs