Servidor de actualizaciones de Clamav local

En este tutorial les mostraré como crear un servidor local de actualizaciones de Clamav. Clamav es el antivirus, digámoslo de alguna manera, por defecto de los sistemas GNU/Linux. Muy necesario a la hora de establecer un Servidor de Correo o Relay, el cual incluso se puede usar como filtro en conjunto con Squid para la navegación.

Entonces, vamos a lo que nos ocupa. Lo que haremos será montar en nuestra PC de repositorios, un script para descargarnos las actualizaciones, crearemos una entrada en el DNS para que apunte a la pc del repo, haremos un virtualhost en nginx y una tarea programada en el cron, para que ejecute la descarga todas las noches. Todo esto de manera sencilla y sin complicaciones.

Manos al asunto!

Creamos nuestros records en el DNS:

Directo:

Inverso:

Una ves hecho esto, nos logueamos en la pc del repo e instalamos/configuramos nginx:

nano /etc/nginx/conf.d/clamav.conf

Una vez hecho esto, guardamos y salimos.

Ahora en la consola:

Y reinicamos Nginx:

Ahora creamos el script que descargará las actualizaciones:

Y añadimos el siguiente contenido al script mirror_clamav.sh:

Listo!

Ahora la tarea en el cron:

Y el contenido:

Y reiniciamos el cron:

Y con eso, todos los días a las 11:58pm se descargará la actualización del clamav a nuestro server de repos.

Ahora sólo queda añadir o editar en nuestro archivo de configuración de clamav[freshclam.conf]:

Y con eso básicamente se resuelve el tema del clamav.

Adjunto a continuación un fichero con las configuraciones por si la necesitas, e incluso la plantilla de PMG. Cualquier duda, me lo dejan saber, en un comentario.

Espero les sirva y hasta la próxima.

 

¿De cuánta utilidad te ha parecido este contenido?

¡Haz clic en una estrella para puntuar!

Promedio de puntuación 4.9 / 5. Recuento de votos: 10

Hasta ahora, ¡no hay votos!. Sé el primero en puntuar este contenido.

4 comentarios


  1. Warning: Undefined array key 1 in /var/www/html/sysadminsdecuba/wp-content/plugins/wp-useragent/wp-useragent-detect-os.php on line 668
    Firefox 84.0 Firefox 84.0 Ubuntu x64 Ubuntu x64
    Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0

    A ver, no me refiero al scripts para realizar las descargas de los updates de clamav, eso me funciona, sino la config en el PMG para que actualice del mirror local, pues cuando le doy actualizar desde la Web muestra errores que no puede ser normal

    ClamAV update process started at Sun Feb 14 21:42:06 2021
    WARNING: DNS Update Info disabled. Falling back to HTTP mode.
    Reading CVD header (daily.cld): daily.cvd database is up to date (version: 25956, sigs: 4330724, f-level: 63, builder: raynman)
    Reading CVD header (main.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/main.cld
    Reading CVD header (main.cvd): main.cvd database is up to date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
    Reading CVD header (bytecode.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/bytecode.cld
    Reading CVD header (bytecode.cvd): bytecode.cvd database is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
    Reading CVD header (safebrowsing.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/safebrowsing.cld
    Reading CVD header (safebrowsing.cvd): safebrowsing.cvd database is up to date (version: 49191, sigs: 2213119, f-level: 63, builder: google)
    main.cvd is up to date (version: custom database)
    Testing database: ‘/var/lib/clamav//tmp.68396/clamav-852887d8b19fa5181064ebe2144a8edf.tmp-daily.cvd’ …
    WARNING: [LibClamAV] Can’t load /var/lib/clamav//tmp.68396/clamav-852887d8b19fa5181064ebe2144a8edf.tmp-daily.cvd: Can’t verify database integrity
    ERROR: Failed to load new database: Can’t verify database integrity
    WARNING: Database load exited with «Test failed» (8)
    ERROR: Database test FAILED.
    Unexpected error when attempting to update from custom database URL: http://clamav.pri.eicma.cu/daily.cvd
    WARNING: fc_download_url_databases: fc_download_url_database failed: Test failed (8)
    ERROR: Database update process failed: Test failed (8)
    ERROR: Update failed.
    TASK ERROR: command ‘/usr/bin/freshclam –stdout’ failed: exit code 8

    Te sucede esto a ti? Por otro lado. El script para descargar los update funciona, pero porque cuando llamo dicha url desde un navegador, la fecha de los archivos es tan atrasada? Lo mismo pasa cuando accedo a los update que están en jovenclub???

  2. SeaMonkey 2.53.5.1 SeaMonkey 2.53.5.1 GNU/Linux x64 GNU/Linux x64
    Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.5.1

    Por supuesto, /mnt/mirrors/clamav es en mi caso particular, modifiquen según su caso propio.

  3. SeaMonkey 2.53.5.1 SeaMonkey 2.53.5.1 GNU/Linux x64 GNU/Linux x64
    Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.5.1

    Acá funciona, pero recomiendo estas modificaciones del mirror_clamav.sh para mayor comodidad:

    #!/bin/bash

    SRC=http://clamavdb.c3sl.ufpr.br
    DST=/mnt/mirrors/clamav

    cd $DST; rm -rf *

    wget -c $SRC/main.cvd -P $DST
    wget -c $SRC/daily.cvd -P $DST
    wget -c $SRC/bytecode.cvd -P $DST
    wget -c $SRC/safebrowsing.cvd -P $DST

    chmod -R 755 $DST/*


  4. Warning: Undefined array key 1 in /var/www/html/sysadminsdecuba/wp-content/plugins/wp-useragent/wp-useragent-detect-os.php on line 668
    Firefox 84.0 Firefox 84.0 Ubuntu x64 Ubuntu x64
    Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0

    No me funciona, no me actualiza clamav en mi PMG, ni dandole actualizar desde la web de PMG, ni desde consola ejecutando el comando freshclam, obtengo estos errores:

    # /etc/init.d/clamav-freshclam stop
    [ ok ] Stopping clamav-freshclam (via systemctl): clamav-freshclam.service.
    root@mx1:/etc# freshclam
    ClamAV update process started at Mon Jan 18 16:52:27 2021
    WARNING: DNS Update Info disabled. Falling back to HTTP mode.
    Reading CVD header (daily.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/daily.cld
    Reading CVD header (daily.cvd): Time: 0.0s, ETA: 0.0s [=============================>] 512B/512B
    OK
    daily database available for update (local version: 25956, remote version: 26052)
    Time: 2.4s, ETA: 0.0s [=============================>] 105.92MiB/105.92MiB
    ERROR: getcvd: Verification: Can’t verify database integrity
    Trying again in 5 secs…
    Reading CVD header (daily.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/daily.cld
    Reading CVD header (daily.cvd): Time: 0.0s, ETA: 0.0s [=============================>] 512B/512B
    OK
    daily database available for update (local version: 25956, remote version: 26052)
    Time: 2.8s, ETA: 0.0s [=============================>] 105.92MiB/105.92MiB
    ERROR: getcvd: Verification: Can’t verify database integrity
    Trying again in 5 secs…
    Reading CVD header (daily.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/daily.cld
    Reading CVD header (daily.cvd): Time: 0.0s, ETA: 0.0s [=============================>] 512B/512B
    OK
    daily database available for update (local version: 25956, remote version: 26052)
    Time: 2.1s, ETA: 0.0s [=============================>] 105.92MiB/105.92MiB
    ERROR: getcvd: Verification: Can’t verify database integrity
    Trying again in 5 secs…
    Reading CVD header (daily.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/daily.cld
    Reading CVD header (daily.cvd): Time: 0.0s, ETA: 0.0s [=============================>] 512B/512B
    OK
    daily database available for update (local version: 25956, remote version: 26052)
    Time: 2.2s, ETA: 0.0s [=============================>] 105.92MiB/105.92MiB
    ERROR: getcvd: Verification: Can’t verify database integrity
    Trying again in 5 secs…
    Reading CVD header (daily.cld): WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/daily.cld
    Reading CVD header (daily.cvd): Time: 0.0s, ETA: 0.0s [=============================>] 512B/512B
    OK
    daily database available for update (local version: 25956, remote version: 26052)
    Time: 2.7s, ETA: 0.0s [=============================>] 105.92MiB/105.92MiB
    ERROR: getcvd: Verification: Can’t verify database integrity
    Giving up on http://clamav.pri.eicma.cu
    ERROR: Update failed for database: daily
    WARNING: fc_update_databases: fc_update_database failed: Invalid or corrupted CVD/CLD database (7)
    ERROR: Database update process failed: Invalid or corrupted CVD/CLD database (7)
    ERROR: Update failed.
    root@mx1:/etc# /etc/init.d/clamav-freshclam start
    [ ok ] Starting clamav-freshclam (via systemctl): clamav-freshclam.service.
    root@mx1:/etc#

    Veo esto:

    WARNING: remote_cvdhead: file not found: http://clamav.pri.eicma.cu/daily.cld

    porque buscar este archivo cuando deberia ser daily.cvd ??

Responder a Joe1962 Cancelar la respuesta

Tu dirección de correo electrónico no será publicada.


*