From 6af76b7c11058c9168b279bf200220e3c53e7e2c Mon Sep 17 00:00:00 2001 From: Avinash Sudhodanan Date: Wed, 29 Nov 2017 17:23:17 +0100 Subject: [PATCH] Modified Dockerfile to include ZAP Added requirements (should remove if not needed) Updated port 8000 to 80 for ESS.py --- Dockerfile | 23 ++++++++++++++++------- ess.py | 2 +- requirements.txt | 1 - 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 33e7e33..3179ce2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Use an official Python runtime as a parent image -FROM python:2.7.13 +#From ZAP's docker image +FROM owasp/zap2docker-stable # Set the working directory to /app WORKDIR /app @@ -7,14 +7,23 @@ WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app +USER root # Install any needed packages specified in requirements.txt -RUN pip install -r requirements.txt +RUN pip install flask + +# Install any needed packages specified in requirements.txt +RUN pip install flask-httpauth + +# Install any needed packages specified in requirements.txt +RUN pip install requests # Make port 80 available to the world outside this container -EXPOSE 80 +EXPOSE 8000 + +#Run ZAP in daemon mode +RUN chmod +x ./../zap/zap.sh +CMD python ess.py & ./../zap/zap.sh -daemon -host 0.0.0.0 -port 8080 -config api.disablekey=true &&fg -# Define environment variable -ENV NAME World # Run app.py when the container launches -CMD ["python", "ess.py"] +#CMD ["python", "ess.py"] diff --git a/ess.py b/ess.py index d096e9d..53f9bd9 100644 --- a/ess.py +++ b/ess.py @@ -14,7 +14,7 @@ import os target = '0.0.0.0' #indicates in which IP address the API listents to -por = 8000 #indicates the port in +por = 80 #indicates the port in api_version='r3' #represents the current version of the API zap=ZAPv2() #call to the OWAZP ZAP python API library (https://github.com/zaproxy/zaproxy/wiki/ApiPython) app = Flask(__name__, static_url_path = "") diff --git a/requirements.txt b/requirements.txt index a686981..6e08dc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ flask flask-httpauth -python-owasp-zap-v2.4 requests