Skip to content

Commit

Permalink
Release 2.5.0 - See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Sep 12, 2022
1 parent 1fc4835 commit 8334cbb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 31 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.5.0 2022-09-12 <dave at tiredofit dot ca>

### Added
- Ability to load custom remote datases and have updated with Freshclam


## 2.4.2 2022-08-17 <dave at tiredofit dot ca>

### Changed
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 Dave Conroy
Copyright (c) 2022 Dave Conroy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
47 changes: 25 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Dockerfile to build an [Clam Antivirus](https://www.clamav.net) to scan files or
- Auto Configuration Support
- Sane Defaults
- Automatic Downlad and update of Virus Definitions
- Ability to load custom definitions
- Log rotation

## Maintainer
Expand Down Expand Up @@ -110,25 +111,27 @@ Be sure to view the following repositories to understand all the customizable op

#### Core Configuration

| Parameter | Description | Default |
| ---------------------------- | ---------------------------------------------------------------------- | ------------------------------- |
| `SETUP_TYPE` | Auto Configure Configuration each startup - Set to `MANUAL` to disable | `AUTO` |
| `CLAMD_CONFIG_FILE` | Clamd Configuration file | `clamd.conf` |
| `CLAMD_LOCAL_SOCKET` | Clamd Socket Name | `/run/clamd/clamd.sock` |
| `CLAMD_TEMP_LOCATION` | CLamd Temp Location | `/tmp/clamd/` |
| `CONCURRENT_DATABASE_RELOAD` | Enable non-blocking (multi-threaded/concurrent) database reloads. | `TRUE` |
| `DATA_LOCATION` | Base Folder for Data Files | `/data/` |
| `CONFIG_LOCATION` | Folder for Config Files | `${DATA_LOCATION}/config/` |
| `DEFINITIONS_LOCATION` | Folder for Virus Definitions | `${DATA_LOCATION`/definitions/` |
| `ENABLE_CLAMD` | Enable ClamD Daemon | `TRUE` |
| `ENABLE_LOG_CLAMD` | Enable Logging for Clamd | `TRUE` |
| `ENABLE_LOG_FRESHCLAM` | Enable Logging for Definitions Updaer | `TRUE` |
| `FRESHCLAM_CONFIG_FILE` | Freshclam Definitions Updater configuration file | `freshclam.conf` |
| `LISTEN_PORT` | ClamD TCP Socket Listen port | `3310` |
| `LOG_FILE_CLAMD` | ClamD Log File | `clamd.log` |
| `LOG_FILE_FRESHCLAM` | Freshclam Log File | `freshclam.log` |
| `LOG_PATH` | Logfile locations | `/logs/` |
| `LOG_VERBOSE` | Enable Verbosity in Logs | `FALSE` |
| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------------------- | ------------------------------- |
| `SETUP_TYPE` | Auto Configure Configuration each startup - Set to `MANUAL` to disable | `AUTO` |
| `CLAMD_CONFIG_FILE` | Clamd Configuration file | `clamd.conf` |
| `CLAMD_LOCAL_SOCKET` | Clamd Socket Name | `/run/clamd/clamd.sock` |
| `CLAMD_TEMP_LOCATION` | CLamd Temp Location | `/tmp/clamd/` |
| `CONCURRENT_DATABASE_RELOAD` | Enable non-blocking (multi-threaded/concurrent) database reloads. | `TRUE` |
| `DATA_LOCATION` | Base Folder for Data Files | `/data/` |
| `CONFIG_LOCATION` | Folder for Config Files | `${DATA_LOCATION}/config/` |
| `DEFINITIONS_LOCATION` | Folder for Virus Definitions | `${DATA_LOCATION}/definitions/` |
| `ENABLE_CLAMD` | Enable ClamD Daemon | `TRUE` |
| `ENABLE_LOG_CLAMD` | Enable Logging for Clamd | `TRUE` |
| `ENABLE_LOG_FRESHCLAM` | Enable Logging for Definitions Updaer | `TRUE` |
| `FRESHCLAM_CONFIG_FILE` | Freshclam Definitions Updater configuration file | `freshclam.conf` |
| `FRESHCLAM_DATABASES` | Comma seperated list of additional definitions eg | |
| | `http://www.rfxn.com/downloads/rfxn.ndb,http://www.rfxn.com/downloads/rfxn.hdb` | |
| `LISTEN_PORT` | ClamD TCP Socket Listen port | `3310` |
| `LOG_FILE_CLAMD` | ClamD Log File | `clamd.log` |
| `LOG_FILE_FRESHCLAM` | Freshclam Log File | `freshclam.log` |
| `LOG_PATH` | Logfile locations | `/logs/` |
| `LOG_VERBOSE` | Enable Verbosity in Logs | `FALSE` |


#### Virus Definitions Configuration
Expand All @@ -137,9 +140,9 @@ Be sure to view the following repositories to understand all the customizable op
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `ENABLE_DEFINITIONS_UPDATE` | Enable Automatic Definitions Updating | `TRUE` |
| `DEFINITIONS_UPDATE_FREQUENCY` | How often to check for new Definitions in minutes | `60` |
| `DEFINITIONS_UPDATE_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats |
| | Absolute HHMM, e.g. `2330` or `0415` |
| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half |
| `DEFINITIONS_UPDATE_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats | |
| | Absolute HHMM, e.g. `2330` or `0415` | |
| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half | |

#### Virus Scanning Settings

Expand Down
26 changes: 18 additions & 8 deletions install/etc/cont-init.d/10-clamd
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ if var_true "${ENABLE_LOG_CLAMD}" || var_true "${ENABLE_LOG_FRESHCLAM}" ; then
fi

#### Configuration
if [ ! -f "${CONFIG_LOCATION}""${CLAMD_CONFIG_FILE}" ] || [ ! -f "${CONFIG_LOCATION}""${FRESHCLAM_CONFIG_FILE}" ] ; then
if [ ! -f "${CONFIG_LOCATION}"/"${CLAMD_CONFIG_FILE}" ] || [ ! -f "${CONFIG_LOCATION}"/"${FRESHCLAM_CONFIG_FILE}" ] ; then
mkdir -p "${CONFIG_LOCATION}"
print_info "Setting up Configuration for the first time"
SETUP_MODE=AUTO
SETUP_MODE=auto
fi

#### Socket Configuration
Expand All @@ -66,7 +66,7 @@ if [ ! -d "${CLAMD_TEMP_LOCATION}" ] ; then
chown -R clamav:clamav "${CLAMD_TEMP_LOCATION}"
fi

if [ "$SETUP_TYPE" = "AUTO" ]; then
if [ "${SETUP_TYPE,,}" = "auto" ]; then
truefalse_yesno DISABLE_CERT_CHECK
truefalse_yesno ENABLE_ALGORITHMIC_DETECTION
truefalse_yesno ENABLE_BYTECODE
Expand Down Expand Up @@ -102,7 +102,7 @@ EOF
done

print_notice "Generating Configuration for Clam Antivirus"
cat <<EOF > "${CONFIG_LOCATION}""${CLAMD_CONFIG_FILE}"
cat <<EOF > "${CONFIG_LOCATION}"/"${CLAMD_CONFIG_FILE}"
## Custom Generated Clam Antivirus Configuration! Do not edit, instead set ENV Vars
## If you want to use your own configuration files set SETUP_TYPE=MANUAL when starting container
## Last Generated on $(TZ=${TIMEZONE} date +'%Y-%m-%d %H:%M:%S %Z')
Expand Down Expand Up @@ -182,7 +182,17 @@ AlertExceedsMax ${ENABLE_ALERT_EXCEEDS_MAX}
EOF

print_notice "Generating Configuration for Definitions Updater"
cat <<EOF > "${CONFIG_LOCATION}""${FRESHCLAM_CONFIG_FILE}"
if [ -n "${FRESHCLAM_DATABASES}" ] ; then
custom_db_array=$(echo "${FRESHCLAM_DATABASES}" | tr "," "\n")
for db in $custom_db_array; do
custom_db=${custom_db}$(cat <<EOF
DatabaseCustomURL ${db}
EOF
)
done
fi

cat <<EOF > "${CONFIG_LOCATION}"/"${FRESHCLAM_CONFIG_FILE}"
## Custom Generated Freshclam Configuration! Do not edit, instead set ENV Vars
## If you want to use your own configuration files set SETUP_TYPE=MANUAL when starting container
## Last Generated on $(date)
Expand All @@ -192,17 +202,17 @@ DatabaseDirectory ${DEFINITIONS_LOCATION}
DatabaseMirror database.clamav.net
ScriptedUpdates yes
LogTime yes
${custom_db}
EOF

else
print_notice "Manual Configuration Mode selected"
fi
chown -R clamav:clamav "${CONFIG_LOCATION}"

### Check for Definitions
if [ ! -f "${DEFINITIONS_LOCATION}"main.cvd ]; then
if [ ! -f "${DEFINITIONS_LOCATION}"/main.cvd ]; then
print_warn "No Virus Definitions Found! Downloading.."
silent freshclam -F --config-file="${CONFIG_LOCATION}""${FRESHCLAM_CONFIG_FILE}" "${log_verbose}" "${freshclam_log}" "${debug_arg}"
silent freshclam -F --config-file="${CONFIG_LOCATION}"/"${FRESHCLAM_CONFIG_FILE}" "${log_verbose}" "${freshclam_log}" "${debug_arg}"
fi

echo "alias clamscan='clamscan -d ${DEFINITIONS_LOCATION}'" > /root/.bashrc
Expand Down

0 comments on commit 8334cbb

Please sign in to comment.