Hello everyone,

I have installed clamav for use with samba vfs virus filter.
I want to be able to scan files as soon as they are opened.

Operating System: CentOS Linux release 7.9.2009 (Core)

The clamd@scan and smb services have no errors at boot time.

As soon as a file is opened, an error appears in the logs and the file is not 
scanned :

# samba_audit.log
Apr 27 10:36:24 X smbd_audit: [2021/04/27 10:36:24.362541,  0, pid=8446] 
../../source3/modules/vfs_virusfilter_clamav.c:59(virusfilter_clamav_scan_init)
Apr 27 10:36:24 X smbd_audit:  virusfilter_clamav_scan_init: clamd: Connecting 
to socket failed: %: Aucun fichier ou dossier de ce type
Apr 27 10:36:24 X smbd_audit: [2021/04/27 10:36:24.362680,  0, pid=8446] 
../../source3/modules/vfs_virusfilter.c:1095(virusfilter_scan)
Apr 27 10:36:24 X smbd_audit:  virusfilter_scan: Scan result: Error: 
/data/smb2/matrice.xlsx: Initializing scanner failed

# clamd.log
Apr 27 10:32:16 X clamd[8433]: got command SCAN /data/smb2/matrice.xlsx (95, 
5), argument: /data/smb2/matrice.xlsx
Apr 27 10:32:16 X clamd[8433]: mode -> MODE_WAITREPLY
Apr 27 10:32:16 X clamd[8433]: Breaking command loop, mode is no longer 
MODE_COMMAND
Apr 27 10:32:16 X clamd[8433]: Consumed entire command
Apr 27 10:32:16 X clamd[8433]: Number of file descriptors polled: 1 fds
Apr 27 10:32:16 X clamd[8433]: THRMGR: queue (single) crossed low threshold -> 
signaling
Apr 27 10:32:16 X clamd[8433]: THRMGR: queue (bulk) crossed low threshold -> 
signaling
Apr 27 10:32:16 X clamd[8433]: Finished scanthread
Apr 27 10:32:16 X clamd[8433]: Scanthread: connection shut down (FD 13)
Apr 27 10:32:16 X clamd[8433]: THRMGR: queue (single) crossed low threshold -> 
signaling
Apr 27 10:32:16 X clamd[8433]: THRMGR: queue (bulk) crossed low threshold -> 
signaling
Apr 27 10:32:16 X clamd[8433]: Received POLLIN|POLLHUP on fd 8

# smbd.log
Apr 27 10:31:22 X smbd[8446]: [2021/04/27 10:31:22.338710,  0, pid=8446] 
../../source3/modules/vfs_full_audit.c:624(do_log)
Apr 27 10:31:22 X smbd[8446]:  do_log() failed to get vfs_handle->data!

The socket clamd is good :

[root@X ~]# netstat --listen
Sockets du domaine UNIX actives(seulement serveurs)
Proto RefCnt Flags       Type       State         I-Node   Chemin
unix  2      [ ACC ]     STREAM     LISTENING     32185    
/run/clamd.scan/clamd.sock

Do you have any ideas please?
Thank you in advance !

Best Regards,
Zami3l
Checking configuration files in /etc

Config file: clamd.d/scan.conf
------------------------------
AlertExceedsMax disabled
PreludeEnable disabled
PreludeAnalyzerName disabled
LogFile = "/var/log/clamd.scan"
LogFileUnlock disabled
LogFileMaxSize = "1048576"
LogTime = "yes"
LogClean disabled
LogSyslog = "yes"
LogFacility = "LOG_LOCAL6"
LogVerbose = "yes"
LogRotate disabled
ExtendedDetectionInfo disabled
PidFile disabled
TemporaryDirectory disabled
DatabaseDirectory = "/var/lib/clamav"
OfficialDatabaseOnly disabled
LocalSocket = "/run/clamd.scan/clamd.sock"
LocalSocketGroup disabled
LocalSocketMode = "755"
FixStaleSocket = "yes"
TCPSocket disabled
TCPAddr disabled
MaxConnectionQueueLength = "200"
StreamMaxLength = "26214400"
StreamMinPort = "1024"
StreamMaxPort = "2048"
MaxThreads = "10"
ReadTimeout = "120"
CommandReadTimeout = "30"
SendBufTimeout = "500"
MaxQueue = "100"
IdleTimeout = "30"
ExcludePath = "^/proc/", "^/sys/", "^/dev/"
MaxDirectoryRecursion = "15"
FollowDirectorySymlinks disabled
FollowFileSymlinks disabled
CrossFilesystems = "yes"
SelfCheck disabled
ConcurrentDatabaseReload = "yes"
DisableCache disabled
VirusEvent disabled
ExitOnOOM disabled
AllowAllMatchScan = "yes"
Foreground disabled
Debug = "yes"
LeaveTemporaryFiles disabled
User = "root"
Bytecode = "yes"
BytecodeSecurity = "TrustSigned"
BytecodeTimeout = "5000"
BytecodeUnsigned disabled
BytecodeMode = "Auto"
DetectPUA disabled
ExcludePUA disabled
IncludePUA disabled
ScanPE = "yes"
ScanELF = "yes"
ScanMail = "yes"
ScanPartialMessages disabled
PhishingSignatures = "yes"
PhishingScanURLs = "yes"
HeuristicAlerts = "yes"
HeuristicScanPrecedence disabled
StructuredDataDetection disabled
StructuredMinCreditCardCount = "3"
StructuredMinSSNCount = "3"
StructuredSSNFormatNormal = "yes"
StructuredSSNFormatStripped disabled
ScanHTML = "yes"
ScanOLE2 = "yes"
AlertBrokenExecutables disabled
AlertBrokenMedia disabled
AlertEncrypted disabled
StructuredCCOnly disabled
AlertEncryptedArchive disabled
AlertEncryptedDoc disabled
AlertOLE2Macros disabled
AlertPhishingSSLMismatch disabled
AlertPhishingCloak disabled
AlertPartitionIntersection disabled
ScanPDF = "yes"
ScanSWF = "yes"
ScanXMLDOCS = "yes"
ScanHWP3 = "yes"
ScanArchive = "yes"
ForceToDisk disabled
MaxScanTime disabled
MaxScanSize = "104857600"
MaxFileSize = "26214400"
MaxRecursion = "16"
MaxFiles = "10000"
MaxEmbeddedPE = "10485760"
MaxHTMLNormalize = "10485760"
MaxHTMLNoTags = "2097152"
MaxScriptNormalize = "5242880"
MaxZipTypeRcg = "1048576"
MaxPartitions = "50"
MaxIconsPE = "100"
MaxRecHWP3 = "16"
PCREMatchLimit = "100000"
PCRERecMatchLimit = "2000"
PCREMaxFileSize = "26214400"
OnAccessMountPath disabled
OnAccessIncludePath disabled
OnAccessExcludePath disabled
OnAccessExcludeRootUID disabled
OnAccessExcludeUID disabled
OnAccessExcludeUname disabled
OnAccessMaxFileSize = "5242880"
OnAccessDisableDDD disabled
OnAccessPrevention disabled
OnAccessExtraScanning disabled
OnAccessCurlTimeout = "5000"
OnAccessMaxThreads = "5"
OnAccessRetryAttempts disabled
OnAccessDenyOnError disabled
DevACOnly disabled
DevACDepth disabled
DevPerformance disabled
DevLiblog disabled
DisableCertCheck disabled
AlgorithmicDetection = "yes"
BlockMax disabled
PhishingAlwaysBlockSSLMismatch disabled
PhishingAlwaysBlockCloak disabled
PartitionIntersection disabled
OLE2BlockMacros disabled
ArchiveBlockEncrypted disabled

Config file: freshclam.conf
---------------------------
LogFileMaxSize = "1048576"
LogTime disabled
LogSyslog = "yes"
LogFacility = "LOG_LOCAL6"
LogVerbose disabled
LogRotate disabled
PidFile disabled
DatabaseDirectory = "/var/lib/clamav"
Foreground disabled
Debug disabled
UpdateLogFile = "/var/log/freshclam.log"
DatabaseOwner = "clamupdate"
Checks = "12"
DNSDatabaseInfo = "current.cvd.clamav.net"
DatabaseMirror = "database.clamav.net"
PrivateMirror disabled
MaxAttempts = "3"
ScriptedUpdates = "yes"
TestDatabases = "yes"
CompressLocalDatabase disabled
ExtraDatabase disabled
ExcludeDatabase disabled
DatabaseCustomURL disabled
HTTPProxyServer = "X"
HTTPProxyPort = "X"
HTTPProxyUsername disabled
HTTPProxyPassword disabled
HTTPUserAgent disabled
NotifyClamd = "/etc/clamd.d/scan.conf"
OnUpdateExecute disabled
OnErrorExecute disabled
OnOutdatedExecute disabled
LocalIPAddress disabled
ConnectTimeout = "30"
ReceiveTimeout disabled
SafeBrowsing disabled
Bytecode = "yes"

mail/clamav-milter.conf not found

Software settings
-----------------
Version: 0.103.1
Optional features supported: MEMPOOL IPv6 AUTOIT_EA06 BZIP2 LIBXML2 PCRE2 ICONV 
JSON 

Database information
--------------------
Database directory: /var/lib/clamav
main.cvd: version 59, sigs: 4564902, built on Mon Nov 25 14:56:15 2019
bytecode.cvd: version 333, sigs: 92, built on Mon Mar  8 16:21:51 2021
daily.cld: version 26146, sigs: 3971418, built on Tue Apr 20 13:06:39 2021
Total number of signatures: 8536412

Platform information
--------------------
uname: Linux 3.10.0-1160.21.1.el7.x86_64 #1 SMP Tue Mar 16 18:28:22 UTC 2021 
x86_64
OS: linux-gnu, ARCH: x86_64, CPU: x86_64
zlib version: 1.2.7 (1.2.7), compile flags: a9
platform id: 0x0a217a7a0800000002040805

Build information
-----------------
GNU C: 4.8.5 20150623 (Red Hat 4.8.5-44) (4.8.5)
CPPFLAGS: -I/usr/include/libprelude
CFLAGS: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 -mtune=generic 
-fno-strict-aliasing   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64
CXXFLAGS: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 -mtune=generic
LDFLAGS: -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld 
-Wl,--as-needed  -lprelude
Configure: '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' 
'--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
'--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/var/lib' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--enable-milter' '--disable-clamav' 
'--disable-static' '--disable-zlib-vcheck' '--disable-unrar' 
'--enable-id-check' '--enable-dns' '--with-dbdir=/var/lib/clamav' 
'--with-group=clamupdate' '--with-user=clamupdate' '--disable-rpath' 
'--disable-silent-rules' '--enable-clamdtop' '--enable-prelude' 
'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 
'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 -mtune=generic' 
'LDFLAGS=-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld 
-Wl,--as-needed' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 
-mtune=generic' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
sizeof(void*) = 8
Engine flevel: 122, dconf: 122
#/etc/samba/smb.conf

[global]
        server string = "X"
        workgroup = INFRA
        log level = 0
        syslog = 4
        security = user
        
    # MODULE VFS - FULL_AUDIT
        full_audit:prefix = %u | %I | %S
        full_audit:success = rename unlink mkdir rmdir connect disconnect write 
pread_recv pwrite_recv
        full_audit:failure = connect disconnect
        full_audit:facility = local6
        full_audit:priority = notice

[public]

        comment = X

        # VFS Objects
  vfs objects = full_audit virusfilter

    # MODULE VFS - VIRUSFILTER - CLAMAV
                # Type anti-virus
                virusfilter:scanner = clamav
                # Path Socket
                virusfilter:socket path = /run/clamd.scan/clamd.sock
                virusfilter:connect timeout = 300000
                virusfilter:io timeout = 300000
                # Scanner les fichiers à l'ouverture
                virusfilter:scan on close = yes
                # Taille mini pour scan
                virusfilter:min file size = 0
                # Aucun préfix
                virusfilter:quarantine prefix =
                virusfilter:rename prefix =
                # Type d'action si fichier infecté (Déplacer en quarantaine)
                virusfilter:infected file action = quarantine
                # Path quarantaine
                virusfilter:quarantine directory = /data/quarantaine/smb2

        path = /data/smb2
        create mask = 0770
        directory mask = 0770
        force group = smb_users

        browseable = yes
        guest ok = no
        read only = no
        writable = yes

        valid users = @smb_users
        write list = @smb_users
_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml

Reply via email to