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