Bug 262653 - security/clamav: rc.d script does not allow for alternate database directory
Summary: security/clamav: rc.d script does not allow for alternate database directory
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-18 20:14 UTC by Dave Hayes
Modified: 2023-06-22 05:21 UTC (History)
4 users (show)

See Also:
0mp: maintainer-feedback-


Attachments
This handles the issue (1.04 KB, text/plain)
2022-03-18 20:14 UTC, Dave Hayes
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Hayes 2022-03-18 20:14:18 UTC
Created attachment 232559 [details]
This handles the issue

The rc.d script has the clamav database path hardcoded into the script. If you change the database path in clamd.conf, the current rc.d script will effectively prevent clamd from running. 

I've attached my fix, making a new rc.conf variable to define where the database should go. I recognize that it's the same definition in two places (rc.conf and clamd.conf) but at least this version will be less surprising. An obvious improvement is to make the variable the value of DatabaseDirectory in ${PREFIX}/clamd.conf.
Comment 1 Dave Hayes 2022-03-18 20:14:39 UTC
I'm pretty sure this affects everyone.
Comment 2 Matt Simerson 2023-06-22 05:00:49 UTC
Yes please! Thanks for the patch. I'd suggest naming the config setting clamav_clamd_dbdir or clamav_db_dir. The latter I think is a better choice because rc.d/clamav-freshclam also needs to take the directory location into account as required_dirs.
Comment 3 Matt Simerson 2023-06-22 05:16:09 UTC
"An obvious improvement is to make the variable the value of DatabaseDirectory in ${PREFIX}/clamd.conf."

Yes, that would be better! And it's easy enough to do:

  grep -i databasedirectory /data/etc/clamd.conf | awk '{ print $2 }'

I'd also like to see a clamav_clamd_conf setting that is passed to clamd as the -c option, so I can specify the path to clamd.conf and then the DB directory is learned from the config file.
Comment 4 Matt Simerson 2023-06-22 05:21:57 UTC
Sorry for all the noise. Just thought I point out that the way I'm currently using an alternate directory is with these rc.conf settings:

sysrc clamav_clamd_flags="-c /data/etc/clamd.conf"

sysrc clamav_freshclam_flags="--config-file=/data/etc/freshclam.conf --datadir=/data/db"

And modifying the rc.d/clamav-* files to point at the correct datadir.