Antivirus Service Configuration

Introduction

The Infinite Scale antivirus service is responsible for scanning files for viruses.

  • The antivirus service does not start automatically and must be started manually. For more details see the Start Infinite Scale section.

  • The reason for excluding the antivirus service from autostart is, that it needs an external antivirus service available and configured.

Memory Considerations

The antivirus service can consume considerably amounts of memory. This is relevant to provide or define sufficient memory for the deployment selected. To avoid out of memory (OOM) situations, the following equation gives a rough overview based on experiences made. The memory calculation comes without any guarantee, is intended as overview only and subject of change.

memory limit = max file size x workers x factor 8 - 14

With:

ANTIVIRUS_WORKERS == 1

 50MB file --> factor 14   --> 700MB memory
844MB file --> factor  8,3 -->   7GB memory

Antivirus Configuration

Antivirus Scanner Type

The antivirus service currently supports ICAP and clamAV as antivirus scanners. The ANTIVIRUS_SCANNER_TYPE environment variable is used to select the scanner. The detailed configuration for each scanner heavily depends on the scanner type selected. See the environment variables for more details.

  • For icap, only scanners using the X-Infection-Found header are currently supported.

  • For clamav, local Unix Domain Sockets and remote network sockets can be configured either by:

    • pointing to a file like /tmp/clamd.socket or

    • with a stream socket like tcp://host.docker.internal:3310.

Maximum Scan Size

Several factors can make it necessary to limit the maximum file size the antivirus service will use for scanning. Use the ANTIVIRUS_MAX_SCAN_SIZE environment variable to scan only a given amount of bytes. Obviously, it is recommended to scan the whole file, but several factors like scanner type and version, bandwidth, performance issues, etc. might make a limit necessary.

To prevent Out or Memory errors, ANTIVIRUS_MAX_SCAN_SIZE needs to be set lower than available RAM.

Antivirus Workers

The number of concurrent scans can be increased by setting ANTIVIRUS_WORKERS. Be aware that this will also increase memory usage.

Infected File Handling

The antivirus service allows three different ways of handling infected files. Those can be set via the ANTIVIRUS_INFECTED_FILE_HANDLING environment variable:

  • delete: (default): Infected files will be deleted immediately, further post-processing is cancelled.

  • abort: (advanced option): Infected files will be kept, further post-processing is cancelled. Files can be manually retrieved and inspected by an admin. To identify the file for further investigation, the antivirus service logs the abort/infected state including the file ID. The file is located in the storage/users/uploads folder of the ocis data directory and persists until it is manually deleted by the admin via the Manage Unfinished Uploads command.

  • continue: (not recommended - only for debugging): Infected files will be marked via metadata as infected but post-processing continues normally. Note: Infected Files are moved to their final destination and therefore not prevented from download which includes the risk of spreading viruses.

In all cases, a log entry is added declaring the infection, and handling method and a notification via the userlog service is sent.

Scanner Inaccessibility

In case a scanner is not accessible by the antivirus service like a network outage, service outage, or hardware outage, the antivirus service uses the abort case for further processing, independent of the actual setting made. In any case, an error is logged noting the inaccessibility of the scanner used.

Operation Modes

The antivirus service can scan files during post-processing. on demand scanning is currently not available and might be added in a future release.

Post-processing

The antivirus service will scan files during post-processing. It listens for a post-processing step called virusscan. This step can be added in the environment variable POSTPROCESSING_STEPS. Read the documentation of the postprocessing service for more details.

Scaling in Kubernetes

In kubernetes, ANTIVIRUS_WORKERS and ANTIVIRUS_MAX_SCAN_SIZE can be used to trigger the horizontal pod autoscaler by requesting a memory size that is below ANTIVIRUS_MAX_SCAN_SIZE. Keep in mind that ANTIVIRUS_MAX_SCAN_SIZE amount of memory might be held by ANTIVIRUS_WORKERS number of go routines.

Event Bus Configuration

The Infinite Scale event bus can be configured by a set of environment variables.

  • In case of an orchestrated installation like with Docker or Kubernetes, the event bus must be an external service for scalability like a Redis Sentinel cluster or a key-value-store NATS JetStream. Both named stores are supported and also used in Caching and Persistence. The store used is not part of the Infinite Scale installation and must be separately provided and configured.

  • Note that from a configuration point of view, caching and persistence are independent of the event bus configuration.

Note that for each global environment variable, a service-based one might be available additionally. For precedences see Environment Variable Notes. Check the configuration section below.

Without the aim of completeness, see the list of environment variables to configure the event bus:

Envvar Description

OCIS_EVENTS_ENDPOINT

The address of the event system.

OCIS_EVENTS_CLUSTER

The clusterID of the event system. Mandatory when using NATS as event system.

OCIS_EVENTS_ENABLE_TLS

Enable TLS for the connection to the events broker.

OCIS_INSECURE

Whether to verify the server TLS certificates.

OCIS_EVENTS_AUTH_USERNAME

The username to authenticate with the events broker.

OCIS_EVENTS_AUTH_PASSWORD

The password to authenticate with the events broker.

Configuration

Environment Variables

The antivirus service is configured via the following environment variables. Read the Environment Variable Types documentation for important details. Column IV shows with which release the environment variable has been introduced.

404: Not Found

  • 8.1.0

404: Not Found

YAML Example

  • 8.1.0

404: Not Found