Mastering OpenVAS: The Definitive Guide to Error-Free Installation

OpenVAS, short for Open Vulnerability Assessment System, is an open-source tool designed to scan computer systems and networks for security vulnerabilities. It conducts scans to detect known vulnerabilities in software, configurations, and network setups. OpenVAS offers a robust platform for vulnerability assessment, encompassing scanning capabilities, detailed reporting, and recommendations for remediation. This tool is highly regarded among security professionals and system administrators for fortifying the security of their systems and networks. 


Now, let's proceed to install it on my Kali Linux system.

┌──(kali㉿kali)-[~]
└─$ sudo apt install openvas

When I try to attempt to install OpenVAS on Kali Linux using the command "apt-get openvas," it successfully downloads the repository and completes the installation process. 

After installation, you can locate OpenVAS in the "Vulnerability Scanner" section of the Kali Menu. Within this section, you'll find three tools: one for initialization, another for starting the service, and a third for stopping it.

However, the issue arises when attempting to initialize the database and configure it, as it fails to download various vulnerability databases crucial for exploitation. 

Although the dashboard panel is accessible, the vulnerability scanning functionality is compromised.

But not to worry! In today's video, I'll guide you through the installation process of OpenVAS without encountering any errors. By the end, we'll be using it to scan Metasploitable2. Let's get started.

If you encounter any download errors while initializing the database, you can skip this step.

For an effective installation, we'll be utilizing Docker. If you're unfamiliar with Docker, be sure to read our previous discussions on it.

Uncover Benefits of Docker: Learn How to Utilize Docker for Cybersecurity

This article delves into the benefits of Docker and provides insights into how to utilize Docker for cybersecurity purposes. Understanding Docker and its advantages is essential for building secure, scalable, and efficient containerized applications.


Firstly, we need to install Docker. If you already have it installed, you can proceed to the next step. Run "sudo apt update", to update the repository. Once the repository database is updated, execute, "sudo apt install docker.io" and include "-y" to initiate the installation process without any interruptions.

┌──(kali㉿kali)-[~]
└─$ sudo apt update

┌──(kali㉿kali)-[~]
└─$ sudo apt install docker.io -y

At last, Docker has been successfully installed.

Once Docker is installed, you can check its version using the --version flag. 

┌──(kali㉿kali)-[~]
└─$ docker --version
Docker version 20.10.25+dfsg1, build b82b9f3

Before installing OpenVAS, let's verify that Docker is functioning correctly by running "hello-world". Additionally, we'll configure a few settings before proceeding with the OpenVAS installation.

┌──(kali㉿kali)-[~]
└─$ docker run hello-world
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$ 

It indicates that running Docker containers requires the use of the sudo command. However, I'm going to show you how to run Docker without needing root privileges.

In the terminal, type "sudo usermod -aG docker $USER", and press enter. 

┌──(kali㉿kali)-[~]
└─$ sudo usermod -aG docker $USER
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$

After successful execution, log out and log back in to apply the changes. Now, we can run "hello-world" without using sudo

┌──(kali㉿kali)-[~]
└─$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

                                                                                                                                   
┌──(kali㉿kali)-[~]
└─$ 

Everything should work smoothly without any issues.

To ensure Docker runs every time we start our Kali machine, we'll use "sudo systemctl enable Docker --now". 

┌──(kali㉿kali)-[~]
└─$ sudo systemctl enable docker --now
[sudo] password for kali: 
Synchronizing state of docker.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable docker
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$

Alternatively, if you prefer not to do this, you can simply start the Docker service each time you want to use it by running "service docker start".

┌──(kali㉿kali)-[~]
└─$ service docker start

Now, we're prepared to install OpenVAS. Begin by searching "OpenVAS Docker" on Google. From here, select the Docker Hub link. 

Here, you'll find detailed instructions provided on this page.

mikesplain/openvas - Docker Hub

This Docker Hub repository provides the image for OpenVAS, a powerful vulnerability scanning tool. OpenVAS helps in identifying and managing security vulnerabilities in systems and networks.


Firstly, we need to pull the Docker container. Copy the provided command, and paste it into your terminal. 

The pulling process will commence automatically. 

Please note that this process may take some time depending on your internet speed. Once the pulling is complete, the container will be extracted and created.

┌──(kali㉿kali)-[~]
└─$ docker pull mikesplain/openvas
Using default tag: latest
latest: Pulling from mikesplain/openvas
34667c7e4631: Pull complete 
d18d76a881a4: Pull complete 
119c7358fbfc: Pull complete 
2aaf13f3eff0: Pull complete 
67b182362ac2: Pull complete 
c878d3d5e895: Pull complete 
ec12cc49fe18: Pull complete 
c4c454aeebef: Pull complete 
27d3410150b2: Pull complete 
e08d578dc278: Pull complete 
44951337cd32: Pull complete 
8c7fe885e62a: Pull complete 
a4f833680e45: Pull complete 
Digest: sha256:23c8412b5f9f370ba71e5cd3db36e6f2e269666cd8a3e3e7872f20f8063b2752
Status: Downloaded newer image for mikesplain/openvas:latest
docker.io/mikesplain/openvas:latest
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$

Scroll down the Docker Hub page to find this command. This command is used to fetch the container from the Docker registry and start it up. 

Keep in mind that the startup process for OpenVAS can be time-consuming, usually taking around 4-5 minutes while the NVTs are scanned and databases are rebuilt. Be patient during this stage.

┌──(kali㉿kali)-[~]
└─$ docker run -d -p 443:443 --name openvas mikesplain/openvas
2b20dca3016b98b961324f5dae287bd443e1d25cbdc39bd5cc557ee12c35831f
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$ 

Once the process is complete, we can launch OpenVAS. Run the command, "docker ps", to check on which port it is running. 

┌──(kali㉿kali)-[~]
└─$ docker ps                                                 
CONTAINER ID   IMAGE                COMMAND               CREATED          STATUS          PORTS                                             NAMES
2b20dca3016b   mikesplain/openvas   "/bin/sh -c /start"   14 seconds ago   Up 13 seconds   0.0.0.0:443->443/tcp, :::443->443/tcp, 9390/tcp   openvas
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$ 

Typically, it runs on the default SSL port 443.

Now, open your preferred web browser and access OpenVAS by entering the local IP address and specified port.

Upon accessing OpenVAS, you may encounter a warning about potential risks. Ignore this warning, proceed by clicking "Advance," and accept the risk to continue. 

Subsequently, a login page will appear. 

Here, it asks to input a username and password.

At the login screen, input credentials, 

  • Username: admin, 
  • Password: admin.

You are now ready to log in to OpenVAS. Once logged in, you can initiate a vulnerability scan. 

Additionally, you'll find various commands on the Docker Hub page, such as running bash inside the container, changing the port, setting the admin password, and more. 

# To run bash inside the container run:
docker exec -it openvas bash

# Specify DNS Hostname
# By default, the system only allows connections for the hostname "openvas". To allow access using a custom DNS name, you must use this command:
docker run -d -p 443:443 -e PUBLIC_HOSTNAME=myopenvas.example.org --name openvas mikesplain/openvas

# OpenVAS Manager
# To use OpenVAS Manager, add port 9390 to you docker run command:
docker run -d -p 443:443 -p 9390:9390 --name openvas mikesplain/openvas


# Set Admin Password
# The admin password can be changed by specifying a password at runtime using the env variable OV_PASSWORD:
docker run -d -p 443:443 -e OV_PASSWORD=securepassword41 --name openvas mikesplain/openvas

If needed, simply copy the relevant command and paste it into your terminal.

Another important task is updating the Network Vulnerability Tests (NVTs)

docker exec -it openvas bash
## inside container
greenbone-nvt-sync
openvasmd --rebuild --progress
greenbone-certdata-sync
greenbone-scapdata-sync
openvasmd --update --verbose --progress

/etc/init.d/openvas-manager restart
/etc/init.d/openvas-scanner restart

This needs to be done occasionally. You can update the container by executing a few commands within it. Use the command "docker exec -It openvas bash", to start an interactive BASH prompt within the OpenVAS container. 

┌──(kali㉿kali)-[~]
└─$ docker exec -it openvas bash
root@2b20dca3016b:/# 

This allows you to execute commands specific to OpenVAS, such as updating and restarting services.

Once you're inside the container, execute the other commands one by one.

root@2b20dca3016b:/# greenbone-nvt-sync

Please be aware that if the NVT sync isn't responsive, akin to attempting to initialize OpenVAS without Docker's aid, we could face a similar issue. It could indicate a connectivity problem.

A connection timeout error may occur due to server downtime. If it worked on a different day, you can try running all these commands again.

root@2b20dca3016b:/# openvasmd --rebuild --progress
Rebuilding NVT cache... -^C            # I have an interruption because of it is not responsing
root@2b20dca3016b:/# greenbone-certdata-sync
greenbone-scapdata-sync
openvasmd --update --verbose --progress

After updating, restart the scanner and OpenVAS manager with the following command:

root@2b20dca3016b:/# /etc/init.d/openvas-manager restart
 * Restarting openvas-manager openvasmd                                                                                     [ OK ] 
root@2b20dca3016b:/# /etc/init.d/openvas-scanner restart
 * Restarting openvas-scanner openvassd                                                                                     [ OK ] 
root@2b20dca3016b:/# 

Now, within the bash shell, type "exit" to exit the shell. Then, run "reboot" to reboot your Kali machine and apply the changes.

root@2b20dca3016b:/# exit
exit
                                                                                                                                   
┌──(kali㉿kali)-[~]
└─$ sudo reboot    

It's important to remember that each time we launch a program using Docker, it creates a new container. For example, when we executed the "docker run hello-world" command, Docker created a container specifically for running that program. By default, once the container stops, that is, when you exit the shell or reboot, it is not automatically deleted.

You can view all containers, including stopped ones, by running the command "docker ps -a" in the Kali terminal. 

┌──(kali㉿kali)-[~]
└─$ docker ps -a        
CONTAINER ID   IMAGE                COMMAND               CREATED      STATUS                      PORTS     NAMES
2b20dca3016b   mikesplain/openvas   "/bin/sh -c /start"   5 days ago   Exited (137) 26 hours ago             openvas
01e92d239175   hello-world          "/hello"              5 days ago   Exited (0) 5 days ago                 trusting_wright
                                                                                                                                   
┌──(kali㉿kali)-[~]
└─$

This command provides you with the container ID and the name of the program that owns the container.  If you need to access OpenVAS again, you can use the command "docker start openvas".

┌──(kali㉿kali)-[~]
└─$ docker start openvas
openvas
                                                                                                                                   
┌──(kali㉿kali)-[~]
└─$ 

Be patient with the restart of the OpenVAS container. The OpenVAS container is now up and running.

In the next segment of OpenVAS, I'll illustrate how OpenVAS is employed to scan a vulnerable web application.

Mastering OpenVAS: Scanning Vulnerable Environments

This in-depth guide covers the process of mastering OpenVAS for scanning vulnerable environments. OpenVAS is a powerful open-source vulnerability scanner used for identifying security issues in networks and systems.


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!