Giter Site home page Giter Site logo

andre487 / synology-freshclam-fixer Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 10 KB

The script for periodically fixing ClamAV mirror to a custom one

License: MIT License

Python 100.00%
clamav clamav-antivirus freshclam russia synology synology-nas

synology-freshclam-fixer's Introduction

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/

synology-freshclam-fixer's People

Contributors

andre487 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.