Skip to content

Commit 7855e41

Browse files
chore: Update clamav 1 4 6 (#1947)
* chore: Update ClamAV to version 1.4.6 and adjust configurations * feat: Add run.sh to stream ClamAV logs to stdout and update configuration files * fix: make the configmap the source of truth this change makes the helm's configmap the source of truth while still working locally with docker run testing * chore: bump version for clamav chart
1 parent a1d68d2 commit 7855e41

7 files changed

Lines changed: 87 additions & 55 deletions

File tree

clamav/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM registry.access.redhat.com/ubi9/ubi
2-
ARG VERSION=1.4.5
2+
ARG VERSION=1.4.6
33

4-
LABEL name="ubi8-clamav" \
4+
LABEL name="ubi9-clamav" \
55
vendor="Red Hat" \
66
version="${VERSION}" \
77
release="1" \
@@ -25,6 +25,10 @@ RUN chmod -R ug+rwx /opt/app-root/src
2525
COPY clamdcheck.sh /opt/app-root
2626
RUN chmod ug+rwx /opt/app-root/clamdcheck.sh
2727

28+
# copy launcher script that tails log files to stdout
29+
COPY run.sh /opt/app-root/run.sh
30+
RUN chmod ug+rwx /opt/app-root/run.sh
31+
2832
# # To fix check permissions error for clamAV
2933
RUN mkdir /var/log/clamav
3034
RUN touch /var/log/clamav/clamav.log
@@ -38,4 +42,4 @@ USER 1001
3842

3943
EXPOSE 3310
4044

41-
CMD freshclam && clamd
45+
CMD ["/opt/app-root/run.sh"]

clamav/charts/clamav/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: clamav
33
description: Chart for deploying a Clam AV on kubernetes
44
type: application
5-
version: 1.0.0
6-
appVersion: 1.0.5
5+
version: 1.0.1
6+
appVersion: 1.4.6
77
keywords:
88
- clamav
99
maintainers:

clamav/charts/clamav/templates/configmap.yaml

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ data:
1919
# LogFile must be writable for the user running daemon.
2020
# A full path is required.
2121
# Default: disabled
22-
LogFile /dev/stdout
22+
# /dev/stdout is NOT used here: clamd's log-open logic fails to resolve
23+
# it through OpenShift/CRI-O's symlink chain ("Too many levels of
24+
# symbolic links"), crashing the container on startup. run.sh tails
25+
# this file to stdout instead so logs remain visible in `oc logs`.
26+
LogFile /var/log/clamav/clamav.log
2327
2428
# By default the log file is locked for writing - the lock protects against
2529
# running clamd multiple times (if want to run another clamd, please
@@ -380,70 +384,70 @@ data:
380384
#
381385
# Default: no
382386
#HeuristicScanPrecedence yes
383-
384-
387+
388+
385389
##
386390
## Data Loss Prevention (DLP)
387391
##
388-
392+
389393
# Enable the DLP module
390394
# Default: No
391395
#StructuredDataDetection yes
392-
396+
393397
# This option sets the lowest number of Credit Card numbers found in a file
394398
# to generate a detect.
395399
# Default: 3
396400
#StructuredMinCreditCardCount 5
397-
401+
398402
# This option sets the lowest number of Social Security Numbers found
399403
# in a file to generate a detect.
400404
# Default: 3
401405
#StructuredMinSSNCount 5
402-
406+
403407
# With this option enabled the DLP module will search for valid
404408
# SSNs formatted as xxx-yy-zzzz
405409
# Default: yes
406410
#StructuredSSNFormatNormal yes
407-
411+
408412
# With this option enabled the DLP module will search for valid
409413
# SSNs formatted as xxxyyzzzz
410414
# Default: no
411415
#StructuredSSNFormatStripped yes
412-
413-
416+
417+
414418
##
415419
## HTML
416420
##
417-
421+
418422
# Perform HTML normalisation and decryption of MS Script Encoder code.
419423
# Default: yes
420424
# If you turn off this option, the original files will still be scanned, but
421425
# without additional processing.
422426
#ScanHTML yes
423-
424-
427+
428+
425429
##
426430
## Archives
427431
##
428-
432+
429433
# ClamAV can scan within archives and compressed files.
430434
# If you turn off this option, the original files will still be scanned, but
431435
# without unpacking and additional processing.
432436
# Default: yes
433437
#ScanArchive yes
434-
438+
435439
# Mark encrypted archives as viruses (Encrypted.Zip, Encrypted.RAR).
436440
# Default: no
437441
#ArchiveBlockEncrypted no
438-
439-
442+
443+
440444
##
441445
## Limits
442446
##
443-
447+
444448
# The options below protect your system against Denial of Service attacks
445449
# using archive bombs.
446-
450+
447451
# This option sets the maximum amount of data to be scanned for each input file.
448452
# Archives and other containers are recursively extracted and scanned up to this
449453
# value.
@@ -452,7 +456,7 @@ data:
452456
# to the system.
453457
# Default: 100M
454458
#MaxScanSize 150M
455-
459+
456460
# Files larger than this limit won't be scanned. Affects the input file itself
457461
# as well as files contained inside it (when the input file is an archive, a
458462
# document or some other kind of container).
@@ -461,113 +465,113 @@ data:
461465
# to the system.
462466
# Default: 25M
463467
MaxFileSize {{.Values.clamav.limits.fileSize}}M
464-
468+
465469
# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR
466470
# file, all files within it will also be scanned. This options specifies how
467471
# deeply the process should be continued.
468472
# Note: setting this limit too high may result in severe damage to the system.
469473
# Default: 16
470474
#MaxRecursion 10
471-
475+
472476
# Number of files to be scanned within an archive, a document, or any other
473477
# container file.
474478
# Value of 0 disables the limit.
475479
# Note: disabling this limit or setting it too high may result in severe damage
476480
# to the system.
477481
# Default: 10000
478482
#MaxFiles 15000
479-
483+
480484
# Maximum size of a file to check for embedded PE. Files larger than this value
481485
# will skip the additional analysis step.
482486
# Note: disabling this limit or setting it too high may result in severe damage
483487
# to the system.
484488
# Default: 10M
485489
#MaxEmbeddedPE 10M
486-
490+
487491
# Maximum size of a HTML file to normalize. HTML files larger than this value
488492
# will not be normalized or scanned.
489493
# Note: disabling this limit or setting it too high may result in severe damage
490494
# to the system.
491495
# Default: 10M
492496
#MaxHTMLNormalize 10M
493-
497+
494498
# Maximum size of a normalized HTML file to scan. HTML files larger than this
495499
# value after normalization will not be scanned.
496500
# Note: disabling this limit or setting it too high may result in severe damage
497501
# to the system.
498502
# Default: 2M
499503
#MaxHTMLNoTags 2M
500-
504+
501505
# Maximum size of a script file to normalize. Script content larger than this
502506
# value will not be normalized or scanned.
503507
# Note: disabling this limit or setting it too high may result in severe damage
504508
# to the system.
505509
# Default: 5M
506510
#MaxScriptNormalize 5M
507-
511+
508512
# Maximum size of a ZIP file to reanalyze type recognition. ZIP files larger
509513
# than this value will skip the step to potentially reanalyze as PE.
510514
# Note: disabling this limit or setting it too high may result in severe damage
511515
# to the system.
512516
# Default: 1M
513517
#MaxZipTypeRcg 1M
514-
518+
515519
# This option sets the maximum number of partitions of a raw disk image to be scanned.
516520
# Raw disk images with more partitions than this value will have up to the value number
517521
# partitions scanned. Negative values are not allowed.
518522
# Note: setting this limit too high may result in severe damage or impact performance.
519523
# Default: 50
520524
#MaxPartitions 128
521-
525+
522526
# This option sets the maximum number of icons within a PE to be scanned.
523527
# PE files with more icons than this value will have up to the value number icons scanned.
524528
# Negative values are not allowed.
525529
# WARNING: setting this limit too high may result in severe damage or impact performance.
526530
# Default: 100
527531
#MaxIconsPE 200
528-
532+
529533
##
530534
## On-access Scan Settings
531535
##
532-
536+
533537
# Enable on-access scanning. Currently, this is supported via fanotify.
534538
# Clamuko/Dazuko support has been deprecated.
535539
# Default: no
536540
#ScanOnAccess yes
537-
541+
538542
# Don't scan files larger than OnAccessMaxFileSize
539543
# Value of 0 disables the limit.
540544
# Default: 5M
541545
#OnAccessMaxFileSize 10M
542-
546+
543547
# Set the include paths (all files inside them will be scanned). You can have
544548
# multiple OnAccessIncludePath directives but each directory must be added
545549
# in a separate line. (On-access scan only)
546550
# Default: disabled
547551
#OnAccessIncludePath /home
548552
#OnAccessIncludePath /students
549-
553+
550554
# Set the exclude paths. All subdirectories are also excluded.
551555
# (On-access scan only)
552556
# Default: disabled
553557
#OnAccessExcludePath /home/bofh
554-
558+
555559
# With this option you can whitelist specific UIDs. Processes with these UIDs
556560
# will be able to access all files.
557561
# This option can be used multiple times (one per line).
558562
# Default: disabled
559563
#OnAccessExcludeUID 0
560-
561-
564+
565+
562566
##
563567
## Bytecode
564568
##
565-
569+
566570
# With this option enabled ClamAV will load bytecode from the database.
567571
# It is highly recommended you keep this option on, otherwise you'll miss detections for many new viruses.
568572
# Default: yes
569573
#Bytecode yes
570-
574+
571575
# Bytecode mode
572576
#
573577
# This option has been set to 'ForceInterpreter' in Fedora due to
@@ -577,7 +581,7 @@ data:
577581
#
578582
# Default: ForceInterpreter
579583
#ByteCodeMode ForceInterpreter
580-
584+
581585
# Set bytecode security level.
582586
# Possible values:
583587
# None - no security at all, meant for debugging. DO NOT USE THIS ON PRODUCTION SYSTEMS
@@ -591,34 +595,33 @@ data:
591595
#
592596
# Default: TrustSigned
593597
#BytecodeSecurity TrustSigned
594-
598+
595599
# Set bytecode timeout in miliseconds.
596600
#
597601
# Default: 5000
598602
# BytecodeTimeout 1000
599-
603+
600604
##
601605
## Statistics gathering and submitting
602606
##
603-
607+
604608
# Enable statistical reporting.
605609
# Default: no
606610
#StatsEnabled yes
607-
611+
608612
# Disable submission of individual PE sections for files flagged as malware.
609613
# Default: no
610614
#StatsPEDisabled yes
611-
615+
612616
# HostID in the form of an UUID to use when submitting statistical information.
613617
# Default: auto
614618
#StatsHostID auto
615-
619+
616620
# Time in seconds to wait for the stats server to come back with a response
617621
# Default: 10
618622
#StatsTimeout 10
619623
TCPSocket 3310
620624
621-
622625
freshclam.conf: |
623626
##
624627
## Example config file for freshclam
@@ -635,7 +638,8 @@ data:
635638
636639
# Path to the log file (make sure it has proper permissions)
637640
# Default: disabled
638-
#UpdateLogFile /dev/stdout
641+
# /dev/stdout is NOT used here, see clamd.conf's LogFile comment.
642+
UpdateLogFile /var/log/clamav/freshclam.log
639643
640644
# Maximum size of the log file.
641645
# Value of 0 disables the limit.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
nsp:
22
environment: dev
3+
4+
clamav:
5+
# always re-pull :latest so helm upgrade can't reuse a stale cached image on the node
6+
imagePullPolicy: Always

clamav/config/clamd.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
# LogFile must be writable for the user running daemon.
1111
# A full path is required.
1212
# Default: disabled
13-
LogFile /dev/stdout
13+
# /dev/stdout is NOT used here: clamd's log-open logic fails to resolve
14+
# it through OpenShift/CRI-O's symlink chain ("Too many levels of
15+
# symbolic links"), crashing the container on startup. run.sh tails
16+
# this file to stdout instead so logs remain visible in `oc logs`.
17+
LogFile /var/log/clamav/clamav.log
1418

1519
# By default the log file is locked for writing - the lock protects against
1620
# running clamd multiple times (if want to run another clamd, please

clamav/config/freshclam.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ DatabaseDirectory /opt/app-root/src
1313

1414
# Path to the log file (make sure it has proper permissions)
1515
# Default: disabled
16-
#UpdateLogFile /dev/stdout
16+
# /dev/stdout is NOT used here, see clamd.conf's LogFile comment.
17+
UpdateLogFile /var/log/clamav/freshclam.log
1718

1819
# Maximum size of the log file.
1920
# Value of 0 disables the limit.

clamav/run.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Stream clamd/freshclam log files to stdout so they still show up in `oc logs`,
5+
# since writing directly to /dev/stdout crashes clamd (see clamd.conf).
6+
tail -F /var/log/clamav/clamav.log /var/log/clamav/freshclam.log &
7+
8+
# Prefer Helm-mounted configs when present; fallback to image defaults for local runs.
9+
CLAMD_CONF=/etc/clamd.conf
10+
FRESHCLAM_CONF=/etc/freshclam.conf
11+
[ -f "$CLAMD_CONF" ] || CLAMD_CONF=/usr/local/etc/clamd.conf
12+
[ -f "$FRESHCLAM_CONF" ] || FRESHCLAM_CONF=/usr/local/etc/freshclam.conf
13+
14+
freshclam --config-file="$FRESHCLAM_CONF"
15+
exec clamd --config-file="$CLAMD_CONF"

0 commit comments

Comments
 (0)