CentOS 7
Ads

Pure-FTPd + Clamav
2014/09/30
 
Configure Pure-FTPd + Clamav to scan virus timely via FTP connection.
[1]
[2] Configure Pure-FTPd.
[root@www ~]#
vi /etc/pure-ftpd/pure-ftpd.conf
# line 368: uncomment

CallUploadScript   yes
[root@www ~]#
vi /usr/local/bin/pure-ftpd_clamscan.sh
# create new

#!/bin/bash

/usr/bin/clamscan --remove --quiet --no-summary "$1"

[root@www ~]#
chmod 755 /usr/local/bin/pure-ftpd_clamscan.sh
[root@www ~]#
vi /etc/systemd/system/clamav.pure-ftpd.service
# create new

[Unit]
Description=Clamav Scanning Service for Pure-FTPd
Before=pure-ftpd.service

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/usr/sbin/pure-uploadscript -B -r /usr/local/bin/pure-ftpd_clamscan.sh

[Install]
WantedBy=multi-user.target

[root@www ~]#
systemctl --system daemon-reload

[root@www ~]#
systemctl restart clamav.pure-ftpd pure-ftpd

[root@www ~]#
systemctl enable clamav.pure-ftpd

[3]
Upload a test virus to the server via FTP to make sure the setting works normally. Virus will be uploaded but it will be removed immediately.
 
Tweet