我正试图让OpenVAS按照下面的文章工作。
https://www.atlantic.net/community/howto/install-openvas-vulnerability-scanner-centos-7
然而,它不工作,当我运行openvas-check-setup我得到这个错误下面,当我检查/var/log/redis/redis.log它说:“打开Unix套接字:绑定:权限被拒绝”
openvas-check-setup 2.3.7 Test completeness and readiness of OpenVAS-8 (add '--v6' or '--v7' or '--v9' if you want to check for another OpenVAS version) Please report us any non-detected problems and help us to improve this check routine: http://lists.wald.intevation.org/mailman/listinfo/openvas-discuss Send us the log-file (/tmp/openvas-check-setup.log) to help analyze the problem. Use the parameter --server to skip checks for client tools like GSD and OpenVAS-CLI. Step 1: Checking OpenVAS Scanner ... OK: OpenVAS Scanner is present in version 5.0.7. OK: OpenVAS Scanner CA Certificate is present as /var/lib/openvas/CA/cacert.pem. OK: redis-server is present in version v=3.0.7. OK: scanner (kb_location setting) is configured properly using the redis-server socket: /tmp/redis.sock ERROR: redis-server is not running or not listening on socket: /tmp/redis.sock FIX: You should start the redis-server or configure it to listen on socket: /tmp/redis.sock ERROR: Your OpenVAS-8 installation is not yet complete!
恭喜,你find了一个糟糕的互联网教程。 看来,该教程的作者从来没有亲自testing过,看看它是否有效,因为它不工作。 更糟糕的是,这个教程看起来实际上与官方的OpenVAS网站有关,这个网站会误导很多人。
所以,redis无法启动的原因是因为SELinux拒绝redis-server写入/tmp 。 你可以在你的审计日志中看到这个:
type=AVC msg=audit(1482284806.464:112): avc: denied { write } for pid=1275 comm="redis-server" name="tmp" dev="dm-0" ino=33574981 scontext=system_u:system_r:redis_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir type=SYSCALL msg=audit(1482284806.464:112): arch=c000003e syscall=49 success=no exit=-13 a0=5 a1=7ffe55938670 a2=6e a3=7ffe55938614 items=0 ppid=1 pid=1275 auid=4294967295 uid=997 gid=995 euid=997 suid=997 fsuid=997 egid=995 sgid=995 fsgid=995 tty=(none) ses=4294967295 comm="redis-server" exe="/usr/bin/redis-server" subj=system_u:system_r:redis_t:s0 key=(null)
套接字文件应该位于/run/redis ,而不是/tmp ,例如:
unixsocket /run/redis/redis.sock
这允许它在SELinux强加的限制内运行。
在编辑/etc/redis.conf ,一定要检查文件的底部,以获取由openvas-setup添加的第二个 unixsocket指令,并将其作为冗余删除。
当然,通常在启用SELinux的系统上,redis应该configuration为侦听本地主机上的TCP端口,而不是使用套接字,因为其他守护进程可能不允许通过套接字与redis进行通信,而只能通过TCP进行通信。 OpenVAS并不是(但是)SELinux限制的,但它也不支持通过TCP联系Redis。 这样做的结果是,这个Redis安装不能与本地OpenVAS副本共享或重用。
但是这个教程有更多的错误!
第二件事是OpenVAS从来没有configuration过实际使用Redis的地方。 它依赖于默认编译,正如我们所看到的是错误的。 要解决这个问题,需要在/etc/openvas/openvassd.conf 设置一个configuration指令 ,本教程从未提及过:
kb_location = /run/redis/redis.sock
第三件事是它使用了第三方的repo(叫做atomic),它提供的软件包与普通软件仓库中的软件包相冲突,比如EPEL(已经提供了redis和OpenVAS)。 目前还不清楚为什么primefaces做到这一点,也不知道为什么本教程使用primefaces开始。 使用冲突软件包存在潜在的危险。 如果你继续使用primefaces包,你将需要绝对确定这个(虚拟)机器不会因为任何原因被用于其他任何事情。
最后,安装完成后,Web界面实际上不可访问,因为指定的端口未在防火墙中打开。 你也必须自己做。
firewall-cmd --add-port=9392/tcp # though this opens it to the world firewall-cmd --runtime-to-permanent
一旦你完成, openvas-check-setup应该说,除其他外…
OK: scanner (kb_location setting) is configured properly using the redis-server socket: /run/redis/redis.sock OK: redis-server is running and listening on socket: /run/redis/redis.sock. OK: redis-server configuration is OK and redis-server is running.
具有讽刺意味的是,它还会说:
ERROR: SELinux is enabled. For a working OpenVAS installation you need to disable it. FIX: Please disable SELinux.
这似乎是完全没有必要的,因为OpenVAS不会受到SELinux的限制。