files_antivirus icon indicating copy to clipboard operation
files_antivirus copied to clipboard

exception: The clamav module is not configured for daemon mode.

Open KenJusticeJr opened this issue 7 years ago • 4 comments

Steps to reproduce

  1. Go to Nextcloud Settings --> Logging

Expected behaviour

No Antivirus app exceptions listed.

Actual behaviour

Exception listed: Error | files_antivirus | OCA\Files_Antivirus\BackgroundJob\BackgroundScanner::run, exception: The clamav module is not configured for daemon mode.

Server configuration detail

Operating system: Linux 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64

Webserver: Apache/2.4.10 (Debian) (apache2handler)

Database: mysql 10.2.14

PHP version: 7.1.16 Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, session, posix, Reflection, standard, SimpleXML, pdo_sqlite, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, apache2handler, apcu, exif, gd, imagick, intl, ldap, mcrypt, memcached, mysqli, pcntl, pdo_mysql, pdo_pgsql, pgsql, redis, zip, Zend OPcache

Nextcloud version: 13.0.1 - 13.0.1.1

Updated from an older Nextcloud/ownCloud or fresh install: Fresh

Where did you install Nextcloud from: Official Nextcloud docker image. ClamAV installed from https://github.com/mko-x/docker-clamav

Signing status

Array

List of activated apps
Enabled:
 - activity: 2.6.1
 - admin_notifications: 1.0.1
 - announcementcenter: 3.2.1
 - apporder: 0.4.1
 - bruteforcesettings: 1.0.3
 - calendar: 1.6.1
 - checksum: 0.4.0
 - comments: 1.3.0
 - contacts: 2.1.3
 - dav: 1.4.6
 - deck: 0.3.1
 - encryption: 2.0.0
 - end_to_end_encryption: 1.0.5
 - federatedfilesharing: 1.3.1
 - federation: 1.3.0
 - files: 1.8.0
 - files_accesscontrol: 1.3.0
 - files_antivirus: 1.2.0
 - files_pdfviewer: 1.2.1
 - files_sharing: 1.5.0
 - files_texteditor: 2.5.1
 - files_trashbin: 1.3.0
 - files_versions: 1.6.0
 - files_videoplayer: 1.2.0
 - gallery: 18.0.0
 - issuetemplate: 0.3.0
 - logreader: 2.0.0
 - lookup_server_connector: 1.1.0
 - nextcloud_announcements: 1.2.0
 - notes: 2.3.2
 - notifications: 2.1.2
 - oauth2: 1.1.0
 - password_policy: 1.3.0
 - polls: 0.8.1
 - provisioning_api: 1.3.0
 - quota_warning: 1.2.0
 - ransomware_protection: 1.1.0
 - richdocuments: 2.0.5
 - serverinfo: 1.3.0
 - systemtags: 1.3.0
 - tasks: 0.9.6
 - theming: 1.4.1
 - twofactor_backupcodes: 1.2.3
 - twofactor_totp: 1.4.1
 - updatenotification: 1.3.0
 - user_usage_report: 1.0.1
 - w2g2: 2.0.5
 - workflowengine: 1.3.0
Disabled:
 - admin_audit
 - files_external
 - firstrunwizard
 - sharebymail
 - survey_client
 - user_external
 - user_ldap

Configuration (config/config.php)
{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "***REMOVED SENSITIVE VALUE***"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "13.0.1.1",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "mail_smtpmode": "smtp",
    "mail_smtpauthtype": "LOGIN",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "465",
    "mail_smtpauth": 1,
    "mail_smtpsecure": "ssl",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "maintenance": false,
    "defaultapp": "apporder"
}

Are you using external storage, if yes which one: No.

Are you using encryption: yes

Are you using an external user-backend, if yes which one: No.

KenJusticeJr avatar Apr 26 '18 22:04 KenJusticeJr

files_antivirus/lib/Scanner/External.php

$this->writeHandle = ($avHost && $avPort) ? @fsockopen($avHost, $avPort) : false; if (!$this->getWriteHandle()) { throw new \RuntimeException('The clamav module is not configured for daemon mode.');

So Basically what is happening is that because you are running the clamav as a separate container, your nextcloud is unable to communicate to the clamav container.

Setting the files_antivirus in daemon mode and correct name or ip and port for the docker clamav container should work. Run a 'docker exec -it nextcloud-containername bash', do a curl or ping for the clamav container see if it is all ok.

I've had this error when my clamav container has run out of memory and refused connection to the next cloud container

Hope this helps?

db260179 avatar Jun 22 '18 09:06 db260179

Setting the files_antivirus in daemon mode and correct name or ip and port for the docker clamav container should work. Run a 'docker exec -it nextcloud-containername bash', do a curl or ping for the clamav container see if it is all ok.

I've had this error when my clamav container has run out of memory and refused connection to the next cloud container

Hope this helps?

This didn't work for me. I too have clamav running in a separate container (behind a Kubernetes Service), resolvable as clamav.clamav on port 3310. I can resolve that address from my NextCloud instance, and if I install clamdscan and configure /etc/clamav/clamd.conf I can successfully scan files e.g., clamdscan /var/www/html/index.html completes successfully.

But I still get the same exception as the OP. Basically the Antivirus app is useless for me right now.

koehn avatar Sep 29 '19 14:09 koehn

I had the same issue here, installed, configured (as daemon on another host, correct port), saved. Uploaded some files, a lot of exception like these.

I went to the config and SAVED CONFIG AGAIN (no changes).

Test uploading files again, no more exception and i can see that clamd is scanning (CPU very high on the clamd host).

FYI

solracsf avatar Dec 23 '19 12:12 solracsf

#305

johndoejai avatar Mar 31 '24 07:03 johndoejai