Installation will be located in
Note: The primary server also serves as the Certificate Authority for itself and all secondaries. But you can create a Certificate SIgning Request and send that to your corporate PKI.
During installation a GVM user called 'admin' is created. The generated password for user admin is stored in the file /var/lib/gvm/adminuser. It is recommended that this password is changed and/or the file deleted. Do NOT delete the user admin unless you also change the feedowner to another user. This is described in the section Feed Owner.
To create a secondary see instructions later - but running the script add-secondary-2-primary.sh does the work required on the primary as well as on the secondary, hence this is the preferred method1.
1 You can install the complete installation on a secondary, that is include GVMD, GSAD etc, but there's no good reason to. The secondary with notus, ospd-openvas, and openvas only is a small efficient thing with a smaller attack surface.
Note: Due to the ugly hack made removing the Vagrant NIC uses (it gave me a lot of issues) use vboxmanage to control the VM afterwards, example: vboxmanage startvm manticore --type=headless
Note 2023-11-04: Used to be able to run the secondaries on 1 GB RAM and 1 shared CPU, but now need 2-4G B RAM and (preferably) 2 CPU's or better.
Versions used: Name | URL | Version |
---|---|---|
gvm-libs | https://github.com/greenbone/gvm-libs/ | 22.14.0 |
ospd-openvas | https://github.com/greenbone/ospd-openvas/ | 22.7.1 |
openvas-scanner | https://github.com/greenbone/openvas-scanner/ | 23.11.1 |
GVM Daemon | https://github.com/greenbone/gvmd/ | 24.0.0 |
GSA Daemon | https://github.com/greenbone/gsad/ | 24.0.0 |
GSA | https://github.com/greenbone/gsa/ | 24.0.1 |
openvas-smb | https://github.com/greenbone/openvas-smb | 22.5.6 |
python-gvm | https://github.com/greenbone/python-gvm/ | 24.8.0 |
gvm-tools | https://github.com/greenbone/gvm-tools/ | 24.8.0 |
pg-gvm | https://github.com/greenbone/pg-gvm/ | 22.6.5 |
notus-scanner | https://github.com/greenbone/notus-scanner/ | 22.6.4 |
greenbone-feed-sync | https://github.com/greenbone/greenbone-feed-sync/ | 24.9.0 |
Node.js for Debian 11 | https://deb.nodesource.com/ | 20.x |
Node.js for Debian 12 | Debian Repo | 18.x |
API Reference for Greenbone GMP 22.5
Modify the .env file to match your environment (especially if you need to send mail), however you may want to personalize it even further.
To install a primary, run: export DEBIAN_FRONTEND=noninteractive; apt update ; apt -y full-upgrade ; apt -y install git; git clone https://github.com/martinboller/gse.git; cd gse/installfiles/; chmod 755 *.sh; ./install-gse.sh
Install secondaries by running: export DEBIAN_FRONTEND=noninteractive; apt update ; apt -y full-upgrade ; apt -y install git; git clone https://github.com/martinboller/gse.git; cd gse/installfiles/; chmod 755 *.sh; ./install-gse-secondary.sh¹ - When the secondary is finished installing the script returns the hostname and password needed to connect the secondary to the primary, however if you cleared the screen or forgot it, it can be found in /var/lib/gvm/greenboneuser on the secondary scanner in question.
To connect the secondaries to the primary, on the primary, run: ./add-secondary-to-primary.sh and enter the hostname or ip and password for the secondary.
Now use the different scripts (automatically cloned from GitHub on the primary) to create Credentials, Schedules, Targets, and Tasks (or do it manually from the Web UI). Details on the GMP Scripts can be found on GitHub.
¹ Use install-gse-secondary.sh for all the secondaries you want to deploy.
² Turned out to be a badly configured alert that broke scanning. The alert triggered and an e-mail was sent, however GVMD never requested ospd-openvas to scan.
Traceback (most recent call last): File "/opt/gvm/gvmpy/lib/python3.11/site-packages/paho/mqtt/client.py", line 874, in del self._reset_sockets() File "/opt/gvm/gvmpy/lib/python3.11/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets self._sock_close() File "/opt/gvm/gvmpy/lib/python3.11/site-packages/paho/mqtt/client.py", line 1119, in _sock_close if not self._sock: ^^^^^^^^^^ AttributeError: 'MQTTClient' object has no attribute '_sock'
2 I've successfully used 3389/TCP on networks that wouldn't allow port 9390 "for security reasons" but allowed RDP across all networks. (Yeah, those stupid rules do exist).
The overall components are depicted in the figure below. All dotted lines are transitory, existing only during installation, that is initiated by the bash scripts.
Run install-gse.sh and wait for a (long) while.
Note: Several issues with TEX, currently resolved by installing texlive-full. Installing texlive-full takes a lot of time compared to everything else installed, but Debian has a quirk here that sometimes breaks apt when not installing texlive-full.
Run install-gse-secondary.sh and wait for installation to finish.
Run add-secondary-2-primary.sh on the primary.
The add-secondary-2-primary.sh does the following. a) Copies required certificates to the secondary. b) runs the helper script secondary-certs.sh on the secondary to ensure all certificates are in the right location. c) restarts ospd-openvas on the secondary. c) configures GVMD to use this scanner.
If this fails, just copy the .pem files from /var/lib/gvm/secondaries/hostname_of_secondary/ to the new secondary, run secondary-certs.sh and ospd-openvas.service should start and scanner can be verified. Follow the steps under Manual Installation below.
Provided you have Vagrant and VirtualBox installed, installation is "just".
git clone https://github.com/martinboller/gse.git
cd /gse/
vagrant up
Packages required:
Both software titles can be downloaded from https://www.virtualbox.org/ They can also be added to your package manager, which help with keeping them up-to-date. This can also easily be changed to run with VMWare.
This will install a primary called "manticore" and a secondary called "aboleth", which can be changed inside "Vagrantfile". Prerequisite: A DHCP server on the network, alternatively change the NIC to use a static or NAT within Vagrantfile.
You may have to select which NIC to use for this e.g. wl02p01. Logon to the website on the server https://manticore (if you have not changed the hostname and DNS works. If not, use the ip address).
The first install will take longer, as it needs to download the Vagrant box for Debian 11 or (preferred) Debian 12 (which this build is based on) first, however that’ll be reused in subsequent installations.
The first OpenVas scanner is always UUID: 08b69003-5fc2-4037-a479-93b440211c73. The script verifies bot the OpenVAS and the GVMD Scanner by running. For OpenVAS:
su gvm -c '/opt/gvm/sbin/gvmd --verify-scanner 08b69003-5fc2-4037-a479-93b440211c73'
Which should return this (Version Mar. 2022).
Scanner version: OpenVAS 21.4.4.
For GVM:
su gvm -c '/opt/gvm/sbin/gvmd --verify-scanner 6acd0832-df90-11e4-b9d5-28d24461215b'
Which should return this (Version Mar. 2022).
Scanner version: GVM/21.4.5.
During install an Admin user is created, and the initial password stored here:
cat /opt/gvm/lib/adminuser.
It is good security practice to change this (do it now):
/opt/gvm/sbin/gvmd --user admin --new-password 'Your new password'
The admin account is import feed owner: https://community.greenbone.net/t/gvm-20-08-missing-report-formats-and-scan-configs/6397/2 So do not delete this account, unless you reconfigure it to be another. Do remember to change its initial password as discussed here.
If you want to change feedowner, the following commands can be used to create another account and make that the feedowner. You can also just change it in install-gse.sh before running it the first time.
su gvm -c '/opt/gvm/sbin/gvmd --create-user=MyOwnUser'
Get the UUIDs of all users.
su gvm -c '/opt/gvm/sbin/gvmd --get-users --verbose'
Or just for your newly created user.
su gvm -c '/opt/gvm/sbin/gvmd --get-users --verbose | grep MyOwnUser'
Pick the UUID for the one you just created in the list provided and replace UUID of new account below.
su gvm -c '/opt/gvm/sbin/gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value UUID of new account'
create a directory for the files needed, and:
/opt/gvm/sbin/gvm-manage-certs -e ./gsecert.cfg -v -d -c
Before doing the above, verify if the required certificates can be created by add-secondary-2-primary.sh, as that will still do most of the work even if not able to copy the required files to the secondary.
Copy the created secondary-cert.pem, secondary-key.pem, as well as the cacert.pem file to the secondary (the cacert.pem can be found in /var/lib/gvm/CA/ on the primary)
su gvm -c 'cp ./secondary-cert.pem /var/lib/gvm/CA/'
su gvm -c 'cp ./secondary-key.pem /var/lib/gvm/private/CA/'
su gvm -c 'cp ./cacert.pem /var/lib/gvm/CA/'
Restart ospd-openvas:
systemctl restart ospd-openvas.service
Update Openvas feed:
su gvm -c '/opt/gvm/sbin/openvas --update-vt-info'
Whereever the required files (secondary-cert.pem and secondary-key.pem) are:
chown gvm:gvm *.pem
su gvm -c '/opt/gvm/sbin/gvmd --create-scanner="OSP Scanner secondary hostname" --scanner-host=hostname --scanner-port=9390 --scanner-type="OpenVas" --scanner-ca-pub=/var/lib/gvm/CA/cacert.pem --scanner-key-pub=./secondary-cert.pem --scanner-key-priv=./secondary-key.pem'
Example:
su gvm -c '/opt/gvm/sbin/gvmd --create-scanner="OpenVAS Secondary host aboleth" --scanner-host=aboleth --scanner-port=9390 --scanner-type="OpenVas" --scanner-ca-pub=/var/lib/gvm/CA/cacert.pem --scanner-key-pub=./secondary-cert.pem --scanner-key-priv=./secondary-key.pem'
Which should output this: Scanner created.
su gvm -c '/opt/gvm/sbin/gvmd --get-scanners'
Outputting something like this (the UUID will be different for the scanner just created) 08b69003-5fc2-4037-a479-93b440211c73 OpenVAS /var/run/ospd/ospd-openvas.sock 0 OpenVAS Default 6acd0832-df90-11e4-b9d5-28d24461215b CVE 0 CVE 3e2232e3-b819-41bc-b5be-db52bfb06588 OpenVAS mysecondary 9390 OSP Scanner mysecondary
Verify the secondary just added:
su gvm -c '/opt/gvm/sbin/gvmd --verify-scanner=3e2232e3-b819-41bc-b5be-db52bfb06588'
Which, provided the scanner works, should return this:
Scanner version: OpenVAS 21.4.4.
Congrats, You have now added a secondary scanner manually
If you've created a scanner in error or have decommissioned it, remove it using --delete-scanner.
su gvm -c '/opt/gvm/sbin/gvmd --delete-scanner=f12cca78-c6b9-4fd1-ad4f-9a9eb2037d29'
Added the following scripts: -create_targets.sh. This takes the admin password as input and creates some example networks -export-csv-report.gmp.py. Creates a csv formatted report. You need to specify user, password, connection type as well as the id of the report: Examples in the script. -export-pdf-report.gmp.py. Same as above but pdf format.
Just after installation, going from empty feeds to fully up-to-date, you'll notice that postgres is being hammered by gvmd and that redis are by ospd-openvas as openvas-scanner uses Redis (on the secondary only ospd-openvas, openvas, and redis is running). When feeds are updated this isn't as obvious, as the delta is significantly less than "everything". Use ps or top to follow along - the UI also show that the feeds are updating under Administration -> Feed Status.
Primary, Web Interface:
Primary, top:
Secondary, top:
If you want to check the certificates are correct and contain the desired information, openssl is useful;
For the webserver on the primary host
openssl s_client -showcerts -servername primary_host_name -connect primary_host_name:443
For the secondary with ospd-openvas listening on 9390
openssl s_client -showcerts -servername secondary_host_name -connect secondary_host_name:9390
When removing Vagrant specific configs, control the VMs using the Hypervisors specific tools, for VirtualBox:
There's a short companion blogpost on https://blog.infosecworrier.dk/2020/12/building-your-own-greenbone.html