Documentation contents

File storage and antivirus scanning

Attachments require storage that supports S3. ClamAV can scan each file before anyone downloads it.

The .run installer leaves uploads disabled, and the app hides attachments. To enable them, connect an object store that supports S3. Gadka does not store uploaded files in a local directory.

Uploading and scanning attachments

  • Files always pass through the Gadka server. Apps never connect directly to storage.
  • With scanning enabled, ClamAV scans each file before anyone can download it. Users see Scanning… until the scan finishes. Gadka blocks infected files.

Before you begin

  • Set up storage that supports S3, such as SeaweedFS, Ceph RGW, Garage or a cloud service, accessible only to the Gadka server.
  • Create a bucket and obtain an access key and a secret key.
  • Make sure the ClamAV clamd daemon is running and reachable from the server.

Save the storage keys

sudo install -o root -g gadka -m 0640 /dev/null /etc/gadka/s3-access-key
sudo install -o root -g gadka -m 0640 /dev/null /etc/gadka/s3-secret-key
sudo nano /etc/gadka/s3-access-key
sudo nano /etc/gadka/s3-secret-key

Configure storage and scanning

In /etc/gadka/gadka.yaml, add the s3 section and edit the existing antivirus section.

s3:
  endpoint: s3.example.com:9000
  bucket: gadka-files
  region: us-east-1
  access_key_file: /etc/gadka/s3-access-key
  secret_key_file: /etc/gadka/s3-secret-key
  use_tls: true
antivirus:
  enabled: true
  clamd_addr: 127.0.0.1:3310
KeyPurpose
s3.endpointStorage host and port. Leave empty to disable attachments.
s3.bucketName of an existing bucket
s3.use_tlsUse an encrypted connection to storage
antivirus.enabledWhen set to false, files are marked as unscanned
antivirus.clamd_addrHost and port of the clamd daemon
files.max_file_bytesMaximum file size, 1 GiB by default

Set StreamMaxLength in the clamd configuration to at least files.max_file_bytes. Otherwise large files will fail scanning.

Send a test file

sudo systemctl restart gadka

In the app's message field, click + (Add), then Attach file, and send a small file. The Scanning… status should disappear shortly and a Download button should appear.

Running without antivirus

If you set antivirus.enabled: false, users can download files without a scan.

Backups

Database backups do not include attachments. Enable versioning or backups in your S3 storage.