Error - v25.7; Web Proxy > C-ICAP > ClamAV

Started by monateng, July 28, 2025, 08:21:25 PM

Previous topic - Next topic
Servus,
meine Firewall hat 32GB RAM. Als Version läuft derzeit die aktuelle 25.7

Wer hat mit dieser Version bereits ein ClamAV mit einem transparenten Proxy erfolgreich im Einsatz?



Wir wollen zentral auf der Firewall mit ClamAV uns vor bereits bekannten Viren schützen.

Habe dazu mehrere Anleitungen gesichtet.
- https://www.xinux.net/index.php/OPNsense_Transparenter_Proxy_Schritt_f%C3%BCr_Schritt
- https://www.zenarmor.com/docs/de/netzwerksicherheitstutorials/wie-aktiviert-man-den-virenschutz-in-opnsense


Anpassungen der conf Dateien habe ich nicht umgesetzt.
> /usr/local/etc/c-icap/c-icap.conf


Erhalte diese Meldung.
Critical   c-icap   main proc, WARNING: Can not check the used c-icap release to build service clamd_mod.so


Vielleicht ist ja auch meine Vorgehensweise fehlerhaft.

Quote from: monateng on July 28, 2025, 08:21:25 PMServus,
meine Firewall hat 32GB RAM. Als Version läuft derzeit die aktuelle 25.7

Wer hat mit dieser Version bereits ein ClamAV mit einem transparenten Proxy erfolgreich im Einsatz?



Wir wollen zentral auf der Firewall mit ClamAV uns vor bereits bekannten Viren schützen.

Habe dazu mehrere Anleitungen gesichtet.
- https://www.xinux.net/index.php/OPNsense_Transparenter_Proxy_Schritt_f%C3%BCr_Schritt
- https://www.zenarmor.com/docs/de/netzwerksicherheitstutorials/wie-aktiviert-man-den-virenschutz-in-opnsense


Anpassungen der conf Dateien habe ich nicht umgesetzt.
> /usr/local/etc/c-icap/c-icap.conf


Erhalte diese Meldung.
Critical   c-icap   main proc, WARNING: Can not check the used c-icap release to build service clamd_mod.so


Vielleicht ist ja auch meine Vorgehensweise fehlerhaft.

Die Meldung besagt folgendes:
Das Modul clamd_mod.so (für Virenscans über ICAP) nicht korrekt kompiliert oder nicht mit der installierten Version von c-icap kompatibel ist.

Warum , wieso usw. kann ich nicht sagen.

Vielen Dank @fw115,
auch bei der Neuinstallation habe ich den Fehler. Deshalb habe ich auch nur expliziet diese Zeile herausgenommen.

Hast Du eine Idee wie man dies (manuell) lösen kann?
> https://sourceforge.net/p/c-icap/news/2025/07/the-c-icap-064-is-released-/

July 30, 2025, 04:01:53 PM #3 Last Edit: July 30, 2025, 04:03:31 PM by fw115
Ohne Gewehr :)

Ab Version 0.6.4 von c-icap scheint es Änderungen an der Build-Struktur gegeben zu haben – besonders daran, wie sich Module über c-icap-config über die verwendete Version informieren.

Der Fehler:

Can not check the used c-icap release

heißt, dass das Modul clamd_mod versucht, die c-icap-Version per Skript oder Makro abzufragen, aber diese Information nicht verfügbar oder zugreifbar ist – möglicherweise durch:

    Änderungen in der neuen c-icap-config

    Entfernte oder geänderte Versionstags

    Nicht aktualisierte oder inkompatible Build-Skripte des clamd_mod Moduls


Möglichkeiten:

1. Patch oder Anpassung in clamd_mod

Wenn du nur eine Zeile entfernt hast, um das zu umgehen, handelt es sich vermutlich um diese typische Abfrage:

#if C_ICAP_VERSION >= SOME_VERSION

Oder ein Makro, das wie folgt eingebunden ist:

c-icap-config --version

>  Ersetze diese Prüfung durch eine manuelle Definition, z. B. in clamd_mod.c oder configure.ac:

#define C_ICAP_VERSION 0x000604  // entspricht Version 0.6.4

Oder passe configure so an, dass der Versionscheck übersprungen wird.
 2. Alternativ: c-icap 0.6.4 vollständig neu bauen mit clamd_mod

Falls clamd_mod nicht mit 0.6.4 kompatibel ist, gibt es zwei Wege:
 Möglichkeit A: Du baust c-icap 0.6.3 (oder älter), bei dem clamd_mod nachweislich funktioniert.
 Möglichkeit B: Du passt clamd_mod für 0.6.4 an. Dazu musst du:

Die Stelle im Code finden, die c-icap-config oder C_ICAP_VERSION aufruft.

Diese Bedingung anpassen oder absichern gegen fehlende Infos.

    Neu kompilieren:

    ./configure --with-c-icap=/usr/local
    make clean
    make
    sudo make install

August 02, 2025, 03:30:30 PM #4 Last Edit: August 02, 2025, 05:21:02 PM by monateng
Hi @fw115
vielen Dank für deine Erklärung. Leider habe gab es keine clamd_mod Datei mit dem Inhalt "*version*".

Auch ein weiteres Update heut hat keine Veränderung gebracht.

root@fw001x:~ # clamd --version
ClamAV 1.4.3/27720/Sat Aug  2 10:36:59 2025


root@fw001x:~ # c-icap-config --version
0.6.3


root@fw001x:~ # opnsense-version
OPNsense 25.7.1_1 (amd64)


Habe zur "Lösung" nun die mir bekannte Version wie folgt festgesetzt.

System > Firmware > Settings > Flavour >> "{OPNsense-release}/MINT/{OPNsense-Version}/latest/" > { Save }

System > Firmware > Status > { Check for updates }
Per Browser könnt Ihr den Pfad vorab Testen
> https://pkg.opnsense.org/releases/
>> >> https://pkg.opnsense.org/FreeBSD:{VERSION}:{ARCH}/{OPNsense-release}/MINT/{OPNsense-Version}/


Um den Fehler allerdings am Ende in der aktuellen Version zu eliminieren, habe ich keine Lösung.

Habe einen allgemeinen Leitfaden geschrieben.
Damit habe ich den Fehler zwischen den Paketen os-squid & os-cicap gelöst. Wobei os-squid noch immer ein "Segmentation fault" wirft.

Das Thema mit squid behandelt bereits das folgende Ticket:
> https://forum.opnsense.org/index.php?topic=47622.0 (Deutsch: June 15, 2025)
> https://forum.opnsense.org/index.php?topic=45502.0 (Englisch: January 30, 2025)

Lösung zu os-squid soll ein Update in Zukunft bringen: (https://github.com/opnsense/plugins/issues/4500)


---- Anleitung extra in Englisch
open Web Dashboard

[ Set OPNsense to old Version ]
System > Firmware > Settings
# advanced mode
# Flavour > (custom) > 25.1/MINT/25.1/latest/
# Reboot > [x] Always reboot after a successful update
{ Save }


[ Install ClamAV ]
System > Firmware > Plugins
# os-clamav
{ + }


System > Settings > Administration
### Secure Shell
# [x] Enable Secure Shell
# SSH Port
# Listen Interface
{ Save }


[ Fix it in CLI / SSH / Shell ]
> ssh USER@IP
# rm /var/db/clamav/freshclam.dat


[ Download initial signatures ]
#> freshclam


Go back to Web Dashboard
[ Enable and start clamAV-daemon ]
OPNsense > Services > ClamAV > Configuration

[x] Enable clamd Service
[x] Enable freshclam Service
{ Save }


[ Install CICAP ]
System > Firmware > Plugins
# os-c-icap
{ + }


Services > C-ICAP > Configuration > General
# [x] Enable c-icap service
{ Save }


Services > C-ICAP > Configuration > Antivirus
# [x] Enable ClamAV
# [x] Pass on error
{ Save }


[ Generate certificate ]
System > Trust > Authorities
{+}
[Create an internal Certificate Authority] Method
# Description
[SHA512] Digest Algorithm
[825] Lifetime (days)

# Description
# Country Code
# State or Province
# City
# Organization
# Organizational Unit
# Email Address
# Common Name




[ Install Squid / Web Proxy ]
System > Firmware > Plugins
# os-squid
{ + }


Services > Squid Web Proxy > Administration > General Proxy Settings
[x] Enable Proxy
[OPNsense] User error pages
{ Apply }


Services > Squid Web Proxy > Administration > Forward Proxy > General Forward Settings
[LAN] Proxy interfaces
[x] Enable Transparent HTTP Proxy
[x] Enable SSL inspection
# CA to use
{ Apply }


Services > Squid Web Proxy > Administration > Forward Proxy > ICAP Settings
[x] Enable ICAP
[icap://[::1]:1344/avscan] Request Modify URL
[icap://[::1]:1344/avscan] Response Modify URL
{ Apply }



#> REBOOT OPNsense


[ ADD Firewall Rule for HTTP ]
Services > Squid Web Proxy > Administration > Forward Proxy > General Forward Settings
[x] Enable Transparent HTTP Proxy
{i} Add a new Firewall rule
# Description I - HTTP > Squid > c-icap > ClamAV > WAN
{ Save }
{ Apply changes}


[ ADD Firewall Rule for HTTP ]
Services > Squid Web Proxy > Administration > Forward Proxy > General Forward Settings
[x] Enable SSL inspection
{i} Add a new Firewall rule
# Description I - HTTPs > Squid > c-icap > ClamAV > WAN
{ Save }
{ Apply changes}



[ Add CA to Windows 10/11 ]
>> https://learn.microsoft.com/de-de/biztalk/adapters-and-accelerators/accelerator-swift/adding-certificates-to-the-certificates-store-on-the-client


[ Add CA to your Browser ]
>> brave://certificate-manager/localcerts/usercerts
>> chrome://certificate-manager/localcerts/usercerts
>> edge://certificate-manager/localcerts/usercerts


[ Test Browsing ]
>> https://www.eicar.org/download-anti-malware-testfile/
>> https://secure.eicar.org/eicarcom2.zip
>> https://secure.eicar.org/eicar_com.zip
>> https://raw.githubusercontent.com/fire1ce/eicar-standard-antivirus-test-files/refs/heads/master/eicar-excel-dde-cmd-powershell-echo.xls
>> https://raw.githubusercontent.com/fire1ce/eicar-standard-antivirus-test-files/refs/heads/master/eicar-com.com
>> https://raw.githubusercontent.com/fire1ce/eicar-standard-antivirus-test-files/refs/heads/master/eicar-excel-macro-cmd-echo.xls
>> https://raw.githubusercontent.com/fire1ce/eicar-standard-antivirus-test-files/refs/heads/master/eicar-powerpoint-action-powershell-echo.ppt
>> https://raw.githubusercontent.com/fire1ce/eicar-standard-antivirus-test-files/refs/heads/master/eicar-word-macro-msgbox.doc


> https://forum.opnsense.org/index.php?topic=47622.0


[ Download BackUp ]
System > Configuration > Backups



#> REBOOT OPNsense

Check until reboot all Websites if they can be visited as normal and expected

System > Firmware > Settings
Update Version
> https://pkg.opnsense.org/

Das macht ja nur ein Rollback auf eine unsupportete potentiell unsichere OPNsense-Version, das ist doch keine Lösung. 25.1 bekommt keine Security-Updates mehr.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Verstehe das gerade nicht.

Was genau würde denn die aktuelle config daran hindern so mit der aktuellen Opnsense zu laufen ?

Brauchen würdest du:
Squid   
ClamAV + clamd   
c-icap + clamd_mod
SSL Inspection   (optional)

Was würde denn nicht laufen wenn du updatest oder übersehe ich hier was?

In der aktuellen Version schmiert der Squid wohl mit einem Segmentation Fault ab.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: Patrick M. Hausen on August 03, 2025, 11:15:07 PMIn der aktuellen Version schmiert der Squid wohl mit einem Segmentation Fault ab.

Ja, gerade  gelesen und geantwortet.

Dürfte wohl am einfachsten sein, im Squid auf UFS zu wechseln, bis die Fehler gefunden wurden.