greenbone / gvmd

Greenbone Vulnerability Manager - The database backend for the Greenbone Community Edition
GNU Affero General Public License v3.0
281 stars 153 forks source link

[21.4.4] Setting GnuPG dir failed: No such file or directory #1805

Closed k3v3n closed 2 years ago

k3v3n commented 2 years ago

Expected behavior

GVMD would not end on CRITICAL error.

Actual behavior

GVMD Process exit because of CRITICAL error

Steps to reproduce

Build all components from source as explained here: https://greenbone.github.io/docs/

GVM versions

gsa: (gsad --version)

N/A

gvm: (gvmd --version)

Greenbone Vulnerability Manager 21.4.4 Manager DB revision 242

openvas-scanner: (openvas --version)

OpenVAS 21.4.4

gvm-libs:

gvm-libs 21.4.4

Environment

Operating system:

Linux 3039ced75755 5.10.104-linuxkit #1 SMP Thu Mar 17 17:08:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

Installation method / source: (packages, source installation)

Source installtions.

Logfiles

md manage:WARNING:2022-04-21 01h33.48 utc:132: sql_exec_internal: PQexec failed: ERROR:  relation "public.meta" does not exist
LINE 1: SELECT value FROM public.meta WHERE name = 'database_version...
                          ^
 (7)
md manage:WARNING:2022-04-21 01h33.48 utc:132: sql_exec_internal: SQL: SELECT value FROM public.meta WHERE name = 'database_version';
md manage:WARNING:2022-04-21 01h33.48 utc:132: sql_x: sql_exec_internal failed
libgvm util:WARNING:2022-04-21 01h33.50 utc:148: Setting GnuPG dir failed: No such file or directory
md  crypt:CRITICAL:2022-04-21 01h33.50 utc:148: lsc_crypt_new: can't continue w/o a gpgme context

Notes

My guess is that when compiling gvm-libs from source, it's missing some some links. I'm building everything from source and copying binaries into a final docker images. My images are build from the following examples:

Maybe related to this https://github.com/greenbone/gvm-libs/blob/main/INSTALL.md#building-gvm-libraries-statically-linked

Dexus commented 2 years ago

I can't reproduce it. If the container is built correctly, there will be no problems. But if you don't set the permissions correctly in the container for the directories, gvmd/libgvm can't create directories either. Especially if you use the COPY on between multisteps in the Dockerfile, there is more to consider.

bjoernricks commented 2 years ago

For getting rid of this issue it is required that gvmd can read and write /etc/gvm/gnupg (https://github.com/greenbone/gvmd/blob/stable/src/manage_sql_report_formats.c#L99)

Dexus commented 2 years ago

correct path is /var/lib/gvm/gvmd/gnupg if we trust src/lsc_crypt.c. and then it's only a permission problem in docker and not in the gvmd.

k3v3n commented 2 years ago

Thanks. Had to create the folder /var/lib/gvm/gvmd/gnupg and set right permission fixed the issue. Now having others permission issues:

libgvm base:CRITICAL:2022-04-21 23h55.00 utc:149: pidfile_create: failed to open pidfile: Permission denied

Dexus commented 2 years ago

Unfortunately, we cannot support you if you have problems with your own developments.

But maybe you should have a look into my greenbone-gvm-openvas-for-docker build.