]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- updated to 0.101.3 (solves vulnerability to non-recursive zip bombs)
[packages/clamav.git] / clamav.spec
1 # TODO:
2 # - Make freshclam package (script and daemon)
3 # - restart amavis in triggers if group membership was modified?
4 #
5 # Conditional build:
6 %bcond_without  milter                  # milter interface subpackage
7 %if "%{pld_release}" == "ac"
8 %bcond_with     llvm                    # LLVM support
9 %else
10 %bcond_without  llvm                    # LLVM support
11 %endif
12 %bcond_without  system_libmspack        # system libmspack library
13 %bcond_with     system_llvm             # system LLVM (< 3.7)
14
15 %ifarch x32
16 %undefine with_llvm
17 %endif
18 Summary:        An anti-virus utility for Unix
19 Summary(pl.UTF-8):      Narzędzie antywirusowe dla Uniksów
20 Name:           clamav
21 Version:        0.101.3
22 Release:        1
23 License:        GPL v2+
24 Group:          Daemons
25 #Source0Download: http://www.clamav.net/download
26 Source0:        http://www.clamav.net/downloads/production/%{name}-%{version}.tar.gz
27 # Source0-md5:  1981c5bd299c1f3cbf3f74095a00524c
28 Source1:        %{name}.init
29 Source2:        %{name}.sysconfig
30 Source3:        %{name}-milter.init
31 Source4:        %{name}-cron-updatedb
32 Source5:        %{name}.logrotate
33 Source8:        %{name}-post-updatedb
34 Source9:        %{name}-milter.sysconfig
35 Source10:       %{name}.tmpfiles
36 Source11:       clamd.service
37 Source12:       cronjob-clamav.timer
38 Source13:       cronjob-clamav.service.in
39 Patch0:         %{name}-pld_config.patch
40 Patch1:         %{name}-nolibs.patch
41 %if "%{pld_release}" == "ac"
42 Patch2:         am-nosilentrules.patch
43 %endif
44 Patch3:         ac2.68.patch
45 Patch4:         %{name}-openssl.patch
46 Patch5:         %{name}-major.patch
47 Patch6:         x32.patch
48 Patch7:         %{name}-add-support-for-system-tomsfastmath.patch
49 Patch8:         %{name}-headers.patch
50 URL:            http://www.clamav.net/
51 BuildRequires:  autoconf >= 2.59
52 BuildRequires:  automake >= 1:1.11
53 BuildRequires:  bzip2-devel
54 BuildRequires:  check-devel
55 BuildRequires:  curl-devel
56 BuildRequires:  gmp-devel
57 BuildRequires:  json-c-devel
58 BuildRequires:  libltdl-devel
59 %{?with_milter:BuildRequires:   libmilter-devel}
60 %{?with_system_libmspack:BuildRequires: libmspack-devel}
61 BuildRequires:  libstdc++-devel >= 5:3.4
62 BuildRequires:  libtool
63 %{?with_milter:BuildRequires:   libwrap-devel}
64 BuildRequires:  libxml2-devel >= 2
65 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
66 BuildRequires:  ncurses-devel
67 BuildRequires:  openssl-devel >= 0.9.8
68 BuildRequires:  pcre2-8-devel
69 BuildRequires:  pkgconfig >= 1:0.16
70 BuildRequires:  rpm >= 4.4.9-56
71 BuildRequires:  rpmbuild(macros) >= 1.647
72 BuildRequires:  systemd-devel
73 BuildRequires:  tomsfastmath-devel >= 0.13.1-2
74 BuildRequires:  zlib-devel >= 1.2.2
75 Requires(post,preun):   /sbin/chkconfig
76 Requires(postun):       /usr/sbin/groupdel
77 Requires(postun):       /usr/sbin/userdel
78 Requires(postun,pre):   /usr/sbin/usermod
79 Requires(pre):  /bin/id
80 Requires(pre):  /usr/bin/getgid
81 Requires(pre):  /usr/sbin/groupadd
82 Requires(pre):  /usr/sbin/useradd
83 Requires(post,preun,postun):    systemd-units >= 38
84 Requires:       systemd-units >= 38
85 Requires(triggerpostun):        sed >= 4.0
86 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
87 Requires:       /usr/sbin/usermod
88 Requires:       rc-scripts >= 0.4.1.23
89 Suggests:       clamav-database
90 Suggests:       cronjobs
91 Provides:       group(clamav)
92 Provides:       user(clamav)
93 Conflicts:      logrotate < 3.7-4
94 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
95
96 %description
97 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
98 especially for e-mail scanning on mail gateways. It provides a number
99 of utilities including a flexible and scalable multi-threaded daemon,
100 a command line scanner and advanced tool for automatic database
101 updates. The core of the package is an anti-virus engine available in
102 a form of shared library (available in clamav-libs).
103
104 Here is a list of the main features:
105 - command-line scanner
106 - fast, multi-threaded daemon with support for on-access scanning
107 - milter interface for sendmail
108 - advanced database updater with support for scripted updates and
109   digital signatures
110 - virus scanner C library
111 - on-access scanning (Linux and FreeBSD)
112 - virus database updated multiple times per day (see home page for
113   total number of signatures)
114 - built-in support for various archive formats, including Zip, RAR,
115   Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
116 - built-in support for almost all mail file formats
117 - built-in support for ELF executables and Portable Executable files
118   compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
119   obfuscated with SUE, Y0da Cryptor and others
120 - built-in support for popular document formats including MS Office
121   and MacOffice files, HTML, RTF and PDF
122
123 %description -l pl.UTF-8
124 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
125 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
126 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
127 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
128 skaner działający z linii poleceń oraz zaawansowane narzędzie do
129 automatycznej aktualizacji bazy danych. Główna część pakietu to
130 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
131 (dostępnej w pakiecie clamav-libs).
132
133 Lista podstawowych możliwości:
134 - skaner działający z linii poleceń
135 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
136 - interfejs milter dla sendmaila
137 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
138   aktualizacji oskryptowanych oraz podpisów cyfrowych
139 - biblioteka C skanera antywirusowego
140 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
141 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
142   sygnatur dostępna na stronie projektu)
143 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
144   Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
145 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
146 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
147   programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
148   zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
149 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
150   Office, MacOffice, HTML, RTF i PDF
151
152 %package libs
153 Summary:        Shared libraries for clamav
154 Summary(pl.UTF-8):      Biblioteki dzielone clamav
155 Group:          Libraries
156 Requires:       zlib >= 1.2.2
157
158 %description libs
159 Shared libraries for clamav.
160
161 %description libs -l pl.UTF-8
162 Biblioteki dzielone clamav.
163
164 %package milter
165 Summary:        ClamAV filter using milter interface
166 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
167 Group:          Daemons
168 Requires:       %{name} = %{epoch}:%{version}-%{release}
169 Requires:       postfix
170 #Requires:      sendmail >= 8.11
171 Requires:       tcp_wrappers
172
173 %description milter
174 ClamAV sendmail filter using MILTER interface.
175
176 %description milter -l pl.UTF-8
177 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
178
179 %package devel
180 Summary:        clamav - Development header files and libraries
181 Summary(pl.UTF-8):      clamav - Pliki nagłówkowe i biblioteki dla programistów
182 Group:          Development/Libraries
183 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
184 Requires:       bzip2-devel
185 Requires:       curl-devel
186 Requires:       gmp-devel
187 Requires:       openssl-devel >= 0.9.8
188 Requires:       zlib-devel >= 1.2.2
189
190 %description devel
191 This package contains the development header files and libraries
192 necessary to develop clamav client applications.
193
194 %description devel -l pl.UTF-8
195 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
196 klienckich clamav.
197
198 %package static
199 Summary:        clamav static libraries
200 Summary(pl.UTF-8):      Biblioteki statyczne clamav
201 Group:          Development/Libraries
202 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
203
204 %description static
205 clamav static libraries.
206
207 %description static -l pl.UTF-8
208 Biblioteki statyczne clamav.
209
210 %prep
211 %setup -q
212 %patch0 -p1
213 %patch1 -p1
214 %if "%{pld_release}" == "ac"
215 %patch2 -p1
216 %endif
217 %if "%{pld_release}" != "ac"
218 %patch3 -p1
219 %endif
220 #%patch4 -p1
221 %patch5 -p1
222 %patch6 -p1
223 %patch7 -p1
224 %patch8 -p1
225
226 %build
227 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
228 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
229 %{__libtoolize}
230 %{__aclocal} -I m4
231 %{__autoconf}
232 %{__autoheader}
233 %{__automake}
234 %configure \
235         --disable-clamav \
236         --enable-clamdtop \
237         %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
238         %{?with_milter:--enable-milter} \
239         --disable-silent-rules \
240         --disable-zlib-vcheck \
241         --with-dbdir=/var/lib/%{name} \
242         --with-ltdl-include=%{_includedir} \
243         --with-ltdl-lib=%{_libdir} \
244         --with-no-cache \
245         %{?with_system_libmspack:--with-system-libmspack}
246
247 %{__make} \
248         LIBTOOL=%{_bindir}/libtool
249
250 %install
251 rm -rf $RPM_BUILD_ROOT
252 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
253         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
254         $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
255         $RPM_BUILD_ROOT%{systemdunitdir}
256
257 %{__make} install \
258         LIBTOOL=%{_bindir}/libtool \
259         DESTDIR=$RPM_BUILD_ROOT
260 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
261
262 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
263 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
264 EOF
265
266 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
267 %if %{with milter}
268 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
269 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
270 %endif
271 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
272 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
273 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
274         mv $i ${i%%.sample}
275 done
276 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
277
278 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
279
280 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
281
282 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
283 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
284 sed -e's#@sbindir@#%{_sbindir}#' <  %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
285
286 # NOTE: clamd uses sane rights to it's clamd.pid file
287 # So better keep it dir
288 # If it is fixed use of dir will be unecesary
289 install -d $RPM_BUILD_ROOT/var/run/%{name}
290
291 :> $RPM_BUILD_ROOT/var/log/freshclam.log
292
293 %clean
294 rm -rf $RPM_BUILD_ROOT
295
296 %triggerin -- amavis-ng
297 %addusertogroup -q clamav amavis
298
299 %triggerin -- amavisd-new
300 %addusertogroup -q clamav amavis
301
302 %triggerin -- amavisd
303 %addusertogroup -q clamav amavis
304
305 %pre
306 %groupadd -g 43 clamav
307 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
308
309 %post
310 /sbin/chkconfig --add clamd
311 %service clamd restart "Clam Antivirus daemon"
312 touch /var/log/freshclam.log
313 chown clamav:root /var/log/freshclam.log
314 chmod 640 /var/log/freshclam.log
315 %systemd_post clamd.service cronjob-clamav.timer
316
317 %preun
318 if [ "$1" = "0" ]; then
319         %service clamd stop
320         /sbin/chkconfig --del clamd
321 fi
322 %systemd_preun clamd.service cronjob-clamav.timer
323
324 %postun
325 if [ "$1" = "0" ]; then
326         %userremove clamav
327         %groupremove clamav
328 fi
329 %systemd_reload
330
331 %triggerpostun -- %{name} < 0.80
332 if [ -f /etc/clamav.conf.rpmsave ]; then
333         echo "Renaming config to new name /etc/clamd.conf"
334         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
335         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
336         echo "Changing config location in freshclam config"
337         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
338 fi
339
340 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
341 %{__cp} -f /etc/clamd.conf{,.rpmsave}
342 %{__sed} -i -e '
343                 s,^LogSyslog$,& yes,
344                 s,^FixStaleSocket$,& yes,
345                 s,^AllowSupplementaryGroups$,& yes,
346                 s,^ClamukoScanOnOpen$,& yes,
347                 s,^ClamukoScanOnClose$,& yes,
348                 s,^ClamukoScanOnExec$,& yes,
349                 s,^LogTime$,& yes,
350                 s,^ScanPE$,& yes,
351 ' /etc/clamd.conf
352 %banner -e %{name}-0.90 <<EOF
353 ClamAV config was automatically upgraded to 0.90 format. You should review it
354 that it's still valid.
355 EOF
356 #'
357 # unfortunately clamd has no configcheck option so we just have to start it
358 # once again after config was broken after upgrade
359 touch /var/lock/subsys/clamd
360 %service -q clamd restart
361
362 %triggerpostun -- %{name} < 0.97.7-4
363 %systemd_trigger clamd.service
364
365 %triggerpostun -- %{name} < 0.99.2-2
366 %systemd_service_enable cronjob-clamav.timer
367
368 %post milter
369 /sbin/chkconfig --add clamav-milter
370 %service clamav-milter restart "Clam Antivirus daemon"
371
372 %preun milter
373 if [ "$1" = "0" ]; then
374         %service clamav-milter stop
375         /sbin/chkconfig --del clamav-milter
376 fi
377
378 %post   libs -p /sbin/ldconfig
379 %postun libs -p /sbin/ldconfig
380
381 %files
382 %defattr(644,root,root,755)
383 %doc ChangeLog.md NEWS.md README.md
384 %attr(755,root,root) %{_bindir}/clambc
385 %attr(755,root,root) %{_bindir}/clamdscan
386 %attr(755,root,root) %{_bindir}/clamdtop
387 %attr(755,root,root) %{_bindir}/clamscan
388 %attr(755,root,root) %{_bindir}/clamsubmit
389 %attr(755,root,root) %{_bindir}/freshclam
390 %attr(755,root,root) %{_bindir}/sigtool
391 %attr(755,root,root) %{_bindir}/clamconf
392 %attr(755,root,root) %{_sbindir}/clamd
393 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
394 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
395 %{systemdtmpfilesdir}/%{name}.conf
396 %{systemdunitdir}/clamav-daemon.service
397 %{systemdunitdir}/clamav-daemon.socket
398 %{systemdunitdir}/clamav-freshclam.service
399 %{systemdunitdir}/clamd.service
400 %{systemdunitdir}/cronjob-clamav.service
401 %{systemdunitdir}/cronjob-clamav.timer
402 %attr(755,clamav,root) %dir /var/lib/%{name}
403 %attr(640,clamav,root) %ghost /var/log/freshclam.log
404 %attr(750,clamav,clamav) %dir /var/run/%{name}
405
406 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
407 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
408 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
409
410 %attr(754,root,root) /etc/rc.d/init.d/clamd
411 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
412 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
413 %{_mandir}/man1/*
414 %{_mandir}/man5/clamd*
415 %{_mandir}/man5/freshclam*
416 %{_mandir}/man8/clamd*
417
418 %if %{with milter}
419 %files milter
420 %defattr(644,root,root,755)
421 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
422 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
423 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
424 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
425 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
426 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
427 %attr(755,root,root) %{_sbindir}/clamav-milter
428 %{_mandir}/man5/clamav-milter*
429 %{_mandir}/man8/clamav-milter.8*
430 %attr(700,clamav,clamav) /var/spool/clamav
431 %endif
432
433 %files libs
434 %defattr(644,root,root,755)
435 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
436 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
437 %if %{without system_libmspack}
438 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
439 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
440 %endif
441 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
442 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
443 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
444 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
445
446 %files devel
447 %defattr(644,root,root,755)
448 %attr(755,root,root) %{_bindir}/clamav-config
449 %attr(755,root,root) %{_libdir}/libclamav.so
450 %if %{without system_libmspack}
451 %attr(755,root,root) %{_libdir}/libclammspack.so
452 %endif
453 %attr(755,root,root) %{_libdir}/libclamunrar.so
454 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
455 %{_libdir}/libclamav.la
456 %if %{without system_libmspack}
457 %{_libdir}/libclammspack.la
458 %endif
459 %{_libdir}/libclamunrar.la
460 %{_libdir}/libclamunrar_iface.la
461 %dir %{_includedir}/clamav
462 %{_includedir}/clamav/clamav.h
463 %{_includedir}/clamav/clamav-types.h
464 %{_pkgconfigdir}/libclamav.pc
465
466 %files static
467 %defattr(644,root,root,755)
468 %{_libdir}/libclamav.a
469 %if %{without system_libmspack}
470 %{_libdir}/libclammspack.a
471 %endif
472 %{_libdir}/libclamunrar.a
473 %{_libdir}/libclamunrar_iface.a
This page took 0.078039 seconds and 3 git commands to generate.