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
354 stars 102 forks source link

Unable to start scan (ospd.sock vs ospd-openvas.sock) #134

Closed kjake closed 2 years ago

kjake commented 2 years ago

Hi Scott, this issue is back in immauss/openvas:latest
md manage:WARNING:2022-07-13 17h50.52 UTC:22654: Could not connect to Scanner at /run/ospd/ospd-openvas.sock

root@photon-machine:/run/ospd# ls -alp
total 16
drwxrwx--- 2 gvm  gvm  4096 Jul 13 06:00 ./
drwxrwxrwx 1 root root 4096 Jul 13 06:00 ../
-rw-rw---- 1 root root    0 Jul  5 20:22 feed-update.lock
-rw-r--r-- 1 root root    3 Jul 13 06:00 ospd.pid
srwxrwxrwx 1 root gvm     0 Jul 13 06:00 ospd.sock

root@photon-machine:/run/ospd# ln -s ospd.sock ospd-openvas.sock fixes it

Originally posted by @kjake in https://github.com/immauss/openvas/issues/107#issuecomment-1183517582

immauss commented 2 years ago

:/ OK .... I'm going to add the link back into the startup ... which is now actually in single.sh and the change didn't make it there from start.sh ... sorry..

BUT... I really want to figure out why this works everywhere but in photon ...

Any help you can give would be greatly appreciated.

Thanks, Scott

immauss commented 2 years ago

It should be in the current latest now.

immauss commented 2 years ago

Couple of questions:

  1. How are you starting the container?
  2. What version of Photon are you using?
  3. How are you using Photon? ( docker, kubernets etc.... )

I spun up a Photon 4 R2 in a VM using the ova. started docker docker run -v openvas:/data -d -e SKIPSYNC=true -p 80:9392 --name openvas immauss/openvas Then I set up a scan of the photon host and it worked fine.

-Scott

kjake commented 2 years ago

Hey - that fixed it, and it's been working great!

On your questions:

  1. I set it up as a stack in Portainer - which says it is using docker-compose; here's my contents:
    services:
    openvas:
    ports:
      - "9392:9392"
    network_mode: host
    environment:
      - RELAYHOST="mail.local.com"
      - SMTPPORT=25
      - REDISDBS=512    # number of Redis DBs to use
      - QUIET=false     # dump feed sync noise to /dev/null
      - NEWDB=false     # only use this for creating a blank DB 
      - SKIPSYNC=false   # Skips the feed sync on startup.
      - RESTORE=false   # This probably not be used from compose... see docs.
      - DEBUG=false     # This will cause the container to stop and not actually start gvmd
      - HTTPS=false     # wether to use HTTPS or not
      - GMP=9390        # to enable see docs
      - GSATIMEOUT=3600
      - TZ="America/New_York"
    logging:
      driver: journald
    volumes:
      - /root/openvas:/data
    container_name: openvas
    image: immauss/openvas:latest
    restart: unless-stopped
  2. Yeah, still using Photon on this system.
    
    # cat /etc/lsb-release
    DISTRIB_ID="VMware Photon OS"
    DISTRIB_RELEASE="4.0"
    DISTRIB_CODENAME=Photon
    DISTRIB_DESCRIPTION="VMware Photon OS 4.0"

cat /etc/photon-release

VMware Photon OS 4.0 PHOTON_BUILD_NUMBER=2f5aad892

3. Pure single-host docker with just local storage
```bash
# docker info
Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 8
  Running: 8
  Paused: 0
  Stopped: 0
 Images: 8
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version:
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.10.103-2.ph4-esx
 Operating System: VMware Photon OS/Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.65GiB
 Name: photon-machine
 ID: YCEH:QITC:ZESO:7R4U:OSLV:YCOQ:5NBU:KQJY:LQTK:2OR4:N6TO:HIKG
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Seems like a thing that just happens to people? https://github.com/yu210148/gvm_install/issues/53

Reprovo commented 1 year ago

Hi. Thanks for the work you've put into this just to preface.

I am also facing a similar issue with running the image in a KVM vm. running Debian

md manage:WARNING:2023-09-13 04h28.05 UTC:302355: osp_scanner_feed_version: failed to connect to /var/run/ospd/ospd-openvas.sock md main:MESSAGE:2023-09-13 04h28.07 utc:302369: Greenbone Vulnerability Manager version 22.4.1 (DB revision 250)

I have to restart the container and it works for a relatively short time before reverting back to above.

root@214ebf330a9f:/# cd /var/run/ospd root@214ebf330a9f:/var/run/ospd# ls -larth total 16K drwxrwxrwx 1 root root 4.0K Sep 11 15:20 .. lrwxrwxrwx 1 root root 31 Sep 11 15:20 ospd.sock -> /var/run/ospd/ospd-openvas.sock -rw-r--r-- 1 root root 3 Sep 11 15:20 ospd-openvas.pid srwxrwx--- 1 root gvm 0 Sep 11 15:20 ospd-openvas.sock drwxrwx--- 2 gvm gvm 4.0K Sep 11 15:20 . root@214ebf330a9f:/var/run/ospd#

Would appreciate any feedback in this matter.