11import argparse
2+ import os
23import pathlib
34
45from nilrt_snac ._configs ._base_config import _BaseConfig
@@ -13,8 +14,8 @@ class _ClamAVConfig(_BaseConfig):
1314
1415 def __init__ (self ):
1516 super ().__init__ ("clamav" )
16- self .clamd_config_path = "/etc/clamav/ clamd.conf"
17- self .freshclam_config_path = "/etc/clamav/ freshclam.conf"
17+ self .clamd_config_path = "/etc/clamd.conf"
18+ self .freshclam_config_path = "/etc/freshclam.conf"
1819 self .virus_db_path = "/var/lib/clamav/"
1920 self .package_names = ["clamav" , "clamav-daemon" , "clamav-freshclam" ]
2021 self ._opkg_helper = opkg_helper
@@ -34,15 +35,20 @@ def verify(self, args: argparse.Namespace) -> bool:
3435 if installed_packages :
3536 print ("Verifying clamav configuration..." )
3637 valid = True
38+
39+ # Check DNS configuration (critical for freshclam)
40+ resolv_conf_path = "/var/run/resolv.conf"
41+ if not os .path .exists (resolv_conf_path ) or os .path .getsize (resolv_conf_path ) == 0 :
42+ logger .warning (f"DNS not configured: { resolv_conf_path } is empty or missing" )
43+ logger .warning ("freshclam will fail without DNS. Configure network/DNS before running freshclam." )
3744
38- # Check clamd configuration file
39- clamd_config = _ConfigFile (self .clamd_config_path )
40- if not clamd_config .exists ():
41- logger .error (f"ClamAV daemon config file missing: { self .clamd_config_path } " )
42- valid = False
43- elif pathlib .Path (self .clamd_config_path ).stat ().st_size == 0 :
44- logger .error (f"ClamAV daemon config file is empty: { self .clamd_config_path } " )
45- valid = False
45+ # Check clamd configuration file (only if daemon package is installed)
46+ if self ._opkg_helper .is_installed ("clamav-daemon" ):
47+ clamd_config = _ConfigFile (self .clamd_config_path )
48+ if not clamd_config .exists ():
49+ logger .warning (f"ClamAV daemon config file missing: { self .clamd_config_path } " )
50+ elif pathlib .Path (self .clamd_config_path ).stat ().st_size == 0 :
51+ logger .warning (f"ClamAV daemon config file is empty: { self .clamd_config_path } " )
4652
4753 # Check freshclam configuration file
4854 freshclam_config = _ConfigFile (self .freshclam_config_path )
0 commit comments