Skip to content

The script for periodically fixing ClamAV mirror to a custom one

License

Notifications You must be signed in to change notification settings

andre487/synology-freshclam-fixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synology freshclam fixer

The script for periodically fixing ClamAV settings (Antivirus Essential package) to custom ones in Synology NAS.

This is necessary because of settings reset to default when Antivirus Essential package is updating.

Why do you need this?

  • You have to use a private or alternative mirror in your private network
  • You are in Russia and you have to use alternative mirrors because ClamAV banned whole the country

Usage

usage: synology-freshclam-fixer.py [-h] --config CONFIG [--result RESULT] [--dns-database-info DNS_DATABASE_INFO]
                                   [--database-mirror DATABASE_MIRROR] [--private-mirror PRIVATE_MIRROR] [--custom-value CUSTOM_VALUE]

options:
  -h, --help            show this help message and exit
  --config CONFIG, -c CONFIG
                        Path to freshclam.conf
  --result RESULT, -r RESULT
                        Path to result config, if empty it will be value of `--config`
  --dns-database-info DNS_DATABASE_INFO, -d DNS_DATABASE_INFO
                        Value for replace DNSDatabaseInfo option with another domain with TXT record about components
  --database-mirror DATABASE_MIRROR, -m DATABASE_MIRROR
                        Database mirror, can be multiple
  --private-mirror PRIVATE_MIRROR, -p PRIVATE_MIRROR
                        Private mirror, can be multiple
  --custom-value CUSTOM_VALUE, -s CUSTOM_VALUE
                        Custom config value, example: -s "Checks 12" -s "TestDatabases yes"

Example

./synology-freshclam-fixer.py \
    --config '/volume1/@appstore/AntiVirus/engine/clamav/etc/freshclam.conf' \
    --result '/tmp/changed-freshclam.conf' \
    --dns-database-info 'cvd.clamav.example.net' \
    --database-mirror 'https://clamav-ru.ai-stv.ru' \
    --database-mirror 'https://unlix.ru/clamav' \
    --private-mirror 'https://packages.microsoft.com/clamav' \
    --custom-value 'Checks 12' \
    --custom-value 'ScriptedUpdates no'

Files difference after changes applied:

16c16
< DNSDatabaseInfo current.cvd.clamav.net
---
> DNSDatabaseInfo cvd.clamav.example.net
22c22
< ScriptedUpdates yes
---
> ScriptedUpdates no
26,27c26,29
< Checks 24
< DatabaseMirror database.clamav.net
---
> Checks 12
> DatabaseMirror https://clamav-ru.ai-stv.ru
> DatabaseMirror https://unlix.ru/clamav
> PrivateMirror https://packages.microsoft.com/clamav

Setup in Synology NAS

Place the script synology-freshclam-fixer.py in some directory on the FS. For example, it can be /usr/local/bin/synology-freshclam-fixer.py.

Run chmod +x /usr/local/bin/synology-freshclam-fixer.py. Or you can run it like python3 synology-freshclam-fixer.py.

Setup periodical task using Task Scheduler. For example, you can run this script once a day with specified parameters. Script should be runned under root user.

Links

Config manual

Trusted mirror: https://packages.microsoft.com/clamav/

About

The script for periodically fixing ClamAV mirror to a custom one

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages