Clamav+Squid (squidclam) addon (beta) [INACTIVE]

Here we discuss compilation and how to build an addon for BFW.

Clamav+Squid (squidclam) addon (beta)

Mensagempor cmartin » Sex Nov 07, 2008 2:17 pm

Ola!
Com eu tinha prometido, aqui vai o addon de varredura de virus squid+clamav

Nesse momento estou usando ele, num Athlon XP 2.4GHz, 512MB de RAM,
e o uso de CPU do daemon do clamav fica entre 2% somente com minha estação
navegando.

Segue abaixo a instalação dos addons:
NOTA: quem ja tem as libs SSL e CRYPTO nao precisa fazer o download!
Código: Selecionar todos
mt
wget http://www.polaco.pro.br/brazilfw/addons/clamav.tgz
wget http://www.polaco.pro.br/brazilfw/addons/sclam.tgz
wget http://www.polaco.pro.br/brazilfw/addons/curl.tgz
wget http://www.polaco.pro.br/brazilfw/addons/libssl.tgz
wget http://www.polaco.pro.br/brazilfw/addons/libcrypt.tgz
umt
reboot


Apos o BFW ter reiniciado e o Clamav baixado as atualizações das assinaturas, eh soh
criar um local temporário para o squidclam baixar os arquivos para o clamav analizar.
Criei um local temporario em memoria para melhor desempenho.

Código: Selecionar todos
mkdir /partition/squidclam
mount -t tmpfs -o size=64m squidclam /partition/squidclam


É necessario tambem fazer uma adaptacao na configuracao do squid.
Código: Selecionar todos
/etc/rc.d/pkgs/rc.squid stop
echo "redirect_program /usr/bin/squidclam" >> /usr/local/squid/etc/squid_4.tpl
echo "redirect_children 15" >> /usr/local/squid/etc/squid_4.tpl


E ainda faltam alguns "tweaks" para acertar permissoes.
Código: Selecionar todos
chown nobody.nogroup /partition/squidclam
chown nobody.nogroup /etc/squidclam.conf


Feito isso, levante o squid novamente, e de uma olhada nos logs para ver se o
squidclam levantou junto
Código: Selecionar todos
/etc/rc.d/pkgs/rc.squid start


Olhando os logs, ao levantar o squid, se o squidclam levantar corretamente, ele irá jogar no log
o seguinte:
Código: Selecionar todos
Nov  7 13:23:34 brazilfw user.notice root: Configuring Squid                                                                                   
Nov  7 13:23:34 brazilfw user.notice root: Disk Cache is Disabled                                                                             
Nov  7 13:23:34 brazilfw user.notice root: Squid running now!                                                                                 
Nov  7 13:23:34 brazilfw local4.notice squid[2264]: Squid Parent: child process 2268 started                                                   
Nov  7 13:23:34 brazilfw user.info syslog: squidclam starting up                                                                               
Nov  7 13:23:34 brazilfw user.info syslog: squidclam starting up                                                                               
Nov  7 13:23:34 brazilfw user.info syslog: squidclam starting up                                                                               
Nov  7 13:23:34 brazilfw user.info syslog: squidclam starting up                                                                               
Nov  7 13:23:34 brazilfw user.info syslog: squidclam starting up                                                                               


Ao detectar um arquivo infectado, o squidclam irá redirecionar a URL para uma mensagem de erro
de acesso negado do squid. Existem como redirectionar para outro endereço (http://127.0.0.1/antivir.php),
mas essa parte ainda nao cheguei a fazer, até porque o BFW nao tem suporte PHP por padrão.
pode ser desviado para outro server tbm, que ja rode Apache+PHP, e copiar o arquivo antivir.php que vem junto com o pacote do squidclam. (nao esta incluso no meu pacote!)

Nos logs ele registra tbm a detecção do virus:
Código: Selecionar todos
Nov  7 13:57:08 brazilfw user.warn syslog: INFECTED url=http://www.eicar.org/download/eicar.com virus=Eicar-Test-Signature src=192.168.75.65/- ident=- method=GET                                                                                                                             
Nov  7 13:57:12 brazilfw user.warn syslog: INFECTED url=http://www.eicar.org/download/eicar.com.txt virus=Eicar-Test-Signature src=192.168.75.65/- ident=- method=GET                                                                                                                         


olha o que eu achei tbm!
Código: Selecionar todos
Nov  7 13:33:57 brazilfw user.warn syslog: could not get (http://www.brazilfw.com.br/favicon.ico) error was (The requested URL returned error: 404)


BFW nao tem um favicon??

Boa sorte a quem for testar, e quem quiser complementar o addon tbm!!

[]'s
cmartin
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor parker » Seg Nov 10, 2008 10:47 am

Bom dia,

Pacotes instalados e funcionando !!!

Porém como resolvo isso?!!
E quando clico no LINK do squid no WEB ADMIN, não aparece mais nada, fica todo branco o conteúdo do link!! (configuraçoes do squid)

Nov 10 11:59:55 rae-gtw user.warn syslog: could not get (http://www.orkut.com/) error was (SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed)

Obrigado,
Avatar do usuário
parker
BFW Novice
 
Mensagens: 87
Registrado em: Qua Ago 31, 2005 9:50 pm
BrazilFW Box: A1

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor cmartin » Seg Nov 10, 2008 11:39 am

parker escreveu:Bom dia,

Pacotes instalados e funcionando !!!

Porém como resolvo isso?!!
E quando clico no LINK do squid no WEB ADMIN, não aparece mais nada, fica todo branco o conteúdo do link!! (configuraçoes do squid)

Nov 10 11:59:55 rae-gtw user.warn syslog: could not get (http://www.orkut.com/) error was (SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed)

Obrigado,


Eh um bug no source do squidclam. Eu ja tinha visto isso hehe, ainda bem que vc reportou, pq eu nao me lembrava mais :-)
Ele usa a libcurl pra baixar os arquivos dos sites pro clamav analizar, e por padrão o curl recusa o certificado SSL se não tiver assinado.

[]'s
cmartin
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor El guapo Dan » Ter Nov 11, 2008 10:00 pm

Muy bien CMartin, va a ser muy util :aplause: :aplause: :aplause:
El guapo Dan
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor nachazo » Qua Nov 12, 2008 5:02 pm

cool :o!
nachazo
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor parker » Qua Nov 12, 2008 11:00 pm

Toda vez q instalo o SCLAM funciona na boa até o segundo BOOT !!!

Creating rrdstats.tgz Please wait: Back-up of rrdstats complete
Creating rrdtool.tgz Please wait: Back-up of rrdtool complete
Creating samba.tgz Please wait: Back-up of samba complete
Creating sarg.tgz Please wait: Back-up of sarg complete
Creating sclam.tgz Please wait: Can't stat: No such file or directory
Back-up of sclam complete
Creating smart.tgz Please wait: Back-up of smart complete

Alguma sugestão?!! (Somente acontece com o pacote do SCLAM.TGZ)

Obrigado.
Avatar do usuário
parker
BFW Novice
 
Mensagens: 87
Registrado em: Qua Ago 31, 2005 9:50 pm
BrazilFW Box: A1

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor luapufo » Qui Nov 13, 2008 6:39 am

parker escreveu:Toda vez q instalo o SCLAM funciona na boa até o segundo BOOT !!!

Creating rrdstats.tgz Please wait: Back-up of rrdstats complete
Creating rrdtool.tgz Please wait: Back-up of rrdtool complete
Creating samba.tgz Please wait: Back-up of samba complete
Creating sarg.tgz Please wait: Back-up of sarg complete
Creating sclam.tgz Please wait: Can't stat: No such file or directory
Back-up of sclam complete
Creating smart.tgz Please wait: Back-up of smart complete

Alguma sugestão?!! (Somente acontece com o pacote do SCLAM.TGZ)

Obrigado.

entre no seu BFW e copie o pacote etc.tgz para sua maquina e depos desmonte ele e veja se dentro de /etc/ tem o arquivo squidclam.conf
luapufo
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor gamba47 » Ter Nov 18, 2008 4:28 pm

Hi Cmartin!

i´m trying to install your addon, but i have this problem in my logs

Código: Selecionar todos
Nov 18 16:15:08 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:08 squid user.info syslog: squidclam starting up
Nov 18 16:15:08 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:08 squid local4.alert squid[8387]: The url_rewriter helpers are crashing too rapidly, need help!
Nov 18 16:15:08 squid local4.notice squid[8044]: Squid Parent: child process 8387 exited due to signal 6
Nov 18 16:15:08 squid local4.alert squid[8044]: Exiting due to repeated, frequent failures
Nov 18 16:15:08 squid user.info syslog: squidclam starting up
Nov 18 16:15:08 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:09 squid user.info syslog: squidclam starting up
Nov 18 16:15:09 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:09 squid user.info syslog: squidclam starting up
Nov 18 16:15:09 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:09 squid user.info syslog: squidclam starting up


I follow all the steps but i have a few questions:

1. libcrypt.tgz is equal libcrypto.tgz ? This lib already exist!

2. when i put those lines
Código: Selecionar todos
mkdir /partition/squidclam
mount -t tmpfs -o size=64m squidclam /partition/squidclam

everithing look ok when i hit a "df -h" but when i restart i lost the second line of the config


I have the same problem with those lines:
Código: Selecionar todos
chown nobody.nogroup /partition/squidclam
chown nobody.nogroup /etc/squidclam.conf


3.
Olhando os logs, ao levantar o squid, se o squidclam levantar corretamente, ele irá jogar no log

Where is this log ?


Thanks in advance, this is a good and interesting work. Congrats!

gamba47
Avatar do usuário
gamba47
BFW Beneméritos
 
Mensagens: 7243
Registrado em: Ter Dez 27, 2005 1:51 pm
Localização: Buenos Aires, Argentina
BrazilFW Box: Pentium4 1256mb RAM HD 200gb
BrazilFW 3.0.237 without Squid
3 ADSLs & 1 Cablemodem
50 Users & more!

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor cmartin » Qui Nov 20, 2008 8:27 am

Hi Cmartin!

i´m trying to install your addon, but i have this problem in my logs

Código: Selecionar todos
Nov 18 16:15:08 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:08 squid user.info syslog: squidclam starting up
Nov 18 16:15:08 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:08 squid local4.alert squid[8387]: The url_rewriter helpers are crashing too rapidly, need help!
Nov 18 16:15:08 squid local4.notice squid[8044]: Squid Parent: child process 8387 exited due to signal 6
Nov 18 16:15:08 squid local4.alert squid[8044]: Exiting due to repeated, frequent failures
Nov 18 16:15:08 squid user.info syslog: squidclam starting up
Nov 18 16:15:08 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:09 squid user.info syslog: squidclam starting up
Nov 18 16:15:09 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:09 squid user.info syslog: squidclam starting up
Nov 18 16:15:09 squid user.err syslog: Could not get tempfile handle for template /partition/squidclam/squidclam-XXXXXXXX. Read `man mkstemp`
Nov 18 16:15:09 squid user.info syslog: squidclam starting up


It is related to file permissions. SquidClam could not write into that folder.


I follow all the steps but i have a few questions:

1. libcrypt.tgz is equal libcrypto.tgz ? This lib already exist!

Yup, its the same package :D


2. when i put those lines
Código: Selecionar todos
mkdir /partition/squidclam
mount -t tmpfs -o size=64m squidclam /partition/squidclam

everithing look ok when i hit a "df -h" but when i restart i lost the second line of the config

Its a temporary storage method. When you reboot, it loses everything. This will be handled by a startup
script, and will be created automatically when BFW starts up


I have the same problem with those lines:
Código: Selecionar todos
chown nobody.nogroup /partition/squidclam
chown nobody.nogroup /etc/squidclam.conf


Código: Selecionar todos
3.  [quote]Olhando os logs, ao levantar o squid, se o squidclam levantar corretamente, ele irá jogar no log[/quote]
Where is this log ?


It uses BFW logging system. type logread on the console, and it will dump t.

Thanks in advance, this is a good and interesting work. Congrats!

gamba47
cmartin
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor gamba47 » Qui Nov 20, 2008 3:58 pm

It is related to file permissions. SquidClam could not write into that folder.



What is the solution for this ?? i make every step in your Howto !

Many thanks. gamba47
Avatar do usuário
gamba47
BFW Beneméritos
 
Mensagens: 7243
Registrado em: Ter Dez 27, 2005 1:51 pm
Localização: Buenos Aires, Argentina
BrazilFW Box: Pentium4 1256mb RAM HD 200gb
BrazilFW 3.0.237 without Squid
3 ADSLs & 1 Cablemodem
50 Users & more!

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor gamba47 » Sex Nov 21, 2008 3:19 pm

Hi cmartin, i create a new file called rc.sclam trying to fix the problem of the nobody when we reboot.

File:
/etc/rc.d/pkgs/rc.sclam (the name is becouse we need this first rc.squid )
Código: Selecionar todos
#!/bin/sh
# Script de inicializacion de ClamAV + Squid
# Creacion de la particion temporal
mount -t tmpfs -o size=64m squidclam /partition/squidclam
# Damos permisos a nobody
chown nobody.nogroup /partition/squidclam


Then you can backup this new file with sclam.tgz .

You only need to do this:

Código: Selecionar todos
#echo "/etc/rc.d/pkgs/rc.sclam" >> /var/lib/lrpkg/sclam.list

and

#backup sclam

Reboot & try again

gamba47
Avatar do usuário
gamba47
BFW Beneméritos
 
Mensagens: 7243
Registrado em: Ter Dez 27, 2005 1:51 pm
Localização: Buenos Aires, Argentina
BrazilFW Box: Pentium4 1256mb RAM HD 200gb
BrazilFW 3.0.237 without Squid
3 ADSLs & 1 Cablemodem
50 Users & more!

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor cmartin » Sáb Nov 22, 2008 8:34 am

This addon is not complete yet. sorry about being so confuse to setup.

[]'s
cmartin
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor gamba47 » Sáb Nov 22, 2008 8:18 pm

OK Cmartin, don´t worry

I try but with no success.

Thanks for your effort.

gamba47
Avatar do usuário
gamba47
BFW Beneméritos
 
Mensagens: 7243
Registrado em: Ter Dez 27, 2005 1:51 pm
Localização: Buenos Aires, Argentina
BrazilFW Box: Pentium4 1256mb RAM HD 200gb
BrazilFW 3.0.237 without Squid
3 ADSLs & 1 Cablemodem
50 Users & more!

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor parker » Qua Mai 20, 2009 2:16 pm

Pergunta:
Como liberar acesso aos sites com certificados não assinados??
Ex: http://www.orkut.com (não abre)!!

Obrigado!
Avatar do usuário
parker
BFW Novice
 
Mensagens: 87
Registrado em: Qua Ago 31, 2005 9:50 pm
BrazilFW Box: A1

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor cmartin » Qua Mai 20, 2009 11:14 pm

parker escreveu:Pergunta:
Como liberar acesso aos sites com certificados não assinados??
Ex: http://www.orkut.com (não abre)!!

Obrigado!



Cara, isso eh um bug do cURL. eu tive que fazer um patch no source do projeto, mas acabei perdendo :D
o ideal seria nao passar requisicoes HTTPS por ele.

[]'s
cmartin
 

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor parker » Qui Mai 21, 2009 12:05 pm

OK, aceito a sugetão !!!
Como proceder para isto acontecer?!!!

Obrigado,
Avatar do usuário
parker
BFW Novice
 
Mensagens: 87
Registrado em: Qua Ago 31, 2005 9:50 pm
BrazilFW Box: A1

Re: Clamav+Squid (squidclam) addon (beta)

Mensagempor jrluft » Seg Set 14, 2009 12:05 pm

Pessoal, bom dia.
Tirando o post da cova, alguem está conseguindo instalar e utilizar o clamav normalmente?
Instalei mas tive que criar umas pastas e setar privilegios para nobody manualmente. É assim mesmo?
Mesmo assim, entrei em sites para baixar arquivos com virus para teste e não tive mensagens de alerta.
Um antivirus para o bfw seria interessante visto que tem muitos sites com virus nas proprias paginas.

Abraço!
Wilmar
jrluft
 


Voltar para Add-On Factory

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 4 visitantes

cron