Closed christianbumann closed 2 weeks ago
Calling freshclam
from the console finally updates the database, but imho this should happen automatically
ClamAV update process started at Mon Oct 7 15:40:39 2024
daily database available for update (local version: 27417, remote version: 27420)
Current database is 3 versions behind.
Downloading database patch # 27418...
Time: 0.1s, ETA: 0.0s [========================>] 1.23KiB/1.23KiB
Downloading database patch # 27419...
Time: 0.1s, ETA: 0.0s [========================>] 778B/778B
Downloading database patch # 27420...
Time: 0.1s, ETA: 0.0s [========================>] 781B/781B
Testing database: '/var/lib/clamav/tmp.bf45a06fa6/clamav-2b9033e0eee33baf5d44e893ce40d0a0.tmp-daily.cld' ...
Database test passed.
daily.cld updated (version: 27420, sigs: 2067197, f-level: 90, builder: raynman)
main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
bytecode.cvd database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)
Clamd successfully notified about the update.
{
"Clamav": "1.2.2",
"Signature": "27420",
"Signature_date": "Mon Oct 7 10:43:46 2024"
}
/ $ clamscan --version
ClamAV 1.2.2/27420/Mon Oct 7 10:43:46 2024
This reloads then the database
2024-10-07 15:40:59 Mon Oct 7 15:40:59 2024 -> Reading databases from /clamav/data
2024-10-07 15:41:46 Mon Oct 7 15:41:46 2024 -> Database correctly reloaded (8698995 signatures)
2024-10-07 15:41:46 Mon Oct 7 15:41:46 2024 -> Activating the newly loaded database...
after starting the container. freshclam uses the /clamav/data
folder but the override for the clamd https://github.com/ajilach/clamav-rest/blob/1033790c7e98b5145ace45ec5d11e9bbeaa6c57d/entrypoint.sh#L33 is not working - is this because the setting is outcommented in /clamav/etc/clamd.conf
?
/ $ cd /clamav/data
/clamav/data $ ls -l
total 365984
-rw-r--r-- 1 clamav clamav 289733 Oct 8 09:06 bytecode.cvd
-rw-r--r-- 1 clamav clamav 203986432 Oct 8 09:06 daily.cld
-rw-r--r-- 1 clamav clamav 69 Oct 8 09:06 freshclam.dat
-rw-r--r-- 1 clamav clamav 170479789 Oct 8 09:06 main.cvd
/clamav/data $
/clamav/data $ cd /var/lib/clamav
~ $ ls -l
total 365984
-rw-r--r-- 1 clamav clamav 289733 Oct 5 02:26 bytecode.cvd
-rw-r--r-- 1 clamav clamav 203985408 Oct 5 02:26 daily.cld
-rw-r--r-- 1 clamav clamav 69 Oct 5 02:26 freshclam.dat
-rw-r--r-- 1 clamav clamav 170479789 Oct 5 02:26 main.cvd
~ $
after calling freshclam
~ $ freshclam
ClamAV update process started at Tue Oct 8 09:10:54 2024
daily database available for update (local version: 27417, remote version: 27420)
Current database is 3 versions behind.
Downloading database patch # 27418...
Time: 0.1s, ETA: 0.0s [========================>] 1.23KiB/1.23KiB
Downloading database patch # 27419...
Time: 0.1s, ETA: 0.0s [========================>] 778B/778B
Downloading database patch # 27420...
Time: 0.1s, ETA: 0.0s [========================>] 781B/781B
Testing database: '/var/lib/clamav/tmp.8d8081df6f/clamav-f678a7fc88e9eeef179c2ac11b823615.tmp-daily.cld' ...
Database test passed.
daily.cld updated (version: 27420, sigs: 2067197, f-level: 90, builder: raynman)
main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
bytecode.cvd database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)
Clamd successfully notified about the update.
~ $ cd /clamav/data
/clamav/data $ ls -l
total 365984
-rw-r--r-- 1 clamav clamav 289733 Oct 8 09:06 bytecode.cvd
-rw-r--r-- 1 clamav clamav 203986432 Oct 8 09:06 daily.cld
-rw-r--r-- 1 clamav clamav 69 Oct 8 09:06 freshclam.dat
-rw-r--r-- 1 clamav clamav 170479789 Oct 8 09:06 main.cvd
/clamav/data $
/clamav/data $ cd /var/lib/clamav
~ $ ls -l
total 365988
-rw-r--r-- 1 clamav clamav 289733 Oct 5 02:26 bytecode.cvd
-rw-r--r-- 1 clamav clamav 203986432 Oct 8 09:10 daily.cld
-rw-r--r-- 1 clamav clamav 69 Oct 5 02:26 freshclam.dat
-rw-r--r-- 1 clamav clamav 170479789 Oct 5 02:26 main.cvd
~ $
@davosian Unfortunately updating still doesn't work, the path mapping from the previous version also worked. I am sure that updating was working on my local machine before creating the pull request. I have a guess why it doesn't work and why it worked in my local tests. I'll check my assumption tomorrow as soon as new virus definitions are available. But anyway, imho it's more secure to set the value inside the config instead of using an argument during the service start :-)
Hi @christianbumann, thanks for the heads-up. This is unfortunate, but I appreciate your effort to get this sorted out. While more secure, the approach is slightly less flexible. Given that we are dealing with an antivirus scanner, more secure is the better choice :)
Turns out the changes did not have the desired effect.
Turns out the changes did not have the desired effect.
@davosian I think that I found the problem. I’ll create a Pull Request tomorrow or friday to fix it finally…
Sounds like a plan @christianbumann 🙌
https://linux.die.net/man/5/freshclam.conf
NotifyClamd
Notify a running clamd(8) to reload its database after a download has occurred. The path for clamd.conf file must be provided. Default: The default is to not notify clamd. See clamd.conf(5)'s option SelfCheck for how clamd(8) handles database updates in this case.
The value of NotifyClamd before this change is the old path /etc/clamav/clamd.conf
Hi @christianbumann, thanks for the heads-up. This is unfortunate, but I appreciate your effort to get this sorted out. While more secure, the approach is slightly less flexible. Given that we are dealing with an antivirus scanner, more secure is the better choice :)
@davosian is there a good reason why some original directories are changed inside the entrypoint.sh
Starting an older version of the container with docker compose
It shows that the database was updated
but getting the version still shows me the old one