大网数据广告活动
服务器运维问答

Sending a file to a remote clamd instance

· 52CE 我爱测

I may be misunderstanding how to utilize clamd. I've got a situation where I have a media server that isn't quite powerfull enough to scan files as well as host the other services it is running (raspberry pi). While I was looking…

问题原文

原帖链接 · BobserLuck · CC BY-SA 4.0

I may be misunderstanding how to utilize clamd. I've got a situation where I have a media server that isn't quite powerfull enough to scan files as well as host the other services it is running (raspberry pi). While I was looking through clamd.conf and man pages, it looks like there is an option to have clamd listen on a specified IP address and socket. Is there a way to stream files from a remote file server to another machine running clamd to be scanned?

I've also come accross this "remote clamd scanning" though it even points out in the code

You must be using a local socket to scan local files

(it also is designed to scan a single file at a time, rather than a directory which would be nice)

A similar question has been asked here though as sandroid was pointing out

Clamd sits and listens for instructions on what files need to be scanned, that is the communication it receives via TCP. We need to know how it accesses the mail files to be scanned...

So, is remote file scanning not supported by clamd? If not, what would be the best approach to scan remote files? I could rsync over the files temporarly and scan them or configure raspbian as a file server and mount it to the machine I am hosting the clamd service. If there are better recomendations, it would be much appreciated.

已采纳解答

原帖链接 · O.Caliari · CC BY-SA 4.0

I agree with jezzaaaa on the above answer, you can indeed configure the client/server accordingly with your needs. For example:

If you want a clamaV to be the server that will be doing the scanning and catch the infected files, here is the configuration for Ubuntu 20.04...

SERVER SIDE

# Install the 'daemon and freshclam'
sudo apt install -y clamav-daemon clamav-freshclam

Make it available for receiving the requests listen on port 3310 adding the option 'TCPSocket 3310' on '/etc/clamav/clamd.conf' file.

Done, the server is now listening and waiting for requests.

CLIENT SIDE

# Install the 'clamdscan', this will install other things, you can remove them
sudo apt install -y clamdscan

# Remove the extra from the client machine
sudo apt remove -y clamav-daemon clamav-freshclam

Add the option TCPAddr and TCPSocket (TCPAddr 1.2.3.4 TCPSocket 3310) and remove (LocalSocket) from the client on /etc/clamav/clamd.conf file.

Tests on client

~$ clamdscan -v ~/infected-file.txt
~$ clamdscan -v ~/document-file.pdf

If the server and the client machines can communicate over port 3310, the outputs should be recorded on the server machines where you have the clamav-daemon running.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-06-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。