Skip to content

PagebaraMalware scan

Set up the malware scan

Pagebara can ask ClamAV, the open-source antivirus engine, to scan a PDF and the files attached to it. ClamAV runs on your own device, so nothing is uploaded. It is optional: Pagebara's own checks work without it.

How Pagebara finds ClamAV

Pagebara talks to the ClamAV service, clamd, on this device: at 127.0.0.1, port 3310. Set PAGEBARA_CLAMD_PORT for another port, or PAGEBARA_CLAMD_SOCKET to use a Unix socket instead. The steps below start clamd on port 3310, listening on this device only. ClamAV does not protect that port with a password, so keep TCPAddr at 127.0.0.1 and never open it to the network.

ClamAV needs its signatures before it starts. The first download is large and can take some minutes.

macOS

  1. 01

    Install ClamAV with Homebrew:

    brew install clamav
  2. 02

    Make the two configuration files from the examples Homebrew installs:

    cd "$(brew --prefix)/etc/clamav"
    cp freshclam.conf.sample freshclam.conf
    cp clamd.conf.sample clamd.conf

    In both files, delete the line that says Example. Then add these lines to clamd.conf:

    TCPSocket 3310
    TCPAddr 127.0.0.1
  3. 03

    Download the signatures, then start the service now and at every login:

    freshclam
    sudo brew services start clamav

Debian and Ubuntu

  1. 01

    Install the service and the signature updater:

    sudo apt install clamav-daemon clamav-freshclam

    The updater downloads the signatures, and clamd starts once they are there.

  2. 02

    Add these lines to /etc/clamav/clamd.conf, then restart the service:

    TCPSocket 3310
    TCPAddr 127.0.0.1
    sudo systemctl restart clamav-daemon

    Or leave the file as it is and use the Unix socket the package sets up: its path is on the LocalSocket line of the same file, and Pagebara uses it when started with PAGEBARA_CLAMD_SOCKET set to that path.

On other distributions the packages have other names; the configuration lines are the same.

Windows

  1. 01

    Download the Windows installer from clamav.net and run it.

  2. 02

    In PowerShell, in the folder ClamAV was installed to, make the configuration files:

    copy .\conf_examples\freshclam.conf.sample .\freshclam.conf
    copy .\conf_examples\clamd.conf.sample .\clamd.conf

    Open each file in Notepad and delete the line that says Example. Then add these lines to clamd.conf:

    TCPSocket 3310
    TCPAddr 127.0.0.1
  3. 03

    Download the signatures, then start the service:

    .\freshclam.exe
    .\clamd.exe

Check that it works

Open any PDF in Pagebara and choose Document security beside Save. With ClamAV running, the Malware scan line offers Scan this PDF, and a switch to scan every PDF before it opens. The same switch is in Settings, System.

From a terminal on macOS or Linux, ClamAV answers PONG:

printf 'zPING\0' | nc 127.0.0.1 3310

For ClamAV itself, see its documentation. For what Pagebara checks without it, see how Pagebara checks PDFs.