DeineAgenturUG / greenbone-gvm-openvas-for-docker

The Greenbone Vulnerability Management (GVM) and OpenVAS Scanner for Docker!
MIT License
24 stars 7 forks source link

[Bug] Volumes not working #20

Closed AlexanderLieret closed 2 years ago

AlexanderLieret commented 2 years ago

Describe the bug When using volume bindings, the initialization and updates are not working.

To Reproduce Start GVM with this docker-compose.yml. All image variants have the same problem.

version: "3"
services:
    gvm:
        image: deineagenturug/gvm:latest-full
        #image: deineagenturug/gvm:latest-data-full
        #image: deineagenturug/gvm:latest
        volumes:
          - ./data-postgres:/opt/database
          - ./data-gvm:/var/lib/gvm
          - ./data-plugins:/var/lib/openvas/plugins
          - ./data-ssh:/etc/ssh
        environment:
          - USERNAME="admin"
          - PASSWORD="admin"
          - RELAYHOST="smtp"
          - SMTPPORT=25
          - AUTO_SYNC=true
          - HTTPS=true
          - TZ="UTC"
          - SSHD=false
          - DB_PASSWORD="none"
        ports:
          - "8080:9392"  # Web interface
          #- "2222:22"   # SSH for remote sensors
        restart: unless-stopped

Expected behavior Container starts and initializes the database, like running

docker run --rm -p 8080:9392 deineagenturug/gvm:latest-data-full

Screenshots

# tail /var/log/gvm/gvmd.log
md   main:WARNING:2022-04-25 11h05.15 utc:732: The gvmd data feed directory /var/lib/gvm/data-objects/gvmd or one of its subdirectories does not exist.
md manage:WARNING:2022-04-25 11h05.15 utc:761: update_scap: No SCAP db present, rebuilding SCAP db from scratch
md manage:   INFO:2022-04-25 11h05.15 utc:762: OSP service has different VT status (version 0) from database (version (null), 0 VTs). Starting update ...
md manage:   INFO:2022-04-25 11h05.15 utc:763: Initializing CERT database
md manage:   INFO:2022-04-25 11h05.16 utc:762: Updating VTs in database ... 0 new VTs, 0 changed VTs
md manage:   INFO:2022-04-25 11h05.16 utc:762: Updating VTs in database ... done (0 VTs).
md manage:   INFO:2022-04-25 11h05.16 utc:761: update_scap: Updating data from feed
md manage:WARNING:2022-04-25 11h05.16 utc:761: update_scap_cpes: No CPE dictionary found at /var/lib/gvm/scap-data/official-cpe-dictionary_v2.2.xml
md   main:MESSAGE:2022-04-25 11h05.25 utc:773:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-04-25 11h05.25 utc:773:    Getting users.
md manage:MESSAGE:2022-04-25 11h05.25 utc:773: No SCAP database found
md   main:MESSAGE:2022-04-25 11h05.25 utc:777:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-04-25 11h05.25 utc:777:    Creating user.
md manage:MESSAGE:2022-04-25 11h05.25 utc:777: No SCAP database found
md   main:MESSAGE:2022-04-25 11h05.25 utc:781:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-04-25 11h05.25 utc:781:    Getting users.
md manage:MESSAGE:2022-04-25 11h05.25 utc:781: No SCAP database found
md   main:MESSAGE:2022-04-25 11h05.25 utc:785:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-04-25 11h05.25 utc:785:    Modifying setting.
md manage:MESSAGE:2022-04-25 11h05.25 utc:785: No SCAP database found
md   main:MESSAGE:2022-04-25 11h05.25 utc:789:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-04-25 11h05.25 utc:789:    Modifying scanner.
md manage:MESSAGE:2022-04-25 11h05.25 utc:789: No SCAP database found
md   main:MESSAGE:2022-04-25 11h05.25 utc:805:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-04-25 11h05.25 utc:805:    Modifying scanner.
md manage:MESSAGE:2022-04-25 11h05.25 utc:805: No SCAP database found
md manage:WARNING:2022-04-25 11h05.26 utc:827: update_scap: No SCAP db present, rebuilding SCAP db from scratch
md manage:   INFO:2022-04-25 11h05.26 utc:827: update_scap: Updating data from feed
md manage:WARNING:2022-04-25 11h05.26 utc:827: update_scap_cpes: No CPE dictionary found at /var/lib/gvm/scap-data/official-cpe-dictionary_v2.2.xml
md manage:WARNING:2022-04-25 11h05.36 utc:839: update_scap: No SCAP db present, rebuilding SCAP db from scratch
md manage:   INFO:2022-04-25 11h05.36 utc:839: update_scap: Updating data from feed
md manage:WARNING:2022-04-25 11h05.36 utc:839: update_scap_cpes: No CPE dictionary found at /var/lib/gvm/scap-data/official-cpe-dictionary_v2.2.xml
md manage:WARNING:2022-04-25 11h05.46 utc:852: update_scap: No SCAP db present, rebuilding SCAP db from scratch
md manage:   INFO:2022-04-25 11h05.46 utc:852: update_scap: Updating data from feed
md manage:WARNING:2022-04-25 11h05.46 utc:852: update_scap_cpes: No CPE dictionary found at /var/lib/gvm/scap-data/official-cpe-dictionary_v2.2.xml

Host Device:

Image in use:

Additional context Add any other context about the problem here.

Dexus commented 2 years ago

please provide the logs of docker compose logs or docker-compose logs and also the logs from /var/log/supervisord/and /var/log/gvm/

I'm not able to reproduce it, just starting a new fresh container via docker-compose but can't see currently any problem here. But I wait 30 minutes to check then if the problem shows up.

ℹ️ A just started container, with volumes need his time to initialize. Based on system and internet connection (basically only the system does matter her) it takes minutes, hours or sometimes days to finish. If your webui is working after 5 minutes, look to the feed status you will see if the system has done it and is ready. If it is still updating you not ready.

AlexanderLieret commented 2 years ago

I don't see any network traffic on this machine which you would indicate that there is an upgrade in progress.

On my end it looks like the intialization fails because the inital download file is missing when mounting with paths.

Dexus commented 2 years ago

try the deineagenturug/gvm-develop image, maybe there is already the fix for your problem included, which will released I think at the end of the week.

Think the problem you have is fixed in develop version: https://github.com/DeineAgenturUG/greenbone-gvm-openvas-for-docker/commit/c54ed3731b35ecdb7515570e1a04451ad6aee6ea

AlexanderLieret commented 2 years ago

This is fixed in the development build. It took about 50 minutes to initialize on my end.