1 |
# $Id: smeserver-clamav.spec,v 1.3 2019/10/25 03:14:56 jpp Exp $ |
# $Id: smeserver-clamav.spec,v 1.5 2020/12/16 17:06:02 jcrisp Exp $ |
2 |
|
|
3 |
Summary: SME Server module to configure clamav |
Summary: SME Server module to configure clamav |
4 |
%define name smeserver-clamav |
%define name smeserver-clamav |
5 |
Name: %{name} |
Name: %{name} |
6 |
%define version 2.6.0 |
%define version 2.7.0 |
7 |
%define release 4 |
%define release 2 |
8 |
Version: %{version} |
Version: %{version} |
9 |
Release: %{release}%{?dist} |
Release: %{release}%{?dist} |
10 |
License: GPL |
License: GPL |
11 |
Group: System Environment/Base |
Group: System Environment/Base |
12 |
Source: %{name}-%{version}.tar.xz |
Source: %{name}-%{version}.tar.xz |
13 |
Patch0: smeserver-clamav-2.6.0-bz10813-AllowSupplementaryGroups.patch |
Patch0: smeserver-clamav-2.7.0-bz11103-improvements.patch |
14 |
Patch1: smeserver-clamav-2.6.0-bz10833-lowerMEMLIMITto1g.patch |
|
15 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
16 |
BuildArchitectures: noarch |
BuildArchitectures: noarch |
17 |
Requires: e-smith-lib |
Requires: e-smith-lib |
18 |
Requires: e-smith-base |
Requires: e-smith-base >= 5.8.0-63 |
19 |
Requires: clamav >= 0.94 |
Requires: clamav >= 0.103 |
20 |
Requires: clamd >= 0.94 |
Requires: clamd >= 0.103 |
21 |
Requires: clamav-db |
Requires: clamav-data |
22 |
|
Requires: clamav-update |
23 |
Requires: e-smith-formmagick >= 1.4.0-12 |
Requires: e-smith-formmagick >= 1.4.0-12 |
24 |
|
Requires: smeserver-spamassassin >= 2.7.0 |
25 |
Provides: e-smith-clamav |
Provides: e-smith-clamav |
26 |
Obsoletes: e-smith-clamav |
Obsoletes: e-smith-clamav |
27 |
Obsoletes: e-smith-antivirus |
Obsoletes: e-smith-antivirus |
33 |
SME Server enhancement to configure and run clamd and freshclam |
SME Server enhancement to configure and run clamd and freshclam |
34 |
|
|
35 |
%changelog |
%changelog |
36 |
|
* Sat Jan 02 2021 Jean-Philipe Pialasse <tests@pialasse.com> 2.7.0-2.sme |
37 |
|
- add pid folder /run/clamd/ [SME: 11103] |
38 |
|
few improvements |
39 |
|
- create update event [SME: 11162] |
40 |
|
|
41 |
|
* Wed Dec 16 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 2.7.0-1 |
42 |
|
- Updated to use 0.103+ from EPEL [SME: 11194] |
43 |
|
- Updated to use systemd for clamd [SME: 11103] |
44 |
|
- Updated to use systemd for freshclam [SME: 11104] |
45 |
|
|
46 |
* Tue Nov 26 2019 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-4.sme |
* Tue Nov 26 2019 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-4.sme |
47 |
- increase lower memory limit to 1GB [SME: 10833] |
- increase lower memory limit to 1GB [SME: 10833] |
48 |
|
|
373 |
%prep |
%prep |
374 |
%setup |
%setup |
375 |
%patch0 -p1 |
%patch0 -p1 |
376 |
%patch1 -p1 |
mkdir -p root/run/clamd |
377 |
|
rm -rf root/etc/e-smith/templates/usr/lib/systemd/system/freshclam.service.d |
378 |
|
rm -rf root/usr/lib/systemd/system/freshclam.service.d |
379 |
|
|
380 |
%build |
%build |
381 |
perl createlinks |
perl createlinks |
382 |
|
|
383 |
%pre |
%pre |
384 |
|
if [ $1 -gt 1 ] ; then |
385 |
|
if [ -e /var/service/clamd/run ] ; then |
386 |
|
/usr/bin/sv d clamd |
387 |
|
/usr/bin/sv d clamd/log |
388 |
|
fi |
389 |
|
fi |
390 |
|
if [ $1 -gt 1 ] ; then |
391 |
|
if [ -e /var/service/freshclam/run ] ; then |
392 |
|
/usr/bin/sv d freshclam |
393 |
|
/usr/bin/sv d freshclam/log |
394 |
|
fi |
395 |
|
fi |
396 |
%post |
%post |
397 |
rm -f /etc/cron.d/clamav |
|
398 |
|
# All a bit ugly clearing up due to migrating freshclam here and A5 updates |
399 |
|
# Most of this can go in due course |
400 |
|
|
401 |
|
#echo "File cleanup" |
402 |
|
# cleanup old files |
403 |
|
|
404 |
|
# no clue where it comes from not in sme9, not in new rpms, not templated |
405 |
|
#rm -f /etc/cron.d/clamav 2>/dev/null || true |
406 |
|
# this is clamd-0.100.2-2.el7.sme.x86_64 owned and not templated, removing the rpm will remove it ; useless |
407 |
|
#rm -f /etc/logrotate.d/clamav 2>/dev/null || true |
408 |
|
# this is clamav-filesystem-0.103.0-1.el7.noarch owned, should be done elsewhere, will be readded everytime the rpm is updated |
409 |
|
#rm -f /etc/clamd.d/scan.conf 2>/dev/null || true |
410 |
|
# should only be removed from prep as it is owned by this rpm |
411 |
|
#rm -rf /etc/e-smith/events/bootstrap-console-save/templates2expand/etc/cron.daily/freshclam 2>/dev/null || true |
412 |
|
# clamav-db and clamd rpm owned, might remains because of the content |
413 |
|
#rm -rf /var/clamav 2>/dev/null || true |
414 |
|
|
415 |
|
echo "Changing freshclam log owners" |
416 |
|
if [[ -d /var/log/freshclam ]]; then |
417 |
|
chown -R clamupdate:clamupdate /var/log/freshclam; |
418 |
|
chown -R clamupdate:clamupdate /var/log/freshclam/*; |
419 |
|
fi |
420 |
|
|
421 |
|
echo "Changing clamd log owners" |
422 |
|
if [[ -d /var/log/clamd ]]; then |
423 |
|
chown -R clamscan:clamscan /var/log/clamd; |
424 |
|
chown -R clamscan:clamscan /var/log/clamd/*; |
425 |
|
fi |
426 |
|
|
427 |
%install |
%install |
428 |
rm -rf $RPM_BUILD_ROOT |
rm -rf $RPM_BUILD_ROOT |
429 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
430 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
431 |
--file /var/service/freshclam/run 'attr(0755,root,root)' \ |
--dir /run/clamd 'attr(2775,clamscan,virusgroup)' \ |
432 |
--file /var/service/freshclam/log/run 'attr(0755,root,root)' \ |
--dir /var/log/freshclam 'attr(2755,clamupdate,clamupdate)' \ |
433 |
--dir /var/log/freshclam 'attr(2750,smelog,clamav)' \ |
--dir /var/log/clamd 'attr(2755,clamscan,clamscan)' \ |
434 |
--file /var/service/clamd/run 'attr(0755,root,root)' \ |
--dir /var/spool/clamav/quarantine 'attr(2750,clamscan,clamscan)' \ |
|
--file /var/service/clamd/log/run 'attr(0755,root,root)' \ |
|
|
--dir /var/log/clamd 'attr(2750,smelog,smelog)' \ |
|
|
--dir /var/spool/clamav/quarantine 'attr(2750,clamav,clamav)' \ |
|
435 |
--file /sbin/e-smith/freshclam-update-failed 'attr(0755,root,root)' \ |
--file /sbin/e-smith/freshclam-update-failed 'attr(0755,root,root)' \ |
436 |
--file /sbin/e-smith/freshclam-update-ok 'attr(0755,root,root)' \ |
--file /sbin/e-smith/freshclam-update-ok 'attr(0755,root,root)' \ |
437 |
--file /sbin/e-smith/smeserver-clamscan 'attr(0755,root,root)' \ |
--file /sbin/e-smith/smeserver-clamscan 'attr(0755,root,root)' \ |
438 |
|
--file /usr/lib/systemd/system/clamd.service 'attr(0644,root,root)' \ |
439 |
|
--file /usr/lib/systemd/system/freshclam.service 'attr(0644,root,root)' \ |
440 |
|
--dir /usr/lib/systemd/system/clamd.service.d 'attr(0755,root,root)' \ |
441 |
|
--dir /usr/lib/systemd/system/freshclam.service.d 'attr(0755,root,root)' \ |
442 |
> %{name}-%{version}-%{release}-filelist |
> %{name}-%{version}-%{release}-filelist |
443 |
|
|
444 |
%clean |
%clean |