immauss / openvas

Containers for running the Greenbone Vulnerability Manager. Run as a single container with all services or separate single applications containers via docker-compose.
GNU Affero General Public License v3.0
337 stars 97 forks source link

[BUG] Container exits when starting #283

Open gooseleggs opened 4 days ago

gooseleggs commented 4 days ago

Describe the bug I am trying to use the 22.4.47 container. I think it worked the first time. However on each subsequent start, it quits as soon as it tries to start the scanner and then it just loops. I can get it to start by enabling SKIPSYNC=true.

This is the output of the issue. Note that this has been previously run, so the NVTs are up to date.

root@scanner:/opt/container/prod/openvas# docker compose up -d
root@scanner:/opt/container/prod/openvas# docker logs -f openvas
starting container at: Wed Jun 26 23:57:39 UTC 2024
Setting up container filesystem
/data/database/base already exists ...
 NOT moving data from image to /data
cp: cannot stat '/usr/local/var/lib/*': No such file or directory
chown: invalid user: ‘gvm:gvm’
cp: cannot stat '/var/lib/gvm/*': No such file or directory
cp: cannot stat '/var/lib/notus/*': No such file or directory
cp: cannot stat '/var/lib/openvas/*': No such file or directory
cp: cannot stat '/etc/gvm/*': No such file or directory
cp: cannot stat '/usr/local/etc/openvas/*': No such file or directory
Choosing container start method from:

Starting gvmd & openvas in a single container !!
Wait for redis socket to be created...
Testing redis status...
Redis ready.
Creating postgresql.conf and pg_hba.conf
Starting PostgreSQL...
waiting for server to start....2024-06-26 23:57:42.727 UTC [104] LOG:  redirecting log output to logging collector process
2024-06-26 23:57:42.727 UTC [104] HINT:  Future log output will appear in directory "/data/var-log/postgresql".
 done
server started
pg exit with 0 .
Checking for existing DB
Running first start configuration...
NEWDB=false
LOADDEFAULT=false
Current GVMd database version is 250
Migrate the database if needed.
Updating NVTs and other data
This could take a while if you are not using persistent storage for your NVTs
 or this is the first time pulling to your persistent storage.
 the time will be mostly dependent on your available bandwidth.
Checking age of current data feeds from Greenbone.
ImageFeeds=1717727332
InstalledFeeds=1717727332
Syncing all feeds from GB
Synchronizing the Notus feed from Immauss Cybersecurity
And all others from the GB Community feed
Running as root. Switching to user 'gvm' and group 'gvm'.
Trying to acquire lock on /var/lib/openvas/feed-update.lock
Acquired lock on /var/lib/openvas/feed-update.lock
⠋ Downloading Notus files from rsync://rsync.immauss.com/feeds/notus/ to
/var/lib/notus⠋ Downloading NASL files from
rsync://feed.community.greenbone.net/community/vulnerability-feed/22.04/vt-data/
nasl/ to /var/lib/openvas/pluginsReleasing lock on /var/lib/openvas/feed-update.lock
Trying to acquire lock on /var/lib/gvm/feed-update.lock
Acquired lock on /var/lib/gvm/feed-update.lock
⠋ Downloading SCAP data from
rsync://feed.community.greenbone.net/community/vulnerability-feed/22.04/scap-dat
a/ to /var/lib/gvm/scap-data⠋ Downloading CERT-Bund data from
rsync://feed.community.greenbone.net/community/vulnerability-feed/22.04/cert-dat
a/ to /var/lib/gvm/cert-data⠋ Downloading gvmd data from
rsync://feed.community.greenbone.net/community/data-feed/22.04/ to
/var/lib/gvm/data-objects/gvmd/22.04Releasing lock on /var/lib/gvm/feed-update.lock
Starting Greenbone Vulnerability Manager...
root@scanner:/opt/container/prod/openvas#

To Reproduce Steps to reproduce the behavior:

  1. I have a docker compose file
    
    services:
    openvas:
    image: immauss/openvas:22.4.47
    #    image: immauss/openvas:22.4.40
    container_name: openvas
    ports:
      - "127.0.0.1:80:9392"
    restart: always
    networks:
      - default
    volumes:
       - openvas:/data
    #    environment:
    #      SKIPSYNC: true

volumes: openvas:



3. When did the issue occur? 
  - whenever the container is started prior to scan with after started the first time

**Expected behavior**
GVM to start after feeds finished updating

**Environment (please complete the following information):**
 - OS: Debian 12.5
 - Memory available to OS:  8G
 - Container environment used with version: docker

**logs** ( commands assume the container name is 'openvas' )
Please attach the output from one of the following commands:

# docker-compose #
docker-compose logs > logfile.log
[docker-compose.txt](https://github.com/user-attachments/files/16006119/docker-compose.txt)
fashberg commented 4 days ago

i have the same prob. Docker image was 1 week old. Pulling the latest doesn't fix it. It seems the rsync feed brakes it

immauss commented 4 days ago

Can you run the sync manually after starting with skipsync and send the output?

Also, if you could copy out the gvmd.log, that might help as well.

Sorry for brevity, only have my phone.

-Scott

grandaor commented 1 day ago

I have the same issue.

$ docker exec -it openvas /scripts/sync.sh
Synchronizing the Notus feed from Immauss Cybersecurity
And all others from the GB Community feed
Running as root. Switching to user 'gvm' and group 'gvm'.
Trying to acquire lock on /var/lib/openvas/feed-update.lock
Acquired lock on /var/lib/openvas/feed-update.lock
⠧ Downloading Notus files from rsync://rsync.immauss.com/feeds/notus/ to /var/lib/notus
⠏ Downloading NASL files from rsync://feed.community.greenbone.net/community/vulnerability-feed/22.04/vt-data/nasl/ to 
/var/lib/openvas/plugins
Releasing lock on /var/lib/openvas/feed-update.lock
Trying to acquire lock on /var/lib/gvm/feed-update.lock
Acquired lock on /var/lib/gvm/feed-update.lock
⠸ Downloading SCAP data from rsync://feed.community.greenbone.net/community/vulnerability-feed/22.04/scap-data/ to 
/var/lib/gvm/scap-data
⠸ Downloading CERT-Bund data from rsync://feed.community.greenbone.net/community/vulnerability-feed/22.04/cert-data/ to 
/var/lib/gvm/cert-data
⠸ Downloading gvmd data from rsync://feed.community.greenbone.net/community/data-feed/22.04/ to 
/var/lib/gvm/data-objects/gvmd/22.04
Releasing lock on /var/lib/gvm/feed-update.lock