重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

ubuntu14.04编译安装openvas8

去年在centos 6.4上面yum装了openvas,结果扫描的时候,客户端经常挂掉,囧。openvas对centos的支持很不好,在centos 6.4重新yum又安装不上了,编译也是各种依赖需要export。终于还是放弃了centos 6.4,在ubuntu上编译安装。

创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于成都网站建设、网站设计、八宿网络推广、成都微信小程序、八宿网络营销、八宿企业策划、八宿品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供八宿建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com

一、准备工作

1. 系统环境

root@bob-Openvas:~# lsb_release -a

Ubuntu 14.04.4 LTS

2.安装依赖包

root@bob-Openvas:~# apt-get update

root@bob-Openvas:~# apt-get install openssh-server

root@bob-Openvas:~# apt-get install lrzsz

root@bob-Openvas:~# apt-get install build-essential bison flex cmake pkg-config libglib2.0-0 libglib2.0-dev

root@bob-Openvas:~# apt-get install libgnutls-dev

root@bob-Openvas:~# apt-get install libgnutls28-dev

root@bob-Openvas:~# apt-get install libpcap0.8 libpcap0.8-dev libgpgme11 libgpgme11-dev doxygen libuuid1 uuid-dev sqlfairy xmltoman sqlite3

root@bob-Openvas:~# apt-get install libxml2-dev libxslt1.1 libxslt1-dev xsltproc libmicrohttpd-dev libsqlite3-dev rsync libldap2-dev libhiredis-dev

root@bob-Openvas:~# apt-get install libgcrypt-dev zlib1g-dev libssh-dev

3.openvas包下载

http://www.openvas.org/install-source.html

(1)libraries:openvas库文件

openvas-libraries-8.0.7.tar.gz

(2)scanner:扫描器 负责调用各种漏洞检测插件,完成实际的扫描操作。

openvas-scanner-5.0.5.tar.gz

(3)manager:管理器 负责分配扫描任务,并根据扫描结果生产评估报告。

openvas-manager-6.0.8.tar.gz

(4)gsa:前端web ui 负责提供访问openvas服务层的web接口,便于通过浏览器来执行扫描任务,是使用最简便的客户层组件。

greenbone-security-assistant-6.0.10.tar.gz

(5)openvas-cli(命令行接口):负责提供从命令行访问OpenVAS服务层程序。

openvas-cli-1.4.4.tar.gz

二、编译安装

1.安装libraries

root@bob-Openvas:~# tar -xf openvas-libraries-8.0.7.tar.gz

root@bob-Openvas:~# cd openvas-libraries-8.0.7/

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7# mkdir build

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7# cd build/

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7/build# cmake ..

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7/build# make

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7/build# make doc-full

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7/build# make install

root@bob-Openvas:~/openvas/openvas-libraries-8.0.7/build# cd ../../

2.安装scanner方法同上,后面安装方法都一样

openvas-scanner-5.0.5.tar.gz

3.创建cert

root@bob-Openvas:~# openvas-mkcert

cert存放位置

/usr/local/var/lib/openvas/private/CA

/usr/local/var/lib/openvas/CA

4.重载libraries,重载的是libopenvas_nasl.so.8

root@bob-Openvas:~# ldconfig

5.同步nvt,nvt插件目录。NVT collection in /usr/local/var/lib/openvas/plugins contains 38966 NVTs.

root@bob-Openvas:~# openvas-nvt-sync   

...

...

zone_alarm_local_dos.nasl

zone_alarm_local_dos.nasl.asc

[i] Download complete

[i] Checking dir: ok

[i] Checking MD5 checksum: ok

6.安装redis-2.8.4,scanner启动前还需要运行一个redis服务,用于缓冲

root@bob-Openvas:~# apt-get install redis-server

root@bob-Openvas:~# netstat -lanpt |grep 6379

tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      3602/redis-server 1

root@bob-Openvas:~# cp /etc/redis/redis.conf{,.bak}

root@bob-Openvas:~# /etc/init.d/redis-server stop

Stopping redis-server: redis-server.

添加下面2行,不添加后面会报错

root@bob-Openvas:~# vim /etc/redis/redis.conf

unixsocket /tmp/redis.sock

unixsocketperm 700

root@bob-Openvas:~# /etc/init.d/redis-server start

root@bob-Openvas:~# netstat -lanpt |grep 6379

tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      3602/redis-server 1

7.启动scanner命令openvassd

scanner监听9391端口,需要说明的是scanner启动成功后,manager可以扮演客户端的角色与scanner交互,对scanner进行控制,真正的客户端如命令行cli、webui(gsa)只能与manager进行交互,不能越过manager操作scanner。

root@bob-Openvas:~# openvassd 

root@bob-Openvas:~# netstat -lanpt |grep 939

tcp        0      0 0.0.0.0:9391            0.0.0.0:*               LISTEN      3949/ ETA: 00:40)

8.安装manager

openvas-manager-6.0.8.tar.gz

9.manager启动后需要与scanner通信,scanner是服务端,manager是客户端,在scanner的“配置与启动”阶段,我们已经为scanner生成了SSL相关的证书和私钥文件,

说明manager可以进行服务端验证,但是scanner也要求对manager进行客户端验证,所以也需要为mananger生成SSL相关的证书和私钥文件。

10.下载scap feed.下载时间超级长,网速快的时候80分钟,网速慢的时候可能就要一天

root@bob-Openvas:~# openvas-scapdata-sync

11.下载cert feed

root@bob-Openvas:~# openvas-certdata-sync

12.执行下面命令生成client证书和私钥

root@bob-Openvas:~# openvas-mkcert-client -n -i

root@bob-Openvas:~# ls -l /usr/local/var/lib/openvas/private/CA

total 12

-rw------- 1 root root 3247  7月 30 16:59 cakey.pem

-rw------- 1 root root 3247  7月 30 20:08 clientkey.pem

-rw------- 1 root root 3247  7月 30 16:59 serverkey.pem

root@bob-Openvas:~# ls -l /usr/local/var/lib/openvas/CA

total 24

-rw-r--r-- 1 root root 2451  7月 30 16:59 cacert.pem

-rw------- 1 root root 7931  7月 30 20:08 clientcert.pem

-rw-r--r-- 1 root root 8229  7月 30 16:59 servercert.pem

######################################################################################################################

上述两步也可以通过执行openvas-mkcert-client生成证书和私钥:

root@bob-Openvas:~# openvas-mkcert-client 

然后将证书和私钥从临时目录拷贝到相应目录下

root@bob-Openvas:~# cp /tmp/openvas-mkcert-client.4501/key_om.pem /usr/local/var/lib/openvas/private/CA/clientkey.pem

root@bob-Openvas:~# cp /tmp/openvas-mkcert-client.4501/cert_om.pem /usr/local/var/lib/openvas/CA/clientcert.pem

######################################################################################################################

13.初始化数据库。scanner openvassd 9391端口启动,才能重建数据库成功。否则报错Rebuilding NVT cache... failed.

root@bob-Openvas:~# openvasmd --rebuild --progress -v

Rebuilding NVT cache... done.

root@bob-Openvas:~# openvasmd -p 9390 -a 127.0.0.1

root@bob-Openvas:~# netstat -lanpt |grep 939

tcp        0      0 127.0.0.1:9390          0.0.0.0:*               LISTEN      4836/openvasmd  

tcp        0      0 0.0.0.0:9391 

14.创建帐号bob

root@bob-Openvas:~# openvasmd --create-user=bob --role=Admin  

User created with password '23c65192-2fa7-4aab-aa8d-6c9df701314c'.

15.更改帐号bob的密码

root@bob-Openvas:~# openvasmd --user=bob --new-password=XXXXXXX 

16.安装cli,cli是一个命令行工具,作为客户端的omp,它可以运行在windows或linux上

openvas-cli-1.4.4.tar.gz 

17.安装gsad  

greenbone-security-assistant-6.0.10.tar.gz  

18.启动gsad。通过设置IP地址为0.0.0.0使服务可以通过其他机器进行访问

root@bob-Openvas:~# gsad --listen=0.0.0.0 -p 9392

root@bob-Openvas:~# netstat -lanpt |grep 939

tcp        0      0 127.0.0.1:9390          0.0.0.0:*               LISTEN      4836/openvasmd  

tcp        0      0 0.0.0.0:9391            0.0.0.0:*               LISTEN      3949/openvassd: Wai

tcp        0      0 0.0.0.0:9392            0.0.0.0:*               LISTEN      5580/gsad 

19.安装nmap-5.51.tar.bz2

gsad日志报错,扫描没有任何结果。是因为nmap没安装

root@bob-Openvas:~# ./configure && make && make install

20.导出pdf格式报告需要安装texlive-full

root@bob-Openvas:~# apt-get install texlive-full

21.下载脚本测试

root@bob-Openvas:~# wget https://svn.wald.intevation.org/svn/openvas/trunk/tools/openvas-check-setup --no-check-certificate

root@bob-Openvas:~# /root/openvas/openvas-check-setup --v8 --server

openvas-check-setup 2.3.3

  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.

Step 1: Checking OpenVAS Scanner ... 

        OK: OpenVAS Scanner is present in version 5.0.5.

        OK: OpenVAS Scanner CA Certificate is present as /usr/local/var/lib/openvas/CA/cacert.pem.

        OK: redis-server is present in version v=2.8.4.

        OK: scanner (kb_location setting) is configured properly using the redis-server socket: /tmp/redis.sock

        OK: redis-server is running and listening on socket: /tmp/redis.sock.

        OK: redis-server configuration is OK and redis-server is running.

        OK: NVT collection in /usr/local/var/lib/openvas/plugins contains 38966 NVTs.

        WARNING: Signature checking of NVTs is not enabled in OpenVAS Scanner.

        SUGGEST: Enable signature checking (see http://www.openvas.org/trusted-nvts.html).

        OK: The NVT cache in /usr/local/var/cache/openvas contains 38966 files for 38966 NVTs.

Step 2: Checking OpenVAS Manager ... 

        OK: OpenVAS Manager is present in version 6.0.8.

        OK: OpenVAS Manager client certificate is present as /usr/local/var/lib/openvas/CA/clientcert.pem.

        OK: OpenVAS Manager database found in /usr/local/var/lib/openvas/mgr/tasks.db.

        OK: Access rights for the OpenVAS Manager database are correct.

        OK: sqlite3 found, extended checks of the OpenVAS Manager installation enabled.

        OK: OpenVAS Manager database is at revision 146.

        OK: OpenVAS Manager expects database at revision 146.

        OK: Database schema is up to date.

        OK: OpenVAS Manager database contains information about 38966 NVTs.

        OK: At least one user exists.

        OK: OpenVAS SCAP database found in /usr/local/var/lib/openvas/scap-data/scap.db.

        OK: OpenVAS CERT database found in /usr/local/var/lib/openvas/cert-data/cert.db.

        OK: xsltproc found.

Step 3: Checking user configuration ... 

        WARNING: Your password policy is empty.

        SUGGEST: Edit the /usr/local/etc/openvas/pwpolicy.conf file to set a password policy.

Step 4: Checking Greenbone Security Assistant (GSA) ... 

        OK: Greenbone Security Assistant is present in version 6.0.10.

Step 5: Checking OpenVAS CLI ... 

        OK: OpenVAS CLI version 1.4.4.

Step 6: Checking Greenbone Security Desktop (GSD) ... 

        SKIP: Skipping check for Greenbone Security Desktop.

Step 7: Checking if OpenVAS services are up and running ... 

        OK: netstat found, extended checks of the OpenVAS services enabled.

        OK: OpenVAS Scanner is running and listening on all interfaces.

        OK: OpenVAS Scanner is listening on port 9391, which is the default port.

        OK: OpenVAS Manager is running and listening on all interfaces.

        OK: OpenVAS Manager is listening on port 9390, which is the default port.

        OK: Greenbone Security Assistant is running and listening on all interfaces.

        OK: Greenbone Security Assistant is listening on port 9392, which is the default port.

Step 8: Checking nmap installation ...

        OK: nmap is present in version 5.51.

Step 10: Checking presence of optional tools ...

        OK: pdflatex found.

        OK: PDF generation successful. The PDF report format is likely to work.

        OK: ssh-keygen found, LSC credential generation for GNU/Linux targets is likely to work.

        OK: rpm found, LSC credential package generation for RPM based targets is likely to work.

        OK: alien found, LSC credential package generation for DEB based targets is likely to work.

        OK: nsis found, LSC credential package generation for Microsoft Windows targets is likely to work.

It seems like your OpenVAS-8 installation is OK.

If you think it is not OK, please report your observation

and help us to improve this check routine:

http://lists.wald.intevation.org/mailman/listinfo/openvas-discuss

Please attach the log-file (/tmp/openvas-check-setup.log) to help us analyze the problem.

22.web访问openvas,ubuntu 14.04装出来是英文界面

https://127.0.0.1:9392

ubuntu 14.04编译安装openvas 8

三、开机自启动openvas脚本。因为是编译安装的,开机不会自启动,写了个小脚本

openvas开机自启动

root@bob-Openvas:~# vim /home/bob/openvas_server_start.sh 

#!/bin/bash

 

/usr/local/sbin/openvassd 

/usr/local/sbin/openvasmd -p 9390 -a 127.0.0.1 

/usr/local/sbin/gsad --listen=0.0.0.0 -p 9392

四、安装中遇到的问题以及解决办法

问题1

root@bob-Openvas:~# /root/openvas/openvas-check-setup --v8 --server

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: The number of NVTs in the OpenVAS Manager database is too low.

FIX: Make sure OpenVAS Scanner is running with an up-to-date NVT collection and run 'openvasmd --rebuild'.

ERROR: No OpenVAS SCAP database found. (Tried: /usr/local/var/lib/openvas/scap-data/scap.db)

FIX: Run a SCAP synchronization script like openvas-scapdata-sync or greenbone-scapdata-sync.

问题2

测试rsync.openvas.org 873端口是不是通的,通了之后才能执行openvas-nvt-sync openvas-scapdata-sync  greenbone-scapdata-sync

root@bob-Openvas:~# telnet rsync.openvas.org rsync

Trying 78.47.251.61...

Connected to openvas-feed.intevation.org.

Escape character is '^]'.

问题3

如果rsync.openvas.org 873端口不通,可以离线安装,在网上下载feed之后(直接到已经更新了资源的机器上拷贝对应的文件到自己机器上),拷贝到这些目录即可

openvas插件库下载,拷贝到下面目录,重启openvas

root@bob-Openvas:~# wget http://www.openvas.org/openvas-nvt-feed-current.tar.bz2

/usr/local/var/lib/openvas/plugins

/usr/local/var/lib/openvas/cert-data

/usr/local/var/lib/openvas/scap-data

问题4

openvas日志目录

root@bob-Openvas:~# ls -lh /usr/local/var/log/openvas/

total 24K

-rw-r--r-- 1 root root 1.4K  7月 29 17:39 gsad.log

-rw------- 1 root root  15K  7月 30 13:10 openvasmd.log

-rw-r--r-- 1 root root  559  7月 30 13:22 openvassd.messages


新闻名称:ubuntu14.04编译安装openvas8
URL标题:http://cqcxhl.com/article/joppjs.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP