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

How do I run a scan using an existing container? #642

Closed
dopyoman opened this Issue Feb 14, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@dopyoman

dopyoman commented Feb 14, 2018

Reading through the docs running a scan involves spinning up an new container. But lets say I have a container with a web interface and created a scan. How do I trigger it through the cli?

I tried

docker exec -ti seccubus_test scan Example nmap

but get an error

OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"scan\": executable file not found in $PATH": unknown
@seccubus

This comment has been minimized.

Member

seccubus commented Feb 14, 2018

@dopyoman

This comment has been minimized.

dopyoman commented Feb 15, 2018

So, I have a docker-compose.yml file that might better explain what I'm trying to achieve.

version: '2'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - .\tmp-docker\certs:/etc/nginx/certs
      - .\tmp-docker\dhparam:/etc/nginx/dhparam
    environment:
      DEFAULT_HOST: nginx-proxy.local #default host
      CERT_NAME: mycertificate # Wildcard Certificate name without extension  

  openvas:
    image: mikesplain/openvas
    ports:
      - 4444:443
      - 9390:9390
    restart: always
    expose:
      - 4444
    environment:
      VIRTUAL_HOST: openvas.local
      VIRTUAL_PORT: 443
      VIRTUAL_PROTO: https
    container_name: openvas_test
    volumes:
      - .\tmp-docker\certs:/etc/nginx/certs

  seccubus:
    image: seccubus/seccubus
    ports:
      - 4443:443
      - 8080:80
    restart: always
    expose:
      - 4443
    environment:
      VIRTUAL_HOST: seccubus.local
      VIRTUAL_PORT: 443
      VIRTUAL_PROTO: https
      STACK: full
    container_name: seccubus_test
    volumes:
      - .\tmp-docker\certs:/etc/nginx/certs
      - .\tmp-docker\data:/opt/seccubus/data

networks:
  default:
    external:
      name: nginx-proxy

when I run docker-compose up an instance of seccubus is created with a container name of seccubus_test that I want to run commands against. I hope this better explains my question.

I want to avoid this every time I run a cli command on seccubus

image

@dopyoman dopyoman referenced this issue Feb 15, 2018

Closed

Mysql error #636

@seccubus

This comment has been minimized.

Member

seccubus commented Feb 15, 2018

On a 'bare' docker container docker run -ti seccubus/seccubus scan Example nmap will work, but it will stop the container when scanning is done. You could use this in e.g. a crontab of with Kubernetes (that's what we use).

docker exec will execute a system command on an already running container and thus bypasses the entrypoint.sh script.

You could use the following to start a scan via docker exec: docker exec -ti 194bb5cdf149 su - seccubus -c do-scan

@dopyoman

This comment has been minimized.

dopyoman commented Feb 15, 2018

Ohh ok I got you. The commands are accessible to the seccubus user not root. Ok and Just in case anyone else tries a full example command.

docker exec -ti seccubus_test su - seccubus -c "do-scan --workspace Example --scan nmap"

@dopyoman dopyoman closed this Feb 15, 2018

seccubus added a commit that referenced this issue Feb 16, 2018

seccubus added a commit that referenced this issue Feb 16, 2018

Update container doc to address #642 (#643)
* Updated README to address #642

* Fixe cmarkdown syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment