How to configure ClamAntivirusScannerImpl
How to configure ClamAntivirusScannerImpl
https://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=74795857
2024-03-28T20:21:04Z
2024-03-28T20:21:04Z
How to configure ClamAntivirusScannerImpl
Shimmura Isao
https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=74795856
2016-06-01T05:16:51Z
2016-06-01T05:16:51Z
<html><head></head><body>Hello,<br><br>I'd like to use ClamAntivirusScannerImpl to scan virus when I upload a file to Liferay Control Panel,<br>http://XX.XXX.XXX.XX:28080/group/control_panel/manage. <br>But I couldn't do this properly. <br>I'd like to know how to debug this, and how to connect Liferay and ClamAV .<br><br>I tried to do this on both local PCs and Linux server, but it didn't work properly.<br><br>●On my PCs<br>(Win8.1Pro C:/XXX/liferay-portal-6.2-ce-ga6/tomcat-7.0.62 / Win10 64bit C:/liferay-portal-6.2-ce-ga6/tomcat-7.0.62), <br>I ran liferay-portal-tomcat-6.2-ce-ga6 on liferay-ide-eclipse-windows-x64-2.2.4-ga5 and jdk-7u79-windows-x64.exe, <br>and hen I uploaded a random files, I was able to invoke ClamAntivirusScannerImpl,<br>and I saw the message, "Unable to scan file for viruses. ".<br>But I couldn't find any evidence that ClamAntivirusScannerImpl called ClamAV properly.<br>I used clamav-0.99-x64.msi to install ClamAV. It worked properly itself by calling the program from cmd.<br><br>●On our Linux server<br>I built the environment below, but I don't think that I was able to invoke ClamAntivirusScannerImpl,<br>since I could't see the same message above.<br><br><pre><code>[root@liferay-server ~]# cat /proc/version
Linux version 2.6.32-573.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Thu Jul 23 15:44:03 UTC 2015</code></pre><br><br>Liferay Portal:<br>/usr/local/liferay-portal-6.2-ce-ga2<br>(jboss bundle version)<br><br><pre><code>[root@liferay-server ~]# cat /usr/local/liferay-portal-6.2-ce-ga2/portal-ext.properties
dl.store.antivirus.enabled=true
dl.store.antivirus.impl=com.liferay.portlet.documentlibrary.antivirus.ClamAntivirusScannerImpl</code></pre><br><br><pre><code>[root@liferay-server yum.repos.d]# rpm -qliv clamav
Name : clamav Relocations: (not relocatable)
Version : 0.99.1 Vendor: Fedora Project
Release : 1.el6 Build Date: 2016年03月30日 07時21分50秒
Install Date: 2016年05月31日 17時23分34秒 Build Host: buildvm-26.phx2.fedoraproject.org
Group : Applications/System Source RPM: clamav-0.99.1-1.el6.src.rpm
Size : 3851455 License: GPLv2
Signature : RSA/8, 2016年03月31日 01時56分48秒, Key ID 3b49df2a0608b895
Packager : Fedora Project
URL : http://www.clamav.net/
Summary : Anti-virus software
Description :
Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The main purpose of
this software is the integration with mail servers (attachment scanning).
The package provides a flexible and scalable multi-threaded daemon, a
command line scanner, and a tool for automatic updating via Internet.
The programs are based on a shared library distributed with the Clam
AntiVirus package, which you can use with your own software. Most
importantly, the virus database is kept up to date
-rw-r--r-- 1 root root 8560 3月 30 07:21 /etc/freshclam.conf
-rwxr-xr-x 1 root root 90536 3月 30 07:21 /usr/bin/clambc
-rwxr-xr-x 1 root root 122392 3月 30 07:21 /usr/bin/clamscan
-rwxr-xr-x 1 root root 93416 3月 30 07:21 /usr/bin/clamsubmit
-rwxr-xr-x 1 root root 164240 3月 30 07:21 /usr/bin/freshclam
-rwxr-xr-x 1 root root 167856 3月 30 07:21 /usr/bin/sigtool
lrwxrwxrwx 1 root root 18 3月 30 07:21 /usr/lib64/libclamav.so.7 -&gt; libclamav.so.7.1.1
-rwxr-xr-x 1 root root 1840600 3月 30 07:21 /usr/lib64/libclamav.so.7.1.1
drwxr-xr-x 2 root root 0 3月 30 07:21 /usr/share/doc/clamav-0.99.1
-rw-r--r-- 1 root root 3203 12月 12 01:26 /usr/share/doc/clamav-0.99.1/AUTHORS
-rw-r--r-- 1 root root 24 12月 12 01:26 /usr/share/doc/clamav-0.99.1/BUGS
-rw-r--r-- 1 root root 18738 12月 12 01:26 /usr/share/doc/clamav-0.99.1/COPYING
-rw-r--r-- 1 root root 759894 2月 25 08:48 /usr/share/doc/clamav-0.99.1/ChangeLog
-rw-r--r-- 1 root root 61 12月 12 01:26 /usr/share/doc/clamav-0.99.1/FAQ
-rw-r--r-- 1 root root 9416 12月 12 01:26 /usr/share/doc/clamav-0.99.1/INSTALL
-rw-r--r-- 1 root root 428 2月 25 07:22 /usr/share/doc/clamav-0.99.1/NEWS
-rw-r--r-- 1 root root 100864 2月 25 07:22 /usr/share/doc/clamav-0.99.1/README
-rw-r--r-- 1 root root 221679 2月 4 03:48 /usr/share/doc/clamav-0.99.1/clamdoc.pdf
-rw-r--r-- 1 root root 8560 3月 30 07:20 /usr/share/doc/clamav-0.99.1/freshclam.conf
-rw-r--r-- 1 root root 103999 12月 12 01:26 /usr/share/doc/clamav-0.99.1/phishsigs_howto.pdf
-rw-r--r-- 1 root root 124749 12月 12 01:26 /usr/share/doc/clamav-0.99.1/signatures.pdf
-rw-r--r-- 1 root root 4085 3月 30 07:21 /usr/share/man/man1/clamscan.1.gz
-rw-r--r-- 1 root root 450 3月 30 07:21 /usr/share/man/man1/clamsubmit.1.gz
-rw-r--r-- 1 root root 2168 3月 30 07:21 /usr/share/man/man1/freshclam.1.gz
-rw-r--r-- 1 root root 1710 3月 30 07:21 /usr/share/man/man1/sigtool.1.gz
-rw-r--r-- 1 root root 3827 3月 30 07:21 /usr/share/man/man5/freshclam.conf.5.gz</code></pre><br><br><pre><code>[root@liferay-server ~]# rpm -qliv clamd
Name : clamd Relocations: (not relocatable)
Version : 0.99.1 Vendor: Fedora Project
Release : 1.el6 Build Date: 2016年03月30日 07時21分50秒
Install Date: 2016年05月31日 17時47分09秒 Build Host: buildvm-26.phx2.fedoraproject.org
Group : System Environment/Daemons Source RPM: clamav-0.99.1-1.el6.src.rpm
Size : 664456 License: GPLv2
Signature : RSA/8, 2016年03月31日 01時56分24秒, Key ID 3b49df2a0608b895
Packager : Fedora Project
URL : http://www.clamav.net/
Summary : The Clam AntiVirus Daemon
Description :
The Clam AntiVirus Daemon
-rw-r--r-- 1 root root 21898 3月 30 07:21 /etc/clamd.conf
drwxr-xr-x 2 root root 0 3月 30 07:21 /etc/clamd.d
-rw-r--r-- 1 root root 185 3月 30 07:21 /etc/logrotate.d/clamav
-rwxr-xr-x 1 root root 1206 3月 30 07:17 /etc/rc.d/init.d/clamd
-rwxr-xr-x 1 root root 93280 3月 30 07:21 /usr/bin/clamconf
-rwxr-xr-x 1 root root 174248 3月 30 07:21 /usr/bin/clamdscan
-rwxr-xr-x 1 root root 173832 3月 30 07:21 /usr/bin/clamdtop
-rwxr-xr-x 1 root root 159744 3月 30 07:21 /usr/sbin/clamd
-rw-r--r-- 1 root root 1932 3月 14 2011 /usr/share/clamav/README.clamd-wrapper
-rwxr-xr-x 1 root root 2086 7月 14 2011 /usr/share/clamav/clamd-wrapper
drwxr-xr-x 2 clam clam 0 3月 30 07:21 /usr/share/doc/clamd-0.99.1
-rw-r--r-- 1 clam clam 21898 3月 30 07:20 /usr/share/doc/clamd-0.99.1/clamd.conf
-rw-r--r-- 1 root root 658 3月 30 07:21 /usr/share/man/man1/clambc.1.gz
-rw-r--r-- 1 root root 495 3月 30 07:21 /usr/share/man/man1/clamconf.1.gz
-rw-r--r-- 1 root root 1449 3月 30 07:21 /usr/share/man/man1/clamdscan.1.gz
-rw-r--r-- 1 root root 2258 3月 30 07:21 /usr/share/man/man1/clamdtop.1.gz
-rw-r--r-- 1 root root 6701 3月 30 07:21 /usr/share/man/man5/clamd.conf.5.gz
-rw-r--r-- 1 root root 2586 3月 30 07:21 /usr/share/man/man8/clamd.8.gz
drwxr-xr-x 2 clam clam 0 3月 30 07:21 /var/lib/clamav
drwxr-xr-x 2 clam clam 0 3月 30 07:21 /var/log/clamav
-rw-r--r-- 1 clam clam 0 3月 30 07:21 /var/log/clamav/clamd.log
drwxr-xr-x 2 clam clam 0 3月 30 07:21 /var/run/clamav</code></pre><br><br><pre><code>[root@liferay-server ~]# netstat -lnp |grep 3310
tcp 0 0 127.0.0.1:3310 0.0.0.0:* LISTEN 18771/clamd</code></pre><br><br>●What I tried else<br>I looked into package the src of com.liferay.portlet.documentlibrary.antivirus<br>to search for the setting key items, such as host and port to listen the Java API request.<br>But I could't find any practical items in it.<br><br>I grepped "3310" recursively toward all the Liferay home path of my PCs and the Linux server, but<br>I couldn't find any related information.<br><br>Thank you in advance,<br>Isao</body><