在树莓派ubuntu18.04系统上安装openvas
前言
OpenVAS是开放式漏洞评估系统,也可以说它是一个包含着相关工具的网络扫描器。其核心部件是一个服务器,包括一套网络漏洞测试程序,可以检测远程系统和应用程序中的安全问题。
其架构如下图所示:
用户需要一种自动测试的方法,并确保正在运行一种最恰当的最新测试。OpenVAS包括一个中央服务器和一个图形化的前端。这个服务器准许用户运行 几种不同的网络漏洞测试(以Nessus攻击脚本语言编写),而且OpenVAS可以经常对其进行更新。OpenVAS所有的代码都符合GPL规范。
建立架构
OpenVAS是一个客户端/服务器架构,它由几个组件组成。在服务器上(仅限于Linux),用户需要四个程序包:
OpenVAS-Server: 实现基本的扫描功能
OpenVAS-Plugins: 一套网络漏洞测试程序
OpenVAS-LibNASL 和OpenVAS-Libraries: 实现服务器功能所需要的组件而在客户端上(Windows或Linux均可),用户仅需要OpenVAS客户端。
本文主要介绍在树莓派ubuntu 18.04系统上安装openvas。
一、树莓派上安装好ubuntu18.04
请自行安装。
二、安装步骤
1.更新树莓派的系统,使用ssh连接树莓派
代码如下(示例):
# apt clean
# apt-get update
# apt-get upgrade
# apt autoremove
# reboot
2.重启后开始安装openvas
代码如下(示例):
# apt-get install openvas
# openvas-setup //初始化环境,耗费很长时间,耐心等待
初始化完成后提示以下错误:
3.排错
检查错误:
检查redis-server
# sudo systemctl daemon-reload
# sudo systemctl enable redis-server
# sudo systemctl restart redis.service
#service redis-server status
redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; disabled;
vendor preset: enabled) Active: active (running) since Thu 2020-01-23 08:16:37 CST; 2min 58s ago Docs: http://redis.io/documentation, man:redis-server(1) Process: 23552 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS) Main PID: 23569 (redis-server) Tasks: 4 (limit: 2126) CGroup: /system.slice/redis-server.service
└─23569 /usr/bin/redis-server 127.0.0.1:6379 Jan 23 08:16:37 VM-0-15-ubuntu systemd[1]: Starting Advanced key-value store... Jan 23 08:16:37 VM-0-15-ubuntu systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file Jan 23 08:16:37 VM-0-15-ubuntu systemd[1]: Started Advanced key-value store.
提示:报错
redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file
解决方法如下:
# vi /etc/systemd/system/redis.service #debian/ubuntu
在[Service]下新增一行
ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/redis/redis.pid"
[Service]
Type=forking
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
ExecStop=/bin/kill -s TERM $MAINPID
ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/redis/redis.pid"
随后重启服务:
sudo systemctl daemon-reload
sudo systemctl enable redis-server
sudo systemctl restart redis.service
报错消失:
-> # service redis-server status
● redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled;
vendor preset: enabled) Active: active (running) since Thu 2020-01-23 09:03:12 CST; 4s ago Docs: http://redis.io/documentation, man:redis-server(1)
Process: 14002 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS) Process: 14024 ExecStartPost=/bin/sh -c echo $MAINPID > /var/run/redis/redis.pid (code=exited, status=0/SUCCESS)
Process: 14006 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS) Main PID: 14023 (redis-server) Tasks: 4 (limit: 1108) CGroup: /system.slice/redis-server.service └─14023 /usr/bin/redis-server *:34343 Jan 23 09:03:12 VM-0-17-ubuntu systemd[1]: Stopped Advanced key-value store. Jan 23 09:03:12 VM-0-17-ubuntu systemd[1]: Starting Advanced key-value store... Jan 23 09:03:12 VM-0-17-ubuntu systemd[1]: Started Advanced key-value store.
下面进行安装检查:
# openvas-check-setup --v9
提示:
两步,否则不起作用:
root@ipanel-desktop:/var/lib# openvassd
root@ipanel-desktop:/var/lib# openvasmd --rebuild //等待很长时间
继续检查:
root@ipanel-desktop:/var/lib# openvas-check-setup --v9
检查结果显示正常了。
4.添加用户名密码
# openvasmd --user=admin --new-password=admin
5.添加支持外部访问,OpenVAS 在默认配置下,仅允许 127.0.0.1 地址本地连接
# cd /lib/systemd/system/
# vi greenbone-security-assistant.service
修改 --listen=127.0.0.1 为 --listen=0.0.0.0
6.重启服务
# systemctl daemon-reload
#openvas-stop
#openvas-start
#netstat -antp | grep 9392
7.web访问 https:// serverip:9392
用户名/密码:admin/admin (是第4步骤添加的)
总结
至此,openvas安装完成。安装的是v9,目前最新版本是11.