[Pkg-clamav-devel] Bug#904327: clamav-freshclam: more specific error code to indicate failure
Martin-Éric Racine
martin-eric.racine at iki.fi
Mon Jul 23 11:55:30 BST 2018
Package: clamav-freshclam
Version: 0.100.0+dfsg-0+deb9u2
Severity: important
Related to bug #903896,
I cannot help but notice the content of the e-mail that is sent to the administrator:
XSubject: [voima] job cron-clamav-freshclam-clamav-0 failed
● cron-clamav-freshclam-clamav-0.service - [Cron] "36 */1 * * * clamav [ -x /usr/bin/freshclam ] && /usr/bin/freshclam --quiet >/dev/null"
Loaded: loaded (/etc/cron.d/clamav-freshclam; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-07-20 11:36:01 EEST; 36ms ago
Docs: man:systemd-crontab-generator(8)
Process: 7928 ExecStart=/bin/sh /run/systemd/generator/cron-clamav-freshclam-clamav-0.sh (code=exited, status=1/FAILURE)
Main PID: 7928 (code=exited, status=1/FAILURE)
heinä 20 11:36:01 voima systemd[1]: Starting [Cron] "36 */1 * * * clamav [ -x /usr/bin/freshclam ] && /usr/bin/freshclam --quiet >/dev/null"...
heinä 20 11:36:01 voima systemd[1]: cron-clamav-freshclam-clamav-0.service: Main process exited, code=exited, status=1/FAILURE
heinä 20 11:36:01 voima systemd[1]: Failed to start [Cron] "36 */1 * * * clamav [ -x /usr/bin/freshclam ] && /usr/bin/freshclam --quiet >/dev/null".
heinä 20 11:36:01 voima systemd[1]: cron-clamav-freshclam-clamav-0.service: Unit entered failed state.
heinä 20 11:36:01 voima systemd[1]: cron-clamav-freshclam-clamav-0.service: Triggering OnFailure= dependencies.
heinä 20 11:36:01 voima systemd[1]: cron-clamav-freshclam-clamav-0.service: Failed with result 'exit-code'.
Unless I missed something, this doesn't specify why the script failed. It would be desirable to include the exit code in the e-mail sent to the administrator.
What 'freshclam' prints is:
$ sudo freshclam
Mon Jul 23 13:49:54 2018 -> ClamAV update process started at Mon Jul 23 13:49:54 2018
Mon Jul 23 13:49:55 2018 -> ^Your ClamAV installation is OUTDATED!
Mon Jul 23 13:49:55 2018 -> ^Local version: 0.100.0 Recommended version: 0.100.1
Mon Jul 23 13:49:55 2018 -> DON'T PANIC! Read https://www.clamav.net/documents/upgrading-clamav
Mon Jul 23 13:49:55 2018 -> main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Mon Jul 23 13:49:55 2018 -> daily.cld is up to date (version: 24775, sigs: 2022226, f-level: 63, builder: neo)
Mon Jul 23 13:49:55 2018 -> bytecode.cld is up to date (version: 325, sigs: 90, f-level: 63, builder: neo)
Again, unless I missed something, freshclam doesn't have any error code to indicate that it succesfully fetched upgrades BUT there is a version mismatch. As far as I can tell, it exited with code 0 (update successful) but because it also printed that blob of text about the outdated version, systemd considers this cron job as failed.
-- Package-specific info:
--- configuration ---
Checking configuration files in /etc/clamav
Config file: clamd.conf
-----------------------
BlockMax disabled
PreludeEnable disabled
PreludeAnalyzerName = "ClamAV"
LogFile = "/var/log/clamav/clamav.log"
LogFileUnlock disabled
LogFileMaxSize = "4294967295"
LogTime = "yes"
LogClean disabled
LogSyslog disabled
LogFacility = "LOG_LOCAL6"
LogVerbose disabled
LogRotate = "yes"
ExtendedDetectionInfo = "yes"
PidFile disabled
TemporaryDirectory disabled
DatabaseDirectory = "/var/lib/clamav"
OfficialDatabaseOnly disabled
LocalSocket = "/var/run/clamav/clamd.ctl"
LocalSocketGroup = "clamav"
LocalSocketMode = "666"
FixStaleSocket = "yes"
TCPSocket disabled
TCPAddr disabled
MaxConnectionQueueLength = "15"
StreamMaxLength = "26214400"
StreamMinPort = "1024"
StreamMaxPort = "2048"
MaxThreads = "12"
ReadTimeout = "180"
CommandReadTimeout = "5"
SendBufTimeout = "200"
MaxQueue = "100"
IdleTimeout = "30"
ExcludePath disabled
MaxDirectoryRecursion = "15"
FollowDirectorySymlinks disabled
FollowFileSymlinks disabled
CrossFilesystems = "yes"
SelfCheck = "3600"
DisableCache disabled
VirusEvent disabled
ExitOnOOM disabled
AllowAllMatchScan = "yes"
Foreground disabled
Debug disabled
LeaveTemporaryFiles disabled
User = "clamav"
Bytecode = "yes"
BytecodeSecurity = "TrustSigned"
BytecodeTimeout = "60000"
BytecodeUnsigned disabled
BytecodeMode = "Auto"
DetectPUA disabled
ExcludePUA disabled
IncludePUA disabled
AlgorithmicDetection = "yes"
ScanPE = "yes"
ScanELF = "yes"
DetectBrokenExecutables disabled
ScanMail = "yes"
ScanPartialMessages disabled
PhishingSignatures = "yes"
PhishingScanURLs = "yes"
PhishingAlwaysBlockCloak disabled
PhishingAlwaysBlockSSLMismatch disabled
PartitionIntersection disabled
HeuristicScanPrecedence disabled
StructuredDataDetection disabled
StructuredMinCreditCardCount = "3"
StructuredMinSSNCount = "3"
StructuredSSNFormatNormal = "yes"
StructuredSSNFormatStripped disabled
ScanHTML = "yes"
ScanOLE2 = "yes"
OLE2BlockMacros disabled
ScanPDF = "yes"
ScanSWF = "yes"
ScanXMLDOCS = "yes"
ScanHWP3 = "yes"
ScanArchive = "yes"
ArchiveBlockEncrypted disabled
ForceToDisk 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 = "10000"
PCRERecMatchLimit = "5000"
PCREMaxFileSize = "26214400"
ScanOnAccess disabled
OnAccessMountPath disabled
OnAccessIncludePath disabled
OnAccessExcludePath disabled
OnAccessExcludeRootUID disabled
OnAccessExcludeUID disabled
OnAccessMaxFileSize = "5242880"
OnAccessDisableDDD disabled
OnAccessPrevention disabled
OnAccessExtraScanning disabled
DevACOnly disabled
DevACDepth disabled
DevPerformance disabled
DevLiblog disabled
DisableCertCheck disabled
Config file: freshclam.conf
---------------------------
LogFileMaxSize = "4294967295"
LogTime = "yes"
LogSyslog disabled
LogFacility = "LOG_LOCAL6"
LogVerbose disabled
LogRotate = "yes"
PidFile disabled
DatabaseDirectory = "/var/lib/clamav"
Foreground disabled
Debug disabled
UpdateLogFile = "/var/log/clamav/freshclam.log"
DatabaseOwner = "clamav"
Checks = "12"
DNSDatabaseInfo = "current.cvd.clamav.net"
DatabaseMirror = "db.local.clamav.net", "database.clamav.net"
PrivateMirror disabled
MaxAttempts = "5"
ScriptedUpdates = "yes"
TestDatabases = "yes"
CompressLocalDatabase disabled
ExtraDatabase disabled
DatabaseCustomURL disabled
HTTPProxyServer disabled
HTTPProxyPort disabled
HTTPProxyUsername disabled
HTTPProxyPassword disabled
HTTPUserAgent disabled
NotifyClamd = "/etc/clamav/clamd.conf"
OnUpdateExecute disabled
OnErrorExecute disabled
OnOutdatedExecute disabled
LocalIPAddress disabled
ConnectTimeout = "30"
ReceiveTimeout = "30"
SafeBrowsing disabled
Bytecode = "yes"
clamav-milter.conf not found
Software settings
-----------------
Version: 0.100.0
Optional features supported: MEMPOOL IPv6 FRESHCLAM_DNS_FIX AUTOIT_EA06 BZIP2 LIBXML2 PCRE ICONV JSON JIT
Database information
--------------------
Database directory: /var/lib/clamav
bytecode.cld: version 325, sigs: 90, built on Wed Jul 18 21:05:37 2018
main.cld: version 58, sigs: 4566249, built on Thu Jun 8 00:38:10 2017
daily.cld: version 24775, sigs: 2022226, built on Mon Jul 23 11:42:00 2018
Total number of signatures: 6588565
Platform information
--------------------
uname: Linux 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64
OS: linux-gnu, ARCH: x86_64, CPU: x86_64
Full OS version: Debian GNU/Linux 9.5 (stretch)
zlib version: 1.2.8 (1.2.8), compile flags: a9
Triple: x86_64-pc-linux-gnu
CPU: ivybridge, Little-endian
platform id: 0x0a215b5b0806030001060300
Build information
-----------------
GNU C: 6.3.0 20170516 (6.3.0)
GNU C++: 6.3.0 20170516 (6.3.0)
CPPFLAGS: -Wdate-time -D_FORTIFY_SOURCE=2
CFLAGS: -g -O2 -fdebug-prefix-map=/build/clamav-E1AVcn/clamav-0.100.0+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
CXXFLAGS: -g -O2 -fdebug-prefix-map=/build/clamav-E1AVcn/clamav-0.100.0+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_FILE_OFFSET_BITS=64
LDFLAGS: -Wl,-z,relro -Wl,-z,now -Wl,--as-needed
Configure: '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=/usr/include' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=/usr/lib/x86_64-linux-gnu' '--libexecdir=/usr/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/clamav-E1AVcn/clamav-0.100.0+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_FILE_OFFSET_BITS=64' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/clamav-E1AVcn/clamav-0.100.0+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_FILE_OFFSET_BITS=64' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now -Wl,--as-needed' '--with-dbdir=/var/lib/clamav' '--sysconfdir=/etc/clamav' '--disable-clamav' '--disable-unrar' '--enable-milter' '--enable-dns-fix' '--with-libjson' '--with-system-libmspack' '--with-libcurl=/usr' '--with-gnu-ld' '-with-system-llvm=/usr/bin/llvm-config' '--with-llvm-linking=dynamic' '--with-systemdsystemunitdir=/lib/systemd/system' 'build_alias=x86_64-linux-gnu'
sizeof(void*) = 8
Engine flevel: 91, dconf: 91
--- data dir ---
total 442692
-rw-r--r-- 1 clamav clamav 950272 Jul 18 21:36 bytecode.cld
-rw-r--r-- 1 clamav clamav 144851968 Jul 23 12:36 daily.cld
-rw-r--r-- 1 clamav clamav 307499008 Jun 8 2017 main.cld
-rw------- 1 clamav clamav 520 Jul 23 13:36 mirrors.dat
-- System Information:
Debian Release: 9.5
APT prefers stable
APT policy: (900, 'stable'), (500, 'stable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-7-amd64 (SMP w/8 CPU cores)
Locale: LANG=fi_FI.utf8, LC_CTYPE=fi_FI.utf8 (charmap=UTF-8), LANGUAGE=fi_FI.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages clamav-freshclam depends on:
ii clamav-base 0.100.0+dfsg-0+deb9u2
ii debconf [debconf-2.0] 1.5.61
ii dpkg 1.18.25
ii init-system-helpers 1.48
ii libc6 2.24-11+deb9u3
ii libclamav7 0.100.0+dfsg-0+deb9u2
ii libssl1.1 1.1.0f-3+deb9u2
ii logrotate 3.11.0-0.1
ii lsb-base 9.20161125
ii procps 2:3.3.12-3+deb9u1
ii ucf 3.0036
ii zlib1g 1:1.2.8.dfsg-5
clamav-freshclam recommends no packages.
Versions of packages clamav-freshclam suggests:
pn apparmor <none>
pn clamav-docs <none>
-- debconf information:
* clamav-freshclam/local_mirror: db.local.clamav.net
* clamav-freshclam/NotifyClamd: true
* clamav-freshclam/LogRotate: true
* clamav-freshclam/SafeBrowsing: false
* clamav-freshclam/update_interval: 24
* clamav-freshclam/http_proxy:
clamav-freshclam/proxy_user:
* clamav-freshclam/autoupdate_freshclam: cron
* clamav-freshclam/Bytecode: true
clamav-freshclam/internet_interface:
* clamav-freshclam/PrivateMirror:
More information about the Pkg-clamav-devel
mailing list