Author Topic: How to use Clamd to scan uploaded files  (Read 5755 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to use Clamd to scan uploaded files
« on: March 02, 2018, 04:04:51 PM »
I disabled the postfix service because email for all domians hosted on CWP is handled by another server.

However, I would like to use ClamAV to scan files that are uploaded via some Perl web apps. I enabled and started 'clamd-scan.service' and 'clamd@scan.service'.

The scripts are not working and when I test via command line (e.g., clamdscan /home/jeff/public_html/uploads/eicar_com.zip), I get the following error:

Code: [Select]
ERROR: Could not connect to clamd on 127.0.0.1: Connection refused

----------- SCAN SUMMARY -----------
Infected files: 0
Total errors: 1
Time: 0.011 sec (0 m 0 s)

I also tried enabling and starting 'amavisd.service' but I got the same error when testing.

Not sure what to look at next. Anyone have any ideas?

Offline
*
Re: How to use Clamd to scan uploaded files
« Reply #1 on: March 04, 2018, 12:13:20 AM »
I tried the following and it works:
Code: [Select]
clamscan /home/jeff/public_html/upload/eicar_com.zip

So why does clamdscan  /home/jeff/public_html/upload/eicar_com.zip throw the connection refused error?

This is what I get when I run this command...
Code: [Select]
[root@cwp ~]# ps -aux | grep clamd
amavis   11012  0.0 14.4 717996 559656 ?       Ssl  09:40   0:22 /usr/sbin/clamd -c /etc/clamd.d/amavisd.conf --foreground=yes
root     20789  0.0  0.0 112660   980 pts/0    R+   18:50   0:00 grep --color=auto clamd
... so it appears that clamd is  running.