Closed leonardb closed 4 months ago
I am facing the same issue, a quick and dirty fix is to connect to the DB and run these commands:
DROP MATERIALIZED VIEW result_vt_epss;
CREATE MATERIALIZED VIEW result_vt_epss AS (SELECT cve AS vt_id, epss AS epss_score, percentile AS epss_percentile, cve AS epss_cve, cves.severity AS epss_severity, epss AS max_epss_score, percentile AS max_epss_percentile, cve AS max_epss_cve, cves.severity AS max_epss_severity FROM scap.epss_scores JOIN scap.cves ON cve = cves.uuid UNION ALL SELECT oid AS vt_id, epss_score, epss_percentile, epss_cve, epss_severity, max_epss_score, max_epss_percentile, max_epss_cve, max_epss_severity FROM nvts);
Same here.
I use docker compose install mode. And fix the issus like talk @nikosch86
root@security-scanner:~/greenbone-community-container# docker exec -it greenbone-community-edition-pg-gvm-1 bash
root@c131ea1525a5:/home/postgres# psql gvmd -U gvmd
gvmd=> \c gvmd;
gvmd=> DROP MATERIALIZED VIEW result_vt_epss;
gvmd=> CREATE MATERIALIZED VIEW result_vt_epss AS (SELECT cve AS vt_id, epss AS epss_score, percentile AS epss_percentile, cve AS epss_cve, cves.severity AS epss_severity, epss AS max_epss_score, percentile AS max_epss_percentile, cve AS max_epss_cve, cves.severity AS max_epss_severity FROM scap.epss_scores JOIN scap.cves ON cve = cves.uuid UNION ALL SELECT oid AS vt_id, epss_score, epss_percentile, epss_cve, epss_severity, max_epss_score, max_epss_percentile, max_epss_cve, max_epss_severity FROM nvts);
Expected behavior
Reports to work
Actual behavior
Errors trying to access reports
Steps to reproduce
GVM versions
gsa: (gsad --version)
Greenbone Security Assistant 22.11.0
gvm: (gvmd --version)
Greenbone Vulnerability Manager 23.8.0 Manager DB revision 256 Copyright (C) 2009-2021 Greenbone AG License: AGPL-3.0-or-later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
openvas-scanner: (openvas --version)
sudo docker exec -it greenbone-community-edition-openvas-1 openvas --version exec /usr/local/sbin/openvas: operation not permitted
gvm-libs:
unknown
Environment
Docker: https://greenbone.github.io/docs/latest/22.4/container/index.html
Logfiles
See above
Digging further it seems to be a bug in how the materialized view is created or 'not re-created'.
Looking at https://github.com/greenbone/gvmd/blob/fd961c080c3355abac1e056a0c35a83e6bafbd03/src/manage_pg.c#L1813
If I run the guard query on the DB of my install
so it should have mat-view as per line 1823 and yet DB had the fallback mat-view as per line 1847
Replacing the mat-view with the version defined at Line 1823 resolves the issue