owtf / owtf-docker

Docker repository for OWTF (64-bit Kali)
https://hub.docker.com/r/owtf/owtf/
BSD 3-Clause "New" or "Revised" License
33 stars 18 forks source link

Docker OWTF web interface inaccessible #15

Closed BrianHoldsworth closed 9 years ago

BrianHoldsworth commented 9 years ago

When I build and run the docker image, I am unable to connect to the mapped ports (8009, for example) to access the web interface. It appears that the config settings cause the web interface to be bound only to localhost within the container (see below).

        @owtfp
    http://owtf.org

[*] OWTF Version: 1.0.1, Release: LionHeart (Beta) 
[-] Loading framework please wait..
[*] 127.0.0.1:8008 <-- HTTP(S) Proxy to which requests can be directed
[*] http://127.0.0.1:8009 <-- Web UI URL
[-] Press Ctrl+C when you spawned a shell ;)
viyatb commented 9 years ago

Hi, what docker command did you ran? Can you try running your image using docker run -it --privileged --net=host <image-name>? --net=host exposes the localhost interface of the docker image.

BrianHoldsworth commented 9 years ago

Yes, I have tried that. I think the default.cfg of OWTF is limiting the UI to inside container only. Whether I map the ports "manually" or not, I get a connection refused. For example:

[bholdsworth:~/Development/pentest/owtf-docker] master ± docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[bholdsworth:~/Development/pentest/owtf-docker] master ± docker run -itd --privileged --net=host kali_owtf
f2f940bca985c1565ca2d56aad8d3bdff872a51f46c2d4996d5cb0da98589eea
[bholdsworth:~/Development/pentest/owtf-docker] master ± docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS               NAMES
f2f940bca985        kali_owtf           "/usr/bin/owtf_entry   12 seconds ago      Up 11 seconds                           angry_stallman      
[bholdsworth:~/Development/pentest/owtf-docker] master ± boot2docker ip
192.168.59.103
[bholdsworth:~/Development/pentest/owtf-docker] master ± wget 192.168.59.103:8009
--2015-08-10 10:22:12--  http://192.168.59.103:8009/
Connecting to 192.168.59.103:8009... failed: Connection refused.
viyatb commented 9 years ago

Some post-install steps actually happen after the you initialize the container. (this behavior will be changed soon :/) Can you run it once more, docker run -it --privileged --net=host kali_owtf? (just remove -d flag).

BrianHoldsworth commented 9 years ago

Sure, here is the output from stopping container, and running it again without '-d'

[bholdsworth:~/Development/pentest/owtf-docker] master ± docker run -it --privileged --net=host kali_owtf
[+] Postgres running on 127.0.0.1:54320
[+] OWTF db config points towards :
[+] New database configuration saved
DROP DATABASE
DROP ROLE
CREATE ROLE
CREATE DATABASE

 _____ _ _ _ _____ _____
|     | | | |_   _|   __|
|  |  | | | | | | |   __|
|_____|_____| |_| |__|

        @owtfp
    http://owtf.org

[*] OWTF Version: 1.0.1, Release: LionHeart (Beta) 
[-] Loading framework please wait..
[*] 127.0.0.1:8008 <-- HTTP(S) Proxy to which requests can be directed
[*] http://127.0.0.1:8009 <-- Web UI URL
[-] Press Ctrl+C when you spawned a shell ;)

I think it needs to have a Web UI URL that matches the IP assigned to the container, right?

viyatb commented 9 years ago

Hi, thanks. The image runs successfully on Linux, I think the problem might be with boot2docker VM interfering with --net=host flag. Can you try port-forwarding in boot2docker VM? The localhost address was used instead of 0.0.0.0 because OWTF workers were not working. Let me investigate the issue more though. :)

viyatb commented 9 years ago

Hey @BrianHoldsworth: we have just pushed a fix for the issue. Can you try this? docker run -it --privileged -p 8009:8009 -p 8010:8010 <image_name> -e

BrianHoldsworth commented 9 years ago

Yes, that does correct it for me. Thanks for looking into this. I had previously setup OWTF on my laptop using Virtual Box + Kail .iso image + OWTF Python installation process, and it is FAR SIMPLER to accomplish the same thing now with Docker. Of course, Docker is also great for pushing instances out to AWS for team sharing as well. Nice work!

viyatb commented 9 years ago

Yes, Docker + OWTF is awesome. Thanks for pointing out the bug, :)