[Samba] vfs_virusfilter - clamav - Connecting to socket failed
Zami3l
null at zami3l.com
Wed Apr 28 09:30:19 UTC 2021
Hello everyone,
I am using vfs_virusfilter with clamav.
I would like that as soon as a file is opened, it is scanned.
System: CentOS Linux release 7.9.2009 (Core) (SELinux is disabled)
Version Samba : 4.10.16
The clamscan and smb services start correctly.
No problem at first, the files are scanned well as soon as they are opened.
If I save a file multiple times (e.g. xls or doc) in a very short period of time, I get this error:
# /var/log/samba/samba_audit.log
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.216663, 0, pid=14938] ../../source3/modules/vfs_virusfilter_clamav.c:59(virusfilter_clamav_scan_init)
Apr 27 15:26:24 X smbd_audit: virusfilter_clamav_scan_init: clamd: Connecting to socket failed: #020؆U: Aucun fichier ou dossier de ce type
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.216843, 0, pid=14938] ../../source3/modules/vfs_virusfilter.c:1095(virusfilter_scan)
Apr 27 15:26:24 X smbd_audit: virusfilter_scan: Scan result: Error: /data/smb2/00-Projets/ldap.xlsx: Initializing scanner failed
Apr 27 15:26:24 X smbd_audit: zami3l | xx.xxx.xxx.xxx | public NETWORK|pread_recv|ok|/data/smb2/00-Projets/ldap.xlsx
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.902581, 0, pid=14938] ../../source3/modules/vfs_virusfilter_clamav.c:59(virusfilter_clamav_scan_init)
Apr 27 15:26:24 X smbd_audit: virusfilter_clamav_scan_init: clamd: Connecting to socket failed: #020؆U: Aucun fichier ou dossier de ce type
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.902705, 0, pid=14938] ../../source3/modules/vfs_virusfilter.c:1095(virusfilter_scan)
Apr 27 15:26:24 X smbd_audit: virusfilter_scan: Scan result: Error: /data/smb2/00-Projets/ldap.xlsx: Initializing scanner failed
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.907650, 0, pid=14938] ../../source3/modules/vfs_virusfilter_clamav.c:59(virusfilter_clamav_scan_init)
Apr 27 15:26:24 X smbd_audit: virusfilter_clamav_scan_init: clamd: Connecting to socket failed: #020؆U: Aucun fichier ou dossier de ce type
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.907749, 0, pid=14938] ../../source3/modules/vfs_virusfilter.c:1095(virusfilter_scan)
Apr 27 15:26:24 X smbd_audit: virusfilter_scan: Scan result: Error: /data/smb2/00-Projets/ldap.xlsx: Initializing scanner failed
Apr 27 15:26:24 X smbd_audit: zami3l | xx.xxx.xxx.xxx | public NETWORK|pread_recv|ok|/data/smb2/00-Projets/ldap.xlsx
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.939625, 0, pid=14938] ../../source3/modules/vfs_virusfilter_clamav.c:59(virusfilter_clamav_scan_init)
Apr 27 15:26:24 X smbd_audit: virusfilter_clamav_scan_init: clamd: Connecting to socket failed: #020؆U: Aucun fichier ou dossier de ce type
Apr 27 15:26:24 X smbd_audit: [2021/04/27 15:26:24.939732, 0, pid=14938] ../../source3/modules/vfs_virusfilter.c:1095(virusfilter_scan)
Apr 27 15:26:24 X smbd_audit: virusfilter_scan: Scan result: Error: /data/smb2/00-Projets/ldap.xlsx: Initializing scanner failed
Smbd no longer succeeds in connecting with the clamdscan socket.
However, it is still present and functional.
After that, my only actions are:
reboot smb service or Wait for the smbd process associated with my user to disappear
[root at X ~]# ps aux | grep smbd
zami3l 9394 0.0 0.1 560976 11412 ? S 09:29 0:00 /usr/sbin/smbd --foreground --no-process-group
root 10453 0.0 0.1 569184 11456 ? S 10:09 0:00 /usr/sbin/smbd --foreground --no-process-group
root 11606 0.0 0.0 112832 976 pts/0 R+ 11:04 0:00 grep --color=auto smbd
[...]
root 21759 0.0 0.0 503952 6848 ? S avril27 0:00 /usr/sbin/smbd --foreground --no-process-group
I also sometimes have this error that appears :
# 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!
Please do you have any idea why vfs_virusfilter can't reach clamd socket anymore?
Configuration files are attached.
Thank you in advance !
Best Regards,
Zami3l
-------------- next part --------------
[global]
server string = "X"
# freeipa configurations
debug pid = yes
realm = X
workgroup = INFRA
domain master = Yes
ldap group suffix = X
ldap machine suffix = X
ldap ssl = off
ldap suffix = X
ldap user suffix = X
log level = 0
syslog = 4
domain logons = Yes
registry shares = Yes
disable spoolss = Yes
dedicated keytab file = FILE:/etc/samba/samba.keytab
kerberos method = dedicated keytab
passdb backend = ipasam:ldap://freeipa1.X
ldap://freeipa1.X
security = user
create krb5 conf = No
rpc_daemon:lsasd = fork
rpc_daemon:epmd = fork
rpc_server:tcpip = yes
rpc_server:netlogon = external
rpc_server:samr = external
rpc_server:lsasd = external
rpc_server:lsass = external
rpc_server:lsarpc = external
rpc_server:epmapper = external
ldapsam:trusted = yes
idmap config * : backend = tdb
idmap config * : range = 10000-999999
ldap binding_users dn = X
# 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 NETWORK]
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
# Scanner les fichiers à l'ouverture
virusfilter:scan on open = 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
-------------- next part --------------
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
More information about the samba
mailing list