]> git.pld-linux.org Git - packages/dspam.git/blob - dspam.spec
- config dspam server by default listen only local socket
[packages/dspam.git] / dspam.spec
1 # TODO:
2 # - support for libdclassify
3 # - oracle driver
4 # - messages from default install of cron with mysql driver Memory fault
5 # - installing dspam and dspam-client on same host causes
6 #   /etc/dspam.conf being owned by both packages and .rpmnew files being
7 #   created. move the config to -libs? -common? patch code to use
8 #   different config for client?
9 #
10 # Conditional build:
11 %bcond_without  mysql   # disable MySQL storage driver
12 %bcond_without  pgsql   # disable PostgreSQL storage driver
13 %bcond_without  sqlite  # disable SQLite3 storage driver
14 %bcond_without  db      # disable BerkeleyDB storage driver
15 %bcond_with     mysql40 # use with mysql 4.0
16 #
17 %include        /usr/lib/rpm/macros.perl
18 Summary:        A library and Mail Delivery Agent for Bayesian spam filtering
19 Summary(pl):    Biblioteka i MDA do bayesowskiego filtrowania spamu
20 Name:           dspam
21 Version:        3.6.5
22 Release:        0.24
23 License:        GPL
24 Group:          Applications/Mail
25 Source0:        http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
26 # Source0-md5:  da4f0e00633bff49d71fde418caaf14b
27 Patch0:         %{name}-webui.patch
28 Patch1:         %{name}-config.patch
29 Source1:        %{name}.init
30 Source2:        %{name}-apache.conf
31 URL:            http://www.nuclearelephant.com/projects/dspam/
32 BuildRequires:  autoconf
33 BuildRequires:  automake
34 BuildRequires:  clamav-devel
35 %{?with_db:BuildRequires:       db-devel}
36 BuildRequires:  libtool
37 %{?with_mysql:BuildRequires:    mysql-devel}
38 BuildRequires:  openldap-devel
39 %{?with_pgsql:BuildRequires:    postgresql-devel}
40 BuildRequires:  rpm-perlprov >= 4.1-13
41 BuildRequires:  rpmbuild(macros) >= 1.268
42 BuildRequires:  sed >= 4.0
43 %{?with_sqlite:BuildRequires:   sqlite3-devel}
44 BuildRequires:  zlib-devel
45 Requires(post,preun):   /sbin/chkconfig
46 Requires:       rc-scripts
47 Buildroot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48
49 %define         _webapps        /etc/webapps
50 %define         _webapp         %{name}
51
52 %description
53 DSPAM (as in De-Spam) is an open-source project to create a new kind
54 of anti-spam mechanism, and is currently effective as both a
55 server-side agent for UNIX email servers and a developer's library for
56 mail clients, other anti-spam tools, and similar projects requiring
57 drop-in spam filtering.
58
59 The DSPAM agent masquerades as the email server's local delivery agent
60 and filters/learns spams using an advanced Bayesian statistical
61 approach (based on Bayes's theorem of combined probabilities) which
62 provides an administratively maintenance-free, easy-learning Anti-Spam
63 service custom tailored to each individual user's behavior. Advanced
64 because on top of standard Bayesian filtering is also incorporated the
65 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
66 works great with Sendmail and Exim, and should work well with any
67 other MTA that supports an external local delivery agent (postfix,
68 qmail, etc.)
69
70 %description -l pl
71 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
72 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
73 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
74 uniksowych serwerów pocztowych jak i biblioteka dla programistów
75 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
76 wymagaj±cych filtrowania spamu w locie.
77
78 Agent DSPAM zachowuje siê jak lokalny agent dostarczania poczty (MDA)
79 i filtruje/uczy siê spamu przy u¿yciu zaawansowanego bayesowskiego
80 przybli¿enia statystycznego (opartego na twierdzeniu Bayesa o
81 po³±czonych prawdopodobieñstwach), daj±c nie wymagaj±c± obs³ugi
82 administracyjnej, ³atwo ucz±c± siê us³ugê antyspamow± dostosowan± do
83 zachowania ka¿dego u¿ytkownika. Metoda jest zaawansowana poniewa¿ na
84 podstawie standardowego filtrowania bayesowskiego wprowadzono u¿ycie
85 tokenów ³añcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
86 DSPAM dzia³a wspaniale z Sendmailem i Eximem, powinien dzia³aæ dobrze
87 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
88 qmailem itd.).
89
90 %package client
91 Summary:        dspam client
92 Summary(pl):    Klient dspam
93 Group:          Applications/Mail
94 # to get the same dspam.conf when both installed
95 Conflicts:      dspam < %{version}-%{release}
96 Conflicts:      dspam > %{version}-%{release}
97
98 %description client
99 dspam client.
100
101 %description client -l pl
102 Klient dspam.
103
104 %package libs
105 Summary:        A library for Bayesian spam filtering
106 Summary(pl):    Biblioteka do bayesowskiego filtrowania spamu
107 Group:          Libraries
108 Requires:       %{name}-driver = %{version}-%{release}
109
110 %description libs
111 DSPAM (as in De-Spam) is an open-source project to create a new kind
112 of anti-spam mechanism, and is currently effective as both a
113 server-side agent for UNIX email servers and a developer's library for
114 mail clients, other anti-spam tools, and similar projects requiring
115 drop-in spam filtering.
116
117 This package contains the library.
118
119 %description libs -l pl
120 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
121 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
122 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
123 uniksowych serwerów pocztowych jak i biblioteka dla programistów
124 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
125 wymagaj±cych filtrowania spamu w locie.
126
127 Ten pakiet zawiera wspomnian± bibliotekê.
128
129 %package devel
130 Summary:        Header files for the DSPAM library
131 Summary(pl):    Pliki nag³ówkowe biblioteki DSPAM
132 Group:          Development/Libraries
133 Requires:       %{name}-libs = %{version}-%{release}
134
135 %description devel
136 DSPAM has had its core engine moved into a separate library, libdspam.
137 This library can be used by developers to provide 'drop-in' spam
138 filtering for their mail client applications, other anti-spam tools,
139 or similar projects.
140
141 %description devel -l pl
142 G³ówny silnik DSPAM zosta³ przeniesiony do oddzielnej biblioteki
143 libdspam, która mo¿e byæ u¿ywana przez programistów do zapewnienia
144 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
145 narzêdzi antyspamowych i podobnych projektów.
146
147 %package static
148 Summary:        Static DSPAM library
149 Summary(pl):    Statyczna biblioteka DSPAM
150 Group:          Development/Libraries
151 Requires:       %{name}-devel = %{version}-%{release}
152
153 %description static
154 Static DSPAM library.
155
156 %description static -l pl
157 Statyczna biblioteka DSPAM.
158
159 %package driver-hash
160 Summary:        HASH driver for DSPAM
161 Summary(pl):    Sterownik HASH dla DSPAM-a
162 Group:          Libraries
163 Requires(post): sed >= 4.0
164 Requires:       %{name}-libs = %{version}-%{release}
165 Provides:       %{name}-driver = %{version}-%{release}
166
167 %description driver-hash
168 HASH driver for DSPAM.
169
170 %description driver-hash -l pl
171 Sterownik HASH dla DSPAM-a.
172
173 %package driver-db
174 Summary:        DB driver for DSPAM
175 Summary(pl):    Sterownik DB dla DSPAM-a
176 Group:          Libraries
177 Requires(post): sed >= 4.0
178 Requires:       %{name}-libs = %{version}-%{release}
179 Provides:       %{name}-driver = %{version}-%{release}
180
181 %description driver-db
182 DB driver for DSPAM.
183
184 %description driver-db -l pl
185 Sterownik DB dla DSPAM-a.
186
187 %package driver-mysql
188 Summary:        MySQL driver for DSPAM
189 Summary(pl):    Sterownik MySQL dla DSPAM-a
190 Group:          Libraries
191 Requires(post): sed >= 4.0
192 Requires:       %{name}-libs = %{version}-%{release}
193 Provides:       %{name}-driver = %{version}-%{release}
194
195 %description driver-mysql
196 MySQL driver for DSPAM.
197
198 %description driver-mysql -l pl
199 Sterownik MySQL dla DSPAM-a.
200
201 %package driver-pgsql
202 Summary:        PostgreSQL driver for DSPAM
203 Summary(pl):    Sterownik PostgreSQL dla DSPAM-a
204 Group:          Libraries
205 Requires(post): sed >= 4.0
206 Requires:       %{name}-libs = %{version}-%{release}
207 Provides:       %{name}-driver = %{version}-%{release}
208
209 %description driver-pgsql
210 PostgreSQL driver for DSPAM.
211
212 %description driver-pgsql -l pl
213 Sterownik PostgreSQL dla DSPAM-a.
214
215 %package driver-sqlite
216 Summary:        SQLite driver for DSPAM
217 Summary(pl):    Sterownik SQLite dla DSPAM-a
218 Group:          Libraries
219 Requires(post): sed >= 4.0
220 Requires:       %{name}-libs = %{version}-%{release}
221 Provides:       %{name}-driver = %{version}-%{release}
222
223 %description driver-sqlite
224 SQLite driver for DSPAM.
225
226 %description driver-sqlite -l pl
227 Sterownik SQLite dla DSPAM-a.
228
229 %package webui
230 Summary:        DSPAM Web UI
231 Group:          Applications/WWW
232 Requires:       webapps
233 # needs dspam binary
234 Requires:       %{name} = %{version}-%{release}
235
236 %description webui
237 The Web UI (CGI client) can be run from any executable location on a
238 web server, and detects its user's identity from the REMOTE_USER
239 environment variable. This means you'll need to use HTTP password
240 authentication to access the CGI (Any type of authentication will
241 work, so long as Apache supports the module). This is also convenient
242 in that you can set up authentication using almost any existing system
243 you have. The only catch is that you'll need the usernames to match
244 the actual DSPAM usernames used the system. A copy of the shadow
245 password file will suffice for most common installs.
246
247 %prep
248 %setup -q
249 %patch0 -p1
250 %patch1 -p1
251 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
252 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
253
254 %build
255 %{__libtoolize}
256 %{__aclocal} -I m4
257 %{__autoconf}
258 %{__automake}
259
260 DRIVERS="
261 hash_drv
262 %{?with_db:libdb4_drv}
263 %{?with_mysql:mysql_drv}
264 %{?with_pgsql:pgsql_drv}
265 %{?with_sqlite:sqlite_drv}
266 "
267 %configure \
268         --disable-dependency-tracking \
269         %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
270         --enable-trusted-user-security \
271         --enable-bias \
272         --enable-large-scale \
273         --with-userdir=/var/lib/%{name} \
274         --with-userdir-owner=none \
275         --with-userdir-group=none \
276         --with-dspam-home=/var/lib/%{name} \
277         --with-dspam-home-owner=none \
278         --with-dspam-home-group=none \
279         --with-dspam-owner=none \
280         --with-dspam-group=none \
281         --with-signature-life=14 \
282         --enable-ldap \
283         --enable-clamav \
284         --enable-preferences-extension \
285         --enable-long-usernames \
286         --enable-neural-networking \
287         --enable-virtual-users \
288         --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
289 %if %{with mysql}
290         --with-mysql-includes=%{_includedir}/mysql \
291         --with-mysql-libraries=%{_libdir} \
292 %endif
293 %if %{with pgsql}
294         --with-pgsql-includes=%{_includedir}/postgresql \
295         --with-pgsql-libraries=%{_libdir} \
296 %endif
297 %if %{with sqlite}
298         --with-sqlite3-includes=%{_includedir} \
299         --with-sqlite3-libraries=%{_libdir} \
300 %endif
301         --enable-daemon
302
303 # --enable-dclassify-extension needs libdclassify
304
305 %{__make}
306
307 %install
308 rm -rf $RPM_BUILD_ROOT
309 install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}}
310
311 %{__make} install \
312         DESTDIR=$RPM_BUILD_ROOT
313
314 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
315
316 ln -s /var/log/dspam $RPM_BUILD_ROOT/var/lib/%{name}/log
317
318 # install devel files
319 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
320 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
321
322 # provide maintenance scripts
323 install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
324 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
325 #!/bin/sh
326 exec %{_bindir}/%{name}_clean -s -p
327 EOF
328
329 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
330
331 # fix prefix
332 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
333
334 # fix purge stuff
335 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
336
337 %if %{with mysql}
338 # fix missing file
339 install -d $RPM_BUILD_ROOT/var/lib/%{name}
340 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
341 _UNCONFIGURED_
342
343 Note!
344
345 This file can only contain 5 lines with the following values:
346
347 HOSTNAME
348 PORT
349 USERNAME
350 PASSWORD
351 DATABASE
352 EOF
353 %endif
354
355 %if %{with pgsql}
356 # fix missing file
357 install -d $RPM_BUILD_ROOT/var/lib/%{name}
358 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
359 _UNCONFIGURED_
360
361 Note!
362
363 This file can only contain 5 lines with the following values:
364
365 HOSTNAME
366 PORT
367 USERNAME
368 PASSWORD
369 DATABASE
370 EOF
371 %endif
372
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
377
378 %post
379 /sbin/chkconfig --add dspam
380 %service dspam restart "dspam daemon"
381
382 %preun
383 if [ "$1" = "0" ]; then
384         %service dspam stop
385         /sbin/chkconfig --del dspam
386 fi
387
388 %clean
389 rm -rf $RPM_BUILD_ROOT
390
391 %post   libs -p /sbin/ldconfig
392 %postun libs -p /sbin/ldconfig
393
394 %post driver-db
395 if [ "$1" = "1" ]; then
396         sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
397 fi
398
399 %post driver-hash
400 if [ "$1" = "1" ]; then
401         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
402 fi
403
404 %post driver-mysql
405 if [ "$1" = "1" ]; then
406         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
407 fi
408
409 %post driver-pgsql
410 if [ "$1" = "1" ]; then
411         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
412 fi
413
414 %post driver-sqlite
415 if [ "$1" = "1" ]; then
416         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
417 fi
418
419 %triggerin webui -- apache1
420 %webapp_register apache %{_webapp}
421
422 %triggerun webui -- apache1
423 %webapp_unregister apache %{_webapp}
424
425 %triggerin webui -- apache < 2.2.0, apache-base
426 %webapp_register httpd %{_webapp}
427
428 %triggerun webui -- apache < 2.2.0, apache-base
429 %webapp_unregister httpd %{_webapp}
430
431 %files
432 %defattr(644,root,root,755)
433 %doc README CHANGELOG RELEASE.NOTES UPGRADING
434 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
435 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
436 %dir %attr(775,root,mail) /var/run/dspam
437 %dir %attr(770,root,mail) /var/lib/%{name}
438 %dir %attr(770,root,mail) /var/log/dspam
439 %attr(754,root,root) /etc/rc.d/init.d/dspam
440 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
441 %attr(755,root,root) %{_bindir}/%{name}
442 %attr(755,root,root) %{_bindir}/%{name}_logrotate
443 %attr(755,root,root) %{_bindir}/%{name}_clean
444 %attr(755,root,root) %{_bindir}/%{name}_corpus
445 %attr(755,root,root) %{_bindir}/%{name}_crc
446 %attr(755,root,root) %{_bindir}/%{name}_dump
447 %attr(755,root,root) %{_bindir}/%{name}_genaliases
448 %attr(755,root,root) %{_bindir}/%{name}_stats
449 %attr(755,root,root) %{_bindir}/%{name}_merge
450 %attr(755,root,root) %{_bindir}/%{name}_2sql
451 %attr(755,root,root) %{_bindir}/%{name}_admin
452 %attr(755,root,root) %{_bindir}/%{name}_train
453 %{_mandir}/man?/%{name}*
454
455 %files client
456 %defattr(644,root,root,755)
457 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
458 %attr(755,root,root) %{_bindir}/%{name}c
459
460 %files libs
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*
465
466 %files devel
467 %defattr(644,root,root,755)
468 %attr(755,root,root) %{_libdir}/lib*.so
469 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
470 %{_libdir}/lib*.la
471 %{_includedir}/%{name}
472 %{_mandir}/man3/libdspam*
473 %{_pkgconfigdir}/*.pc
474
475 %files static
476 %defattr(644,root,root,755)
477 %{_libdir}/lib*.a
478
479 %files driver-hash
480 %defattr(644,root,root,755)
481 %attr(755,root,root) %{_bindir}/css*
482 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
483
484 %if %{with db}
485 %files driver-db
486 %defattr(644,root,root,755)
487 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
488 %endif
489
490 %if %{with mysql}
491 %files driver-mysql
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*
496 %endif
497
498 %if %{with pgsql}
499 %files driver-pgsql
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*
505 %endif
506
507 %if %{with sqlite}
508 %files driver-sqlite
509 %defattr(644,root,root,755)
510 %doc doc/sqlite_drv.txt
511 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
512 %endif
513
514 %files webui
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
523
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
This page took 0.070366 seconds and 4 git commands to generate.