【发布时间】:2019-11-14 12:01:04
【问题描述】:
我的操作系统:Centos 7,使用 laravel 5.8,php 7.1:
我在:https://github.com/kissit/php-clamav-scan 使用 Clamav.php 扫描文件的病毒:
改变socket文件的设置:
private $clamd_sock = "/var/run/clamd.scan/clamd.sock";
这是我在 laravel 中的简单代码:
$clamav = new Clamav();
echo "Testing a bad file...\n";
if($clamav->scan("/var/www/html/test/storage/logs/clamav_test.txt")) {
echo "YAY, file is safe!\n";
} else {
echo "BOO, file is a virus. Message: " . $clamav->getMessage() . "\n";
}
我已经通过 url 在 centos 7 上安装 clamav:https://www.hostinger.com/tutorials/how-to-install-clamav-centos7
我有设置:
sudo setsebool -P daemons_enable_cluster_mode 1
并将用户 apache 添加到 clamscan 组
sudo usermod -a -G clamscan apache
我检查了存在的文件套接字:
[root@ip-172-31-2-17 centos]# ls -l /var/run/clamd.scan/
total 0
srw-rw-rw-. 1 clamscan clamscan 0 Sep 19 20:49 clamd.sock
但出现错误:
如何解决这个问题?
【问题讨论】:
-
你不应该将 www-data 用户添加到 clamscan
-
可以解决这个问题吗?