Greenbone Management Protocol: Import (Asset/Service/Software/Vulns) + Export+Scan - #57
Closed
hdm wants to merge 2 commits into
Closed
Greenbone Management Protocol: Import (Asset/Service/Software/Vulns) + Export+Scan#57hdm wants to merge 2 commits into
hdm wants to merge 2 commits into
Conversation
Contributor
Author
|
rolled into #58 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: This depends on runZero 5.1.260815.0 or newer for the TLS socket and SSH unix stream socket forwarding support.
Greenbone Management Protocol (GMP) integrations
Two integrations that talk to a Greenbone / OpenVAS scanner over the Greenbone
Management Protocol. Both support SSH and TLS transports with
username/password GMP auth, the standard runZero TLS trust options (CA, SHA-256
thumbprint pinning, client certs), and SSH host-key/key pinning.
greenbone-import.stargreenbone/runzero-greenbone-scan.stargreenbone-scan/Together they form a loop: runZero addresses can be scanned in Greenbone, and
Greenbone results can be imported back into runZero.
Requirement: both declare
minVersion 5.1.260815.0. They rely on Explorerruntime support for the GMP transport primitives: forwarding to the gvmd UNIX
socket over SSH (
direct-streamlocal, i.e.ssh -L localport:/run/gvmd/gvmd.sock, so nosocat/netcathelper is needed on theappliance) and passing TLS options into a raw TLS socket.
greenbone-import.starFor each task's most recent report (within a configurable age window), it
streams one runZero asset per scanned host:
host asset id but with
matchBehavior="no-id-match no-id-break", so resultsmerge into existing runZero assets by IP/MAC/hostname, not by the foreign id.
severity.
cpe:/a:…) parsed into vendor/product/version.description, solution, CVSS base score, severity rank, QoD, and NVT OID.
Reports are fetched page by page (
get_reports … first/rows sort=host) and eachhost is emitted with
report_assetsas it completes. Only one page and thecurrent host are ever held in memory, so a multi-megabyte report imports without
buffering the whole thing.
Parameters
transport:ssh(default) ortls.ssh_host,ssh_username,ssh_passwordorssh_private_key(+ passphrase),
ssh_host_key(authorized_keys format),gmp_socket_path(default
/run/gvmd/gvmd.sock).gmp_host,gmp_port(default 9390), plustls_*(
tls_disable_validation,tls_ca_cert,tls_peer_hash,tls_client_cert,tls_client_key).gmp_username,gmp_password.max_age_days(default 30),task_filter,report_filter,severity_levels(defaulthmlg; includegto import hosts with no findingsas assets),
min_qod(default 70),page_size(default 100).Running it
SSH transport:
TLS transport with thumbprint pinning:
runzero script --filename greenbone/greenbone-import.star \ --kwargs transport=tls \ --kwargs gmp_host=192.0.2.10 --kwargs gmp_port=9390 \ --kwargs tls_peer_hash=AB:CD:EF:... \ --kwargs gmp_username=admin \ --kwargs gmp_password='<gmp-password>'Output:
Imported asset
The logical
ImportAssetbuilt for one host (Ubuntu box from a lab report):{ "id": "80b81a84-183e-4807-ad9c-696ceeb1b50f", "matchBehavior": "no-id-match no-id-break mac-match mac-break ip-match ip-break name-match name-break", "os": "Ubuntu 24.04", "networkInterfaces": [{ "ipv4Addresses": ["10.114.122.3"] }], "customAttributes": { "greenbone.report_id": "743b3975-8d80-4ebc-a1f7-6957898b5d03", "greenbone.task": "Lab All", "greenbone.scan_end": "2026-08-14T13:53:46Z", "greenbone.asset_id": "80b81a84-183e-4807-ad9c-696ceeb1b50f", "greenbone.os_cpe": "cpe:/o:canonical:ubuntu_linux:24.04" }, "services": [ { "address": "10.114.122.3", "port": 22, "transport": "tcp", "protocolData": [{ "name": "ssh", "attributes": { "banner": "Remote SSH server banner: SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.18\n...", "severity": "2.6" } }] } ], "software": [ { "cpe23": "cpe:/a:ietf:transport_layer_security:1.2", "vendor": "ietf", "product": "transport_layer_security", "version": "1.2", "serviceAddress": "10.114.122.3", "serviceTransport": "tcp", "servicePort": 3780 } ], "vulnerabilities": [ { "id": "1.3.6.1.4.1.25623.1.0.90022:22/tcp", "name": "Weak MAC Algorithm(s) Supported (SSH)", "category": "SSH", "serviceAddress": "10.114.122.3", "serviceTransport": "tcp", "servicePort": 22, "cvss2BaseScore": 2.6, "severityRank": 1, "customAttributes": { "greenbone.nvt_oid": "1.3.6.1.4.1.25623.1.0.90022", "greenbone.threat": "Low", "greenbone.qod": "80" } }, { "id": "1.3.6.1.4.1.25623.1.0.103190:CVE-1999-0524", "name": "ICMP Timestamp Reply Information Disclosure", "category": "General", "cve": "CVE-1999-0524", "serviceAddress": "10.114.122.3", "serviceTransport": "icmp", "cvss2BaseScore": 2.1, "severityRank": 1 } ] }One lab report (141 responsive hosts) imported 141 assets, 521 services, 628
software, and 816 vulnerabilities at default settings, with an OS on every asset
and no duplicate ids.
runzero-greenbone-scan.star(
/api/v1.0/export/org/assets.csv) with your search filter and collects eachmatching asset's primary
address(de-duplicated and IP-validated).scanner), and starts the scan unless disabled, logging the report id. If task
creation fails, the new target is rolled back.
Parameters
runzero_url,runzero_export_token(Export API key),export_filter(e.g.os:Windows,last_seen:<30d,first_seen:<3d),max_hosts(default 1,000,000). Usesrz_http_*/rz_tls_*.ssh/tlsoptions as the importer.target_nameprefix (a timestamp is appended),scan_config_id(default Full and fast),scanner_id(default OpenVASDefault),
port_list_id(default All IANA assigned TCP),start_scan.Running it
Output:
If the export matches nothing, it stops before connecting to Greenbone and no
target or task is created:
Testing
Validated against Greenbone Community Edition (GVM 25.2.1 / gvmd 22.6): full
paged import (141 assets) and target/task/start with cleanup. Response framing
tokenizes on
>(gvmd escapes</>in text), tracks tag depth, and is boundedby per-tag and per-response byte caps; a forward-progress guard stops paging if a
server ignores pagination. Every read carries a deadline and every connection and
goroutine is torn down on task completion.
Credentials above are placeholders. This PR covers the seven integration-repo
files; the supporting Explorer runtime changes are in the platform repo.