#2 Multiple important fixes for RHEL/CentOS 6
Opened 3 months ago by robert. Modified 3 months ago
rpms/ robert/clamav-unofficial-sigs master  into  master

@@ -0,0 +1,44 @@ 

+ From 882507f36af3ac6cb9c9332b7d34dcec6d12d38e Mon Sep 17 00:00:00 2001

+ From: Robert Scheck <robert@fedoraproject.org>

+ Date: Fri, 8 Mar 2019 14:45:02 +0100

+ Subject: [PATCH] Use `/sbin/service` rather `service` and `reload` rather

+  `restart for RHEL/CentOS 6

+ 

+ By default RHEL/CentOS 6 doesn't have `/sbin` in `$PATH`, thus `service clamd restart`

+ poorly fails by default. Aside of that, a `reload` rather a `restart` is sufficient for

+ ClamAV as well to reload the ClamAV databases (worked already for years now). If at all

+ this should be turned into `condrestart` rather `restart`, because RHEL/CentOS 6 might

+ not use `/etc/init.d/clamd` service at all, but `/etc/init.d/clamd.amavisd` service;

+ which gets relevant when ClamAV is used only for Amavisd-New, but not for the actual

+ system...nobody would like to see a maybe unused service to be started by a cronjob...

+ ---

+  config/os.centos6-cpanel.conf | 2 +-

+  config/os.centos6.conf        | 2 +-

+  2 files changed, 2 insertions(+), 2 deletions(-)

+ 

+ diff --git a/config/os.centos6-cpanel.conf b/config/os.centos6-cpanel.conf

+ index 02ed033..6ac3044 100644

+ --- a/config/os.centos6-cpanel.conf

+ +++ b/config/os.centos6-cpanel.conf

+ @@ -27,7 +27,7 @@ clam_dbs="/usr/local/cpanel/3rdparty/share/clamav"

+  

+  clamd_pid="/var/run/clamav/clamd.pid"

+  

+ -clamd_restart_opt="service clamd restart"

+ +clamd_restart_opt="/sbin/service clamd reload"

+  

+  #clamd_socket="/var/run/clamd.socket"

+  

+ diff --git a/config/os.centos6.conf b/config/os.centos6.conf

+ index af48428..fab6495 100644

+ --- a/config/os.centos6.conf

+ +++ b/config/os.centos6.conf

+ @@ -27,7 +27,7 @@ clam_dbs="/var/lib/clamav"

+  

+  clamd_pid="/var/run/clamav/clamd.pid"

+  

+ -clamd_restart_opt="service clamd restart"

+ +clamd_restart_opt="/sbin/service clamd reload"

+  

+  #clamd_socket="/var/run/clamd.socket"

+  

file modified
+27 -1

@@ -5,12 +5,13 @@ 

  %endif

  Name:           clamav-unofficial-sigs

  Version:        5.6.2

- Release:        5%{?dist}

+ Release:        6%{?dist}

  Summary:        Scripts to download unoffical clamav signatures 

  Group:          Applications/System

  License:        BSD

  URL:            https://github.com/extremeshok/%{name}

  Source0:        https://github.com/extremeshok/%{name}/archive/%{version}.tar.gz

+ Patch0:         clamav-5.6.2-el6-service.patch

  BuildArch:      noarch

  BuildRequires:  bind-utils

  BuildRequires:  rsync

@@ -18,6 +19,9 @@ 

  BuildRequires:  systemd

  %endif

  Requires:       clamav clamav-update rsync gnupg diffutils curl bind-utils

+ %if 0%{?rhel} && 0%{?rhel} < 7

+ Requires(pre):  shadow-utils

+ %endif

  

  %description

  This package contains scripts and configuration files

@@ -28,6 +32,9 @@ 

  

  %prep

  %setup -qn %{name}-%{version}

+ %if 0%{?rhel} && 0%{?rhel} < 7

+ %patch0 -p1

+ %endif

  sed -i -e '/user_configuration_complete/ s/^#//' config/user.conf

  sed -i -e '/ExecStart/ s^/usr/local/sbin^/usr/sbin^' systemd/clamav-unofficial-sigs.service

  # Just for generating cron, logrotate and man files

@@ -89,6 +96,15 @@ 

  %clean

  rm -rf %{buildroot}

  

+ %if 0%{?rhel} && 0%{?rhel} < 7

+ %pre

+ getent group clam-update >/dev/null || groupadd -r clam-update

+ getent passwd clam-update >/dev/null || \

+     useradd -r -g clam-update -d %{_localstatedir}/lib/%{name} -s /bin/bash \

+     -c "%{name} user account" clam-update

+ exit 0

+ %endif

+ 

  %files

  %doc README.md INSTALL 

  %license LICENSE

@@ -97,8 +113,13 @@ 

  %config %{_sysconfdir}/%{name}/master.conf

  %config(noreplace) %{_sysconfdir}/%{name}/user.conf

  %{_sbindir}/clamav-unofficial-sigs.sh

+ %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7

  %attr(0755,clamupdate,clamupdate) %dir %{_localstatedir}/lib/%{name}

  %attr(0755,clamupdate,clamupdate) %dir %{_localstatedir}/log/%{name}

+ %else

+ %attr(0755,clam-update,clam-update) %dir %{_localstatedir}/lib/%{name}

+ %attr(0755,clam-update,clam-update) %dir %{_localstatedir}/log/%{name}

+ %endif

  %if %{with_systemd}

  %{_unitdir}/%{name}.service

  %{_unitdir}/%{name}.timer

@@ -108,6 +129,11 @@ 

  %{_mandir}/man*/%{name}*

  

  %changelog

+ * Fri Mar 08 2019 Robert Scheck <robert@fedoraproject.org> - 5.6.2-6

+ - Create needed clam-update system user only on RHEL/CentOS 6

+ - Continue usage of clam-update rather clamupdate on RHEL/CentOS 6

+ - Add patch proposal for RHEL/CentOS 6 to use /sbin/service

+ 

  * Thu Mar  7 2019 Tim Landscheidt <tim@tim-landscheidt.de> - 5.6.2-5

  - Remove obsolete requirement for %%post scriptlet

  

  • Create needed clam-update system user only on RHEL/CentOS 6
  • Continue usage of clam-update rather clamupdate on RHEL/CentOS 6
  • Add patch proposal for RHEL/CentOS 6 to use /sbin/service

See also:

Pull-Request has been closed by tartare

3 months ago

Pull-Request has been reopened by tartare

3 months ago

Patch for os.centos6-cpanel.conf and os.centos6.conf must be accepted by upstream. All personal configuration can be written in user.conf file.
service is present by default on all el6 installation, even minimal one (it's tested).
I fix the clam-update user problem

Pull-Request has been closed by tartare

3 months ago

The broken os.centos6.conf default must be also fixed downstream, otherwise this renders clamav-unofficial-sigs quite useless by default on RHEL/CentOS 6.

Pull-Request has been reopened by robert

3 months ago

Because upstream seems to be blind (or dead), I will integrate some of your lines of patch:

  • Create needed clam-update system user only on RHEL/CentOS 6: not needed because it's included on el6 branch (only)
  • Continue usage of clam-update rather clamupdate on RHEL/CentOS 6: already fixed
  • Add patch proposal for RHEL/CentOS 6 to use /sbin/service: this part should be merged
    But I don't understand why requires(pre) shadow-utils. This package is already included by default (minimal install, mock, etc...)

And because the el6 branch is a very very big mess, I must clean it before.