Bug 1919339 - freshclam borks permissions on /var/lib/clamav/*.cld and *.cvd
Summary: freshclam borks permissions on /var/lib/clamav/*.cld and *.cvd
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: clamav
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Sergio Basto
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-22 15:44 UTC by Trever Adams
Modified: 2021-06-14 10:45 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-19 10:08:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Trever Adams 2021-01-22 15:44:00 UTC
Description of problem:
With some regularity on one host, but not others, freshclam will suddenly start setting permissions to 0600 instead of 0644 resulting in errors like:

Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_load(): Can't open file /var/lib/clamav/daily.cld
Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_loaddbdir(): error loading database /var/lib/clamav/daily.cld
Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_loaddbdir(): No supported database files found in /var/lib/clamav

Please, put an end to this bull crap.

Version-Release number of selected component (if applicable):
clamav-update-0.103.0-1.fc33.x86_64

Comment 1 Sergio Basto 2021-01-24 14:55:44 UTC
First try be polite , as I understood you are F33 

(In reply to Trever Adams from comment #0)
> Description of problem:
> With some regularity on one host, but not others, 

what make you think the porblem is in freshclam and not other thing 

try `systemctl restart clamav-freshclam.service` when problem happens and send 

`journalctl -u clamav-freshclam.service -f` 

maybe it is an unfinished download 

> freshclam will suddenly
> start setting permissions to 0600 instead of 0644 resulting in errors like:
> 
> Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_load(): Can't open
> file /var/lib/clamav/daily.cld
> Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_loaddbdir(): error
> loading database /var/lib/clamav/daily.cld
> Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_loaddbdir(): No
> supported database files found in /var/lib/clamav
> 

> 
> Version-Release number of selected component (if applicable):
> clamav-update-0.103.0-1.fc33.x86_64

Comment 2 Trever Adams 2021-01-24 18:34:21 UTC
(In reply to Sergio Basto from comment #1)
> First try be polite , as I understood you are F33 

You are correct, I should be to be. 

> 
> (In reply to Trever Adams from comment #0)
> > Description of problem:
> > With some regularity on one host, but not others, 
> 
> what make you think the porblem is in freshclam and not other thing 
> 
> try `systemctl restart clamav-freshclam.service` when problem happens and
> send 
> 
> `journalctl -u clamav-freshclam.service -f` 
> 
> maybe it is an unfinished download 

Because I have setting "TestDatabases yes" in freshclam. Because multiple runs on different machines always yields it on the machine in question and not the others. This includes running at the same time and comparing files afterward. Only the permissions are messed up.

Because freshclam says it finished and the database is ok:

Jan 22 08:08:02  freshclam[7493]: daily database available for download (remote version: 26057)
Jan 22 08:08:11  freshclam[7493]: Testing database: '/var/lib/clamav/tmp.f9618850d7/clamav-cc7ad98a8fec0b6a4ddc46094ce5a137.tmp-daily.cvd' ...
Jan 22 08:09:56  freshclam[7493]: Database test passed.

Jan 22 08:21:05 freshclam[9090]: daily database available for update (local version: 26056, remote version: 26057)
Jan 22 08:21:14 freshclam[9090]: Testing database: '/var/lib/clamav/tmp.5834f913b8/clamav-84ace43469ca60b61dfbb4a8c8e82edf.tmp-daily.cld' ...
Jan 22 08:22:00 freshclam[9090]: Database test passed.

I can uninstall, reinstall, delete files, chmod them, rerun freshclam... whatever. When this happens ANY run including runs freshclam is successful will result in the 0600 permissions.

> > freshclam will suddenly
> > start setting permissions to 0600 instead of 0644 resulting in errors like:
> > 
> > Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_load(): Can't open
> > file /var/lib/clamav/daily.cld
> > Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_loaddbdir(): error
> > loading database /var/lib/clamav/daily.cld
> > Jan 22 08:07:15 HOST clamd[7284]: LibClamAV Error: cli_loaddbdir(): No
> > supported database files found in /var/lib/clamav
> > 
> 
> > 
> > Version-Release number of selected component (if applicable):
> > clamav-update-0.103.0-1.fc33.x86_64

Comment 3 Sergio Basto 2021-01-25 02:27:42 UTC
(In reply to Trever Adams from comment #2)
> When this happens ANY run including runs freshclam is successful
> will result in the 0600 permissions.

you are saying ?  that this happens 100% of the times when  freshclam updates Testing database ? if yes ,  you found the bug :D , I will try check it tomorrow  thanks for the report.

Comment 4 Sergio Basto 2021-02-15 22:11:30 UTC
reported upstream  https://bugzilla.clamav.net/show_bug.cgi?id=12677

Comment 5 Sergio Basto 2021-02-19 10:08:44 UTC
I'm also unable to reproduce the issue.

My best guess is maybe there's some sort of mix of multiple freshclam/libclamav/libfreshclam versions on the affected system. If the user does get back to you, perhaps they could try making sure clamav is fully removed from the system before reinstalling.

If the user could provide either a copy of their freshclam.conf or the output from the clamconf tool along with exact instructions for how they're running freshclam it may also help.

Comment 6 george freeman 2021-06-10 18:11:07 UTC
hey guys,
I was facing the exact same bug.

this is how I fixed it:

Step 1) Update clamav (if you haven't already):
sudo freshclam

Step 2) Restart freshclam service:
systemctl restart clamav-freshclam.service

Step 3) Get UID or GID:
journalctl -u clamav-freshclam.service -f

Step 3 gives you the UID:GID, in my case this was my output and the UID or GID was 64 for me: 

Jun 10 19:49:16 host systemd[1]: Started ClamAV virus database updater.
Jun 10 19:49:16 host freshclam[11926]: ClamAV update process started at Thu Jun 10 19:49:16 2021
Jun 10 19:49:18 host freshclam[11926]: ERROR: Can't create temporary directory /var/lib/clamav/tmp.b26e9ce1ec
Jun 10 19:49:18 host [11926]: Hint: The database directory must be writable for UID 64 or GID 64
Jun 10 19:49:18 host freshclam[11926]: ERROR: Update failed.


Step 4) The fix:
chown UID:GID /var/lib/clamav && chmod 755 /var/lib/clamav


In my case UID:GID was 64, so I did:
sudo chown 64:64 /var/lib/clamav && chmod 755 /var/lib/clamav

Step 5) test:
curl https://secure.eicar.org/eicar.com.txt | clamscan -

Comment 7 Sergio Basto 2021-06-14 10:45:58 UTC
in what version of Fedora or EPEL ?


Note You need to log in before you can comment on or make changes to this bug.