Author Topic: Amavis Integration Deamon Timeout  (Read 7284 times)

0 Members and 1 Guest are viewing this topic.

Offline ba123

  • Newbie
  • *
  • Posts: 11
Amavis Integration Deamon Timeout
« on: March 10, 2010, 01:04:03 PM »
Hello,

I'm trieing to integrate avast into my amavis to scan my mails.

Therefore I've added following lines in my primary virus scanner section of my amavisd.conf:

Code: [Select]
['avast! Antivirus daemon',
     \&ask_daemon,        # greets with 220, terminate with QUIT
     ["SCAN {}\015\012QUIT\015\012", '/var/run/avast4/mailscanner.sock'],
     qr/\t\[\+\]/, qr/\t\[L\]\t/, qr/\t\[L\]\t([^[ \t\015\012]+)/ ],

As secondary scanner avastlite is configured which works fine.

When a mail arrives it tries to use the primary scanner first, of course. As you can see in the following avastd logfile snippet, he successfully scans the parts of the mail (in this example, there are 2 parts). After scanning, actually the QUIT command should be issued to end the connection to the deamon and bring back the control to amavis. Unfortunatley, the avast deamon always timeouts as you can see in the 4. line of the log snippet. As a result, he uses the secondary scanner (I guess).

Code: [Select]
Mar 10 12:14:33 avastd[30134]: info: new avast! socket connection at /var/run/avast4/mailscanner.sock
Mar 10 12:14:33 avastd[30134]: info: mailscanner[30138]: /var/lib/amavis/amavis-20100310T115102-00344/parts/part-00001 [+]
Mar 10 12:14:33 avastd[30134]: info: mailscanner[30138]: /var/lib/amavis/amavis-20100310T115102-00344/parts/part-00002 [+]
Mar 10 12:15:03 avastd[30134]: info: avastserverpeer: connection timeouted
Mar 10 12:15:03 avastd[30134]: info: closing avast! connection

The timeout is set to 30 seconds in the avastd.conf - which ends up in an delay of 30 seconds of the mail delivery. The gap can also be seen in the log snippet above. I've had set the timeout to 300 seconds before with the same results (300 sec delay & timeout) so I don't think the deamon is still busy.

I am using version 3.0.1 i586 of the avast server.

Any ideas what could be the problem?
« Last Edit: March 10, 2010, 01:11:24 PM by ba123 »

Offline zilog

  • Avast team
  • Advanced Poster
  • *
  • Posts: 957
  • or #f0; daa; add a,#a0; adc a,#40
Re: Amavis Integration Deamon Timeout
« Reply #1 on: March 11, 2010, 02:10:17 PM »
Hello,

I'm trieing to integrate avast into my amavis to scan my mails.

Therefore I've added following lines in my primary virus scanner section of my amavisd.conf:

Code: [Select]
['avast! Antivirus daemon',
     \&ask_daemon,        # greets with 220, terminate with QUIT
     ["SCAN {}\015\012QUIT\015\012", '/var/run/avast4/mailscanner.sock'],
     qr/\t\[\+\]/, qr/\t\[L\]\t/, qr/\t\[L\]\t([^[ \t\015\012]+)/ ],

As secondary scanner avastlite is configured which works fine.

When a mail arrives it tries to use the primary scanner first, of course. As you can see in the following avastd logfile snippet, he successfully scans the parts of the mail (in this example, there are 2 parts). After scanning, actually the QUIT command should be issued to end the connection to the deamon and bring back the control to amavis. Unfortunatley, the avast deamon always timeouts as you can see in the 4. line of the log snippet. As a result, he uses the secondary scanner (I guess).

Code: [Select]
Mar 10 12:14:33 avastd[30134]: info: new avast! socket connection at /var/run/avast4/mailscanner.sock
Mar 10 12:14:33 avastd[30134]: info: mailscanner[30138]: /var/lib/amavis/amavis-20100310T115102-00344/parts/part-00001 [+]
Mar 10 12:14:33 avastd[30134]: info: mailscanner[30138]: /var/lib/amavis/amavis-20100310T115102-00344/parts/part-00002 [+]
Mar 10 12:15:03 avastd[30134]: info: avastserverpeer: connection timeouted
Mar 10 12:15:03 avastd[30134]: info: closing avast! connection

The timeout is set to 30 seconds in the avastd.conf - which ends up in an delay of 30 seconds of the mail delivery. The gap can also be seen in the log snippet above. I've had set the timeout to 300 seconds before with the same results (300 sec delay & timeout) so I don't think the deamon is still busy.

I am using version 3.0.1 i586 of the avast server.

Any ideas what could be the problem?

Hallo,
just connect to the socket manually (using telnet) - works everything as expected? If so (as assumed),
try to run instead of avastd netcat, on the same port - and check what does amavis send there - probably some garbage-prefixed QUIT, which isn't taken as valid command.

regards,
pc
May's Law: Software efficiency halves every 18 months, compensating Moore's Law. (David May, INMOS)

Offline ba123

  • Newbie
  • *
  • Posts: 11
Re: Amavis Integration Deamon Timeout
« Reply #2 on: March 12, 2010, 09:05:17 AM »
Ahoj,

thanks for your answer.

I am actually using a socket file: /var/run/avast4/mailscanner.sock

So I'm not sure if I can connect to it via telnet or some other unix command that easily. Do you know an way to communicate with that socket?

Offline zilog

  • Avast team
  • Advanced Poster
  • *
  • Posts: 957
  • or #f0; daa; add a,#a0; adc a,#40
Re: Amavis Integration Deamon Timeout
« Reply #3 on: March 17, 2010, 01:34:10 PM »
Ahoj,

thanks for your answer.

I am actually using a socket file: /var/run/avast4/mailscanner.sock

So I'm not sure if I can connect to it via telnet or some other unix command that easily. Do you know an way to communicate with that socket?


You can just modify the avastd.conf, and open a tcp port instead of the local UNIX socket - and connect using telnet or netcat there.

regards,
pc
May's Law: Software efficiency halves every 18 months, compensating Moore's Law. (David May, INMOS)