Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916147 - app-antivirus/clamav-1.2.0: config file PidFile should point to /run/clamd.pid
Summary: app-antivirus/clamav-1.2.0: config file PidFile should point to /run/clamd.pid
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Antivirus Team
URL:
Whiteboard:
Keywords:
: 929067 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-10-23 06:26 UTC by Christophe PEREZ
Modified: 2024-07-02 10:29 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe PEREZ 2023-10-23 06:26:55 UTC
According to default config files, init scripts should contain pidfile=/run/clamav/

Actually:

# grep pidfile= $(qlist clamav | grep init )
/etc/init.d/clamav-milter:pidfile="/run/${RC_SVCNAME}.pid"
/etc/init.d/clamd:pidfile="/run/${RC_SVCNAME}.pid"
/etc/init.d/freshclam:pidfile="/run/${RC_SVCNAME}.pid"
Comment 1 Michael Orlitzky gentoo-dev 2023-10-23 16:53:46 UTC
No, it shouldn't. That's a security vulnerability, and one that clamav upstream already spent a lot of time fixing. Here's my reply to the change announcement:

  https://marc.info/?l=clamav-users&m=169117576515342&w=2
Comment 2 Christophe PEREZ 2023-10-23 16:58:31 UTC
In your opinion it is therefore normal to have a different pidfile in the init script and in the configuration.
Ok, that's your view, but many will have problems with it.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-23 16:59:48 UTC
Can you give an actual reason you want something different here? It's not about preference.

And mjo has already asked upstream to fix the "default config files" you reference.
Comment 4 Michael Orlitzky gentoo-dev 2023-10-23 17:07:31 UTC
Ok, there is a real problem here, just not the one in the summary.

The 1.2.0 ebuild runs,

  sed -e "s/^#\(PidFile .*\)/\1/"

on the config file to uncomment that line. While it used to be OK, now it is not. But the config file should be changed because the upstream commented location is now secure. The init script has it right.
Comment 5 Michael Orlitzky gentoo-dev 2023-10-23 17:08:33 UTC
(In reply to Michael Orlitzky from comment #4)
> now secure

now INsecure
Comment 6 Christophe PEREZ 2023-10-27 03:58:57 UTC
# genlop -n clamav | tail -n1
     Fri Oct 27 05:41:19 2023 >>> app-antivirus/clamav-1.2.1
# grep PidFile /etc/clamav/*.sample
clamav-milter.conf.sample:#PidFile /run/clamav/clamav-milter.pid
clamd.conf.sample:#PidFile /run/clamav/clamd.pid
freshclam.conf.sample:#PidFile /run/clamav/freshclam.pid

# grep pidfile= $(qlist clamav | grep init )
/etc/init.d/clamav-milter:pidfile="/run/${RC_SVCNAME}.pid"
/etc/init.d/clamd:pidfile="/run/${RC_SVCNAME}.pid"
/etc/init.d/freshclam:pidfile="/run/${RC_SVCNAME}.pid"
Comment 7 Michael Orlitzky gentoo-dev 2023-10-27 12:18:22 UTC
I had forgotten about this and it doesn't look like anyone acted on my mailing list message, so I opened

  https://github.com/Cisco-Talos/clamav/issues/1076

as a reminder.
Comment 8 Larry the Git Cow gentoo-dev 2024-06-24 11:04:59 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b99345bb35e9a6a208a3aa3cd6660b4d606cdb3

commit 7b99345bb35e9a6a208a3aa3cd6660b4d606cdb3
Author:     Matt Jolly <kangie@gentoo.org>
AuthorDate: 2024-06-24 10:24:55 +0000
Commit:     Matt Jolly <kangie@gentoo.org>
CommitDate: 2024-06-24 11:04:15 +0000

    app-antivirus/clamav: package maintenance
    
    revbump 1.3.1 with the following fixes:
    
    - add postinst message for 'clamonacc'
    - fix x32 builds
    - fix PID paths
    - drop py310; add py313
    
    Bug: https://github.com/Cisco-Talos/clamav/issues/1076
    Bug: https://bugs.gentoo.org/921088
    Bug: https://bugs.gentoo.org/916147
    Bug: https://bugs.gentoo.org/787233
    Closes: https://bugs.gentoo.org/927214
    Signed-off-by: Matt Jolly <kangie@gentoo.org>

 app-antivirus/clamav/clamav-1.3.1-r1.ebuild        | 409 +++++++++++++++++++++
 .../clamav/files/clamav-1.3.1-onenote-rs.patch     |  30 ++
 2 files changed, 439 insertions(+)
Comment 9 Matt Jolly gentoo-dev 2024-06-26 06:54:14 UTC
Resolved for 1.3.1-r1 by updating the relevant `sed` invocations to set the appropriate location for Gentoo - `${EPREFIX}/run/{clamd,freshclam,clamav-milter}.pid` in the shipped clamav config. I also +1'd the upstream issue a while back but I'll put in a reminder.

I'm going to let old versions age out at this point unless someone can convince me that there's a compelling reason to force rebuilds (etc).
Comment 10 Matt Jolly gentoo-dev 2024-06-29 07:09:52 UTC
*** Bug 929067 has been marked as a duplicate of this bug. ***
Comment 11 Rainer W 2024-07-02 10:29:24 UTC
Matt,

why do you think bug 929067 is a duplicate of this bug?

The patch I suggested there DOES indeed change the PID file path, but only to make it identical to what the default config file contained and thus to make things working at all.

The intention of 929067 was to drastically speed up the "clamd" start time.
And this is still necessary (and working) in version 1.3.1-r2!  One can well leave out the PID part (provided the configuration file points to the location used by the init file), so that apart from the explanatory comments only the additional assignment

   command_background=true

and one necessary change in "/etc/clamd.conf" remains.