{"id":5032,"date":"2024-06-01T12:33:49","date_gmt":"2024-06-01T17:33:49","guid":{"rendered":"https:\/\/dev.iachieved.it\/iachievedit\/?p=5032"},"modified":"2024-06-01T14:08:07","modified_gmt":"2024-06-01T19:08:07","slug":"installing-greenbone-openvas-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/installing-greenbone-openvas-on-ubuntu-24-04\/","title":{"rendered":"Installing Greenbone OpenVAS on Ubuntu 24.04"},"content":{"rendered":"<p><a href=\"https:\/\/canonical.com\/blog\/canonical-releases-ubuntu-24-04-noble-numbat\">Ubuntu 24.04 LTS<\/a>, the &#8220;Noble Numbat&#8221;, has arrived, and I wanted to get <a href=\"https:\/\/www.openvas.org\/\">Greenbone OpenVAS<\/a> up and running on it. OpenVAS is a powerful, but complex, collection of software, used by many to perform vulnerability scans against their IT infrastructure. With more than a half-dozen components and use of external data feeds, Redis, Postgres, and an MQTT broker, installing and running it successfully can be a challenge.<\/p>\n<p>The overview below, and resulting <a href=\"https:\/\/github.com\/iachievedit\/build_openvas\">Github repository<\/a>, is based upon following the <a href=\"https:\/\/greenbone.github.io\/docs\/latest\/22.4\/source-build\/index.html\">source build<\/a> instructions. I also recommend reading the <a href=\"https:\/\/greenbone.github.io\/docs\/latest\/glossary.html\">OpenVAS glossary<\/a> to familiarize yourself with the terms.<\/p>\n<p>First, a warning! I&#8217;ve personally executed these steps a half-dozen times and tested the outcome (a running OpenVAS installation). <i>However<\/i>, you should understand the basics of the commands and be up to the challenge of troubleshooting in case you run in trouble.<\/p>\n<p>Another couple of warnings. My scripts do not use GPG to verify the `tar` signatures of Greenbone&#8217;s packages. You will also be running these commands as `root`. There are some that might object to that, and insist on using `sudo`. I can assure you that doing so will cause heartburn.<\/p>\n<p>Alright, with that out of the way, I recommend you start with a VM with a fresh install of Ubuntu 24.04. If you can, configure the VM with 4 to 8 cores, at least 8GB of RAM, and 64GB of disk space. Then:<\/p>\n<pre class=\"lang:sh decode:false\">sudo su\r\ncd \/tmp\r\ngit clone https:\/\/github.com\/iachievedit\/build_openvas\r\ncd build_openvas\r\n<\/pre>\n<p>Make note of the two top-level scripts `exports.sh` and `install.sh`. `exports.sh` is sourced by individual scripts in `scripts\/`, primarily to allow you to run scripts independently.<\/p>\n<h1>Quick Start<\/h1>\n<p>So, this won&#8217;t necessarily be <i>quick<\/i>, as it does take some time to build OpenVAS and bootstrap the feeds.  For a VM running on an M3 Max (8 cores, 16GB of RAM), it took 44 minutes total, but again, much of that was downloading the feed.<\/p>\n<pre class=\"lang:sh decode:false\">\r\nroot@openvas:\/tmp\/build_openvas\r\ntime .\/install.sh\r\n...\r\nreal 44m16.502s\r\nuser 10m38.669s\r\nsys  0m57.051s\r\n<\/pre>\n<h1>One by One<\/h1>\n<p>If you prefer, you can execute each script one at a time.  I, in fact, recommend this, if you want to get a feel for how OpenVAS is built from the ground up.<\/p>\n<h2>Setting Up<\/h2>\n<p>The first three scripts set the stage for the build by creating the `gvm` user and group, making the source, build, and install directories, and then installing all of the primary dependencies (and there are a lot). There is one nuance you&#8217;ll find and that is `python3-packaging` has been explicitly removed from the install list, and when building `osp-openvas` it is removed. For whatever reason having it present causes problems.<\/p>\n<h2>Building<\/h2>\n<p>Scripts 10 through 18 download, build, and install everything. These should be executed in order, and that order matches the canonical build instructions <a href=\"https:\/\/greenbone.github.io\/docs\/latest\/22.4\/source-build\/index.html\">here<\/a>.<\/p>\n<h2>Architecture Configuration<\/h2>\n<p>Scripts 90 through 95 cobble together &#8220;the architecture&#8221;. `redis`, `postgres`, and `mosquitto` are all installed and configured. Interestingly `mosquitto` was omitted as a dependency in the installation instructions, but it is most definitely required as the MQTT broker (&#8220;aka MQTT message bus&#8221;).<\/p>\n<h2>Bootstrapping<\/h2>\n<p>The longest part of the installation and configuration of OpenVAS is `greenbone-feed-sync`, which is responsible for downloading Notus, NASL, and SCAP files.<\/p>\n<pre>root@openvas:\/tmp\/build_openvas\/scripts# .\/97_sync.sh\r\n+ This will take some time.\r\nRunning as root. Switching to user 'gvm' and group 'gvm'.\r\nTrying to acquire lock on \/var\/lib\/openvas\/feed-update.lock\r\nAcquired lock on \/var\/lib\/openvas\/feed-update.lock\r\n\u280f Downloading Notus files from rsync:\/\/feed.community.greenbone.net\/community\/vulnerability-feed\/22.04\/vt-data\/notus\/ to \/var\/lib\/notus\r\n\u2826 Downloading NASL files from rsync:\/\/feed.community.greenbone.net\/community\/vulnerability-feed\/22.04\/vt-data\/nasl\/ to \/var\/lib\/openvas\/plugins\r\nReleasing lock on \/var\/lib\/openvas\/feed-update.lock\r\n\r\nTrying to acquire lock on \/var\/lib\/gvm\/feed-update.lock\r\nAcquired lock on \/var\/lib\/gvm\/feed-update.lock\r\n\u2834 Downloading SCAP data from rsync:\/\/feed.community.greenbone.net\/community\/vulnerability-feed\/22.04\/scap-data\/ to \/var\/lib\/gvm\/scap-data\r\n\u280f Downloading CERT-Bund data from rsync:\/\/feed.community.greenbone.net\/community\/vulnerability-feed\/22.04\/cert-data\/ to \/var\/lib\/gvm\/cert-data\r\n\u280b Downloading gvmd data from rsync:\/\/feed.community.greenbone.net\/community\/data-feed\/22.04\/ to \/var\/lib\/gvm\/data-objects\/gvmd\/22.04\r\nReleasing lock on \/var\/lib\/gvm\/feed-update.lock\r\n<\/pre>\n<h2>Start!<\/h2>\n<p>Finally, start everything up!<\/p>\n<pre> .\/99_start.sh\r\n+ Go for launch\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/ospd-openvas.service \u2192 \/etc\/systemd\/system\/ospd-openvas.service.\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/gvmd.service \u2192 \/etc\/systemd\/system\/gvmd.service.\r\nCreated symlink \/etc\/systemd\/system\/greenbone-security-assistant.service \u2192 \/etc\/systemd\/system\/gsad.service.\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/gsad.service \u2192 \/etc\/systemd\/system\/gsad.service.\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/openvasd.service \u2192 \/etc\/systemd\/system\/openvasd.service.\r\n<\/pre>\n<pre>root@openvas:\/var\/log\/gvm# ls -l\r\ntotal 16\r\n-rw-r--r-- 1 gvm gvm   79 May 27 21:53 gsad.log\r\n-rw------- 1 gvm gvm 8126 May 27 21:53 gvmd.log\r\n-rw-r--r-- 1 gvm gvm    0 May 27 21:53 openvas.log\r\n-rw-r--r-- 1 gvm gvm  381 May 27 21:53 ospd-openvas.log\r\n<\/pre>\n<p>If you look at the logs you should see lines like:<\/p>\n<p>&#8220;`<br \/>\nFinished loading VTs. The VT cache has been updated from version 0 to 202405270604.<br \/>\nUpdated NVT cache from version 0 to 202405270604<br \/>\n&#8220;`<\/p>\n<p>Pay particular attention to the `gvmd.log` as it is the best indicator of when things &#8220;are ready.&#8221;<\/p>\n<h1>First Scan<\/h1>\n<p>The scripts created a default `admin` password and left it in `adminpass.txt`. In a browser, go to http:\/\/YOUR_MACHINE:9392 and you should see:<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/05\/greenbone_default.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5047\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/05\/greenbone_default.png\" alt=\"\" width=\"811\" height=\"714\" \/><\/a><\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/05\/secinfo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5049\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/05\/secinfo.png\" alt=\"\" width=\"1134\" height=\"931\" \/><\/a><\/p>\n<h2>A Quick Scan<\/h2>\n<p>A quick scan starts with going to the <b>Tasks<\/b> menu item under <b>Scans<\/b>.  From here, click on the &#8220;wand&#8221; icon to bring up the <b>Task Wizard<\/b>.<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/06\/taskWizard.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/06\/taskWizard.png\" alt=\"\" width=\"487\" height=\"441\" class=\"aligncenter size-full wp-image-5063\" \/><\/a><\/p>\n<p>Enter the IP address of the host you want to scan (or, if DNS is configured, the FQDN).  In our case we&#8217;ll scan a Proxmox hypervisor.<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/06\/hvScan.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/06\/hvScan.png\" alt=\"\" width=\"798\" height=\"377\" class=\"aligncenter size-full wp-image-5064\" \/><\/a><\/p>\n<p>Click <b>Start Scan<\/b> and be patient as OpenVAS performs the scan.<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/06\/scanStarted.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2024\/06\/scanStarted.png\" alt=\"\" width=\"988\" height=\"601\" class=\"aligncenter size-full wp-image-5065\" \/><\/a><\/p>\n<p>As with any &#8220;percent complete&#8221; UI, you&#8217;ll get to 99% complete quickly, only to wait a bit for it to finish.<\/p>\n<h2>Next Steps<\/h2>\n<p>You will want to secure your connection with HTTPS.  The most straightforward way to do so is to change the the `ExecStart` for GSAD (`\/etc\/systemd\/system\/gsad.service`) from <\/p>\n<pre>\r\nExecStart=\/usr\/local\/sbin\/gsad --foreground --listen=0.0.0.0 --port=9392 --http-only\r\n<\/pre>\n<p>to<\/p>\n<pre>\r\nExecStart=\/usr\/local\/sbin\/gsad --foreground --listen=0.0.0.0 --port=9392 -c <CERT_PATH> -k <PRIVKEY_PATH> --no-redirect\r\n<\/pre>\n<p>where `CERT_PATH` and `PRIVKEY_PATH` are full paths to your certificate and private key.  I typically use <a href=\"https:\/\/letsencrypt.org\">Let&#8217;s Encrypt<\/a> to obtain these.<\/p>\n<p>After updating the GSAD unit file, make sure and issue `systemctl daemon-reload` and then restart GSAD with `systemctl restart gsad`.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 24.04 LTS, the &#8220;Noble Numbat&#8221;, has arrived, and I wanted to get Greenbone OpenVAS up and running on it. OpenVAS is a powerful, but complex, collection of software, used by many to perform vulnerability scans against their IT infrastructure. With more than a half-dozen components and use of external data feeds, Redis, Postgres, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5071,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-5032","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hacking"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/5032"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=5032"}],"version-history":[{"count":34,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/5032\/revisions"}],"predecessor-version":[{"id":5074,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/5032\/revisions\/5074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media\/5071"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=5032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=5032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=5032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}