Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Add section about exposing gvmd unix socket to host #163

Merged
merged 2 commits into from Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 57 additions & 0 deletions src/common/container/workflows.md
Expand Up @@ -50,3 +50,60 @@ docker-compose -f $DOWNLOAD_DIR/docker-compose.yml -p greenbone-community-editio

Afterwards, you can execute standard bash commands within the running container.

### Expose gvmd Unix Socket for GMP access

To allow using the {term}`GMP` protocol provided by {term}`gvmd` from the docker
host a [bind mount](https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes)
must be used for the `/run/gvmd` location. To make the gvmd unix socket
available, first of all a directory must be created and the permissions need to
be adjusted.

```sh
mkdir -p /tmp/gvm/gvmd
chmod -R 777 /tmp/gvm
```

Next the docker compose file needs to be changed as follows:

```diff
gvmd:
image: greenbone/gvmd:stable
restart: on-failure
volumes:
- gvmd_data_vol:/var/lib/gvm
- vt_data_vol:/var/lib/openvas
- psql_data_vol:/var/lib/postgresql
- - gvmd_socket_vol:/run/gvmd
+ - /tmp/gvm/gvmd:/run/gvmd
- ospd_openvas_socket_vol:/run/ospd
- psql_socket_vol:/var/run/postgresql
depends_on:
- pg-gvm

...

gsa:
image: greenbone/gsa:stable
restart: on-failure
ports:
- 9392:80
volumes:
- - gvmd_socket_vol:/run/gvmd
+ - /tmp/gvm/gvmd:/run/gvmd
depends_on:
- gvmd
```

After restarting the containers with

```bash
docker-compose -f $DOWNLOAD_DIR/docker-compose.yml -p greenbone-community-edition up -d
```

The unix socket should be available at `/tmp/gvm/gvmd/gvmd.sock`. For example
to use the socket with [gvm-tools](https://github.com/greenbone/gvm-tools) the
following command can be executed:

```bash
gvm-cli socket --socketpath /tmp/gvm/gvmd/gvmd.sock --pretty --xml "<get_version/>"
```