{"id":654,"date":"2013-03-13T13:23:01","date_gmt":"2013-03-13T06:23:01","guid":{"rendered":"http:\/\/whplus.com\/blog\/?p=654"},"modified":"2013-03-21T10:32:02","modified_gmt":"2013-03-21T03:32:02","slug":"integrate-pure-ftpd-with-clamav-on-cpanel-server","status":"publish","type":"post","link":"https:\/\/www.whplus.com\/blog\/2013\/03\/13\/integrate-pure-ftpd-with-clamav-on-cpanel-server.html","title":{"rendered":"Integrate pure-ftpd with clamav on cpanel server"},"content":{"rendered":"<p>Clamav can work in conjunction with pure-ftpd to not allow virus\u2019s to be uploaded. Here are the steps. First install Clamav. In the example below clamav is installed in \/usr\/local\/bin but your set up may have it in \/usr\/bin<\/p>\n<p><strong>\/etc\/pure-ftpd.conf<\/strong><br \/>\nEdit \/etc\/pure-ftpd.conf and set<\/p>\n<blockquote><p><span style=\"color: #008000;\">CallUploadScript yes<\/span><\/p><\/blockquote>\n<p><strong>\/etc\/init.d\/pure-ftpd<\/strong><\/p>\n<p>Edit \/etc\/init.d\/pure-ftpd<\/p>\n<p>Look for <strong>$DAEMONIZE $fullpath \/etc\/pure-ftpd.conf -O clf:\/var\/log\/xferlog $OPTIONS &#8211;daemonize<\/strong><\/p>\n<p>Under this add<\/p>\n<blockquote><p><span style=\"color: #008000;\">$DAEMONIZE \/usr\/sbin\/pure-uploadscript -B -r \/etc\/pure-ftpd\/clamscan.sh<\/span><\/p><\/blockquote>\n<p>Next look for <strong>kill $(cat \/var\/run\/pure-ftpd.pid)<\/strong><br \/>\n<!--more--><br \/>\nUnder this add<\/p>\n<blockquote><p><span style=\"color: #008000;\">kill $(cat \/var\/run\/pure-ftpd\/pure-uploadscript.pid)<\/span><\/p><\/blockquote>\n<p><strong>\/etc\/pure-ftpd\/clamscan.sh<\/strong><\/p>\n<p>create new file named \/etc\/pure-ftpd\/clamscan.sh<\/p>\n<blockquote><p><span style=\"color: #008000;\">#!\/bin\/sh<\/span><\/p>\n<p><span style=\"color: #008000;\"># \/usr\/local\/bin\/clamdscan is faster if clamd is running<\/span><br \/>\n<span style=\"color: #008000;\"> CLAMLOC=&#8217;\/usr\/local\/bin\/clamscan&#8217;;<\/span><\/p>\n<p><span style=\"color: #008000;\">if [ ! -x $CLAMLOC ]; then<\/span><br \/>\n<span style=\"color: #008000;\"> echo &#8216;clamscan not found&#8217;;<\/span><br \/>\n<span style=\"color: #008000;\"> exit;<\/span><br \/>\n<span style=\"color: #008000;\"> fi<\/span><br \/>\n<span style=\"color: #008000;\"> if [ &#8220;$1&#8221; = &#8220;&#8221; ]; then<\/span><br \/>\n<span style=\"color: #008000;\"> echo &#8216;Variable is blank&#8217;;<\/span><br \/>\n<span style=\"color: #008000;\"> exit;<\/span><br \/>\n<span style=\"color: #008000;\"> fi<\/span><br \/>\n<span style=\"color: #008000;\"> if [ ! -f &#8220;$1&#8221; ]; then<\/span><br \/>\n<span style=\"color: #008000;\"> echo &#8220;$1 file not found&#8221;<\/span><br \/>\n<span style=\"color: #008000;\"> exit;<\/span><br \/>\n<span style=\"color: #008000;\"> fi<\/span><\/p>\n<p><span style=\"color: #008000;\"># maybe you would prefer &#8211;move=\/DIRECTORY instead of remove<\/span><br \/>\n<span style=\"color: #008000;\"> $CLAMLOC &#8211;remove $1<\/span><\/p><\/blockquote>\n<p>and then chmod to 755<\/p>\n<p>The above calles &#8211;remove. This will of course delete the file if its detected as a virus. You may want to instead use &#8211;move<\/p>\n<p>&#8211;move=DIRECTORY<br \/>\nMove infected files into DIRECTORY. Directory must be writable<br \/>\nfor the &#8216;clamav&#8217; user or unprivileged user running clamscan.<\/p>\n<p><strong>Restart FTP<\/strong><\/p>\n<blockquote><p><span style=\"color: #008000;\">\/etc\/init.d\/pure-ftpd restart<\/span><\/p><\/blockquote>\n<p><strong>Testing<\/strong><\/p>\n<p>Upload the EICAR test file to test if clamav is working<\/p>\n<blockquote><p><span style=\"color: #008000;\">X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*<\/span><\/p><\/blockquote>\n<p>Source: http:\/\/wiki.cpaneldirect.net\/wiki\/index.php?title=Integrate_pure-ftpd_with_clamav<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Clamav can work in conjunction with pure-ftpd to not allow virus\u2019s to be uploaded. Here are the steps. First install Clamav. In the example below clamav is installed in \/usr\/local\/bin but your set up may have it in \/usr\/bin \/etc\/pure-ftpd.conf Edit \/etc\/pure-ftpd.conf and set CallUploadScript yes \/etc\/init.d\/pure-ftpd Edit \/etc\/init.d\/pure-ftpd Look for $DAEMONIZE $fullpath \/etc\/pure-ftpd.conf -O\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.whplus.com\/blog\/2013\/03\/13\/integrate-pure-ftpd-with-clamav-on-cpanel-server.html\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-654","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/comments?post=654"}],"version-history":[{"count":2,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/654\/revisions"}],"predecessor-version":[{"id":660,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/654\/revisions\/660"}],"wp:attachment":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/media?parent=654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/categories?post=654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/tags?post=654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}