docker-clamav icon indicating copy to clipboard operation
docker-clamav copied to clipboard

Add custom Database URL to freshclam

Open Extarys opened this issue 3 years ago • 6 comments

Summary

Every time the container starts, the freshclam.conf is overwritten.

Steps to reproduce

Modify the freshclam config file Restart the container

What is the expected correct behavior?

The freshclam file shouldn't change if not needed.

Relevant logs and/or screenshots

Possible fixes

It would be nice to have a FRESHCLAM_DATABASES variable that allow a comma separated list of URLS to add to the freshclam conf file, or detect if any variable have changed and update only those in the config file.

Extarys avatar Sep 12 '22 17:09 Extarys

Can I have an example freshclam.conf file on how you envision this could work? I could easily build this in.

tiredofit avatar Sep 12 '22 17:09 tiredofit

Hey, quick reply, you're awesome :sunglasses:

In docker-compose or podman-compose:

environment:
  - FRESHCLAM_DATABASES=http://www.rfxn.com/downloads/rfxn.ndb,http://www.rfxn.com/downloads/rfxn.hdb,http://www.rfxn.com/downloads/rfxn.yara,http://sigs.mailborder.com/hackingteam.hsb,https://mirror.rollernet.us/sanesecurity/rogue.hdb,https://mirror.rollernet.us/sanesecurity/foxhole_filename.cdb,https://mirror.rollernet.us/sanesecurity/foxhole_generic.cdb

(Not sure if compose will require some quotes around that because of the slashes and all but...)

At the end of the freshclam.conf file, the script would append the following lines:

DatabaseCustomURL http://www.rfxn.com/downloads/rfxn.ndb
DatabaseCustomURL http://www.rfxn.com/downloads/rfxn.hdb
DatabaseCustomURL http://www.rfxn.com/downloads/rfxn.yara
DatabaseCustomURL http://sigs.mailborder.com/hackingteam.hsb
DatabaseCustomURL https://mirror.rollernet.us/sanesecurity/rogue.hdb
DatabaseCustomURL https://mirror.rollernet.us/sanesecurity/foxhole_filename.cdb
DatabaseCustomURL https://mirror.rollernet.us/sanesecurity/foxhole_generic.cdb

Extarys avatar Sep 12 '22 20:09 Extarys

OK! This seems very straight forward, thank you. I just added this functionality to 2.5.0 - Can you let me know if this works as intended?

tiredofit avatar Sep 12 '22 20:09 tiredofit

That was quick! I should try to learn git again, but last time I tried I broke a repo hahaha

It appears to work-ish. For some reason there is no new line after each insertion:

DatabaseCustomURL http://www.rfxn.com/downloads/rfxn.ndbDatabaseCustomURL h...

Relevant docker-compose:

  clamav:
    image: tiredofit/clamav:latest
    container_name: clamav
    volumes:
      - /containers/clamav/data:/data:Z
      - /containers/clamav/logs:/logs:Z
    environment:
      - CONTAINER_NAME=clamav
      - DEFINITIONS_UPDATE_FREQUENCY=60
      - MAX_FILE_SIZE=25M
      - PCRE_MAX_FILE_SIZE=25M
      - STREAM_MAX_LENGTH=25M
      - MAX_THREADS=2
      - FRESHCLAM_DATABASES=http://www.rfxn.com/downloads/rfxn.ndb,http://www.rfxn.com/downloads/rfxn.hdb,http://www.rfxn.com/downloads/rfxn.yara,http://sigs.mailborder.com/hackingteam.hsb,https://mirror.rollernet.us/sanesecurity/rogue.hdb,https://mirror.rollernet.us/sanesecurity/foxhole_filename.cdb,https://mirror.rollernet.us/sanesecurity/foxhole_generic.cdb
    #ports:
    #  - "3310:3310"
    restart: always

Line: https://github.com/tiredofit/docker-clamav/blob/master/install/etc/cont-init.d/10-clamd#L189

Extarys avatar Sep 13 '22 01:09 Extarys

Ack my bad. 2.5.1 or latest will solve :)

tiredofit avatar Sep 13 '22 01:09 tiredofit

The file itself didn't change. I made sure to use the 2.5.1 release.

The default databases themselves are still being downloaded. I also tried stopping the container, delete de config folder and relaunch the container.

I have no clue why the linebreak isn't getting inserted :/

Extarys avatar Sep 13 '22 15:09 Extarys