First time I am posting here, or ever in googel groups. So here goes nothing.
I have been trying to get a deployment of OWASP ZAP to run on Openshift 4.6. I initially altered the docker Image so it would be allowed to run on Openshift: see below.
FROM owasp/zap2docker-stable
USER root
RUN chown -R :0 /home/zap && \
chmod -R g+w /home/zap && \
chown -R :0 /zap && \
chmod -R g+w /zap
USER 1001
After that I was able to run the OWASP ZAP container in Openshift using the following deploymentconfig:
kind: Template
apiVersion: v1
metadata:
name: zap2docker
labels:
template: zap2docker
name: zap2docker
objects:
- kind: DeploymentConfig
metadata:
name: zap2docker
namespace: namespace-development
spec:
template:
metadata:
name: zap2docker
labels:
name: zap2docker
spec:
containers:
- name: zap2docker-myownimage
image: image-registry.openshift-image-registry.svc:5000/namespace-development/zap2docker-myownimage:latest
command: ["zap.sh"]
args:
- -daemon
- -host
- "0.0.0.0"
- -port
- "8080"
- -config
- -config
- api.addrs.addr.regex=true
- -config
- api.disablekey=true
- -silent
- -certfulldump
- /tmp/zap.cert
replicas: 1
selector:
name: zap2docker
strategy:
type: Rolling
- kind: Service
apiVersion: v1
metadata:
name: zap2docker
annotations:
description: Exposes and load balances the application pods
spec:
ports:
- name: zap2docker-port
port: 8080
targetPort: 8080
selector:
name: zap2docker
- kind: Route
apiVersion: v1
metadata:
name: zap2docker
labels:
app: zap2docker
route: ota
spec:
host: ""
to:
kind: Service
name: zap2docker
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
The container starts and I am able to run "curl localhost:8080" within the container itself, and it provides me with the expected result:
$ curl localhost:8080
<head>
<title>ZAP API UI</title>
</head>
<body>
<h1>Welcome to the OWASP Zed Attack Proxy (ZAP)</h1><p>ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications.</p><p></p><p>Please be aware that you should only attack applications that you have been specifically been given permission to test.</p><h2>Proxy Configuration</h2><p>To use ZAP effectively it is recommended that you configure your browser to proxy via ZAP.</p><p></p><p>The easiest way to do this is to launch your browser from ZAP via the "Quick Start / Manual Explore" panel - it will be configured to proxy via ZAP and ignore any certificate warnings.<br>Alternatively you can configure your browser manually or use the generated <a href="/OTHER/core/other/proxy.pac/?apinonce=b3996b4a8f505a36">PAC file</a>.</p><h2>Links</h2><li><a href="/UI">Local API</a></li><li><a href="
https://www.zaproxy.org/">ZAP Website</a></li><li><a href="
https://groups.google.com/group/zaproxy-users">ZAP User Group</a></li><li><a href="
https://groups.google.com/group/zaproxy-develop">ZAP Developer Group</a></li><li><a href="
https://github.com/zaproxy/zaproxy/issues">Report an issue</a></li></body>
I then tried to connect tot he container from another existing container using the service I created called zap2docker which works fine as well:
sh-4.2$ curl zap2docker:8080
<head>
<title>ZAP API UI</title>
</head>
<body>
<h1>Welcome to the OWASP Zed Attack Proxy (ZAP)</h1><p>ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications.</p><p></p><p>Please be aware that you should only attack applications that you have been specifically been given permission to test.</p><h2>Proxy Configuration</h2><p>To use ZAP effectively it is recommended that you configure your browser to proxy via ZAP.</p><p></p><p>The easiest way to do this is to launch your browser from ZAP via the "Quick Start / Manual Explore" panel - it will be configured to proxy via ZAP and ignore any certificate warnings.<br>Alternatively you can configure your browser manually or use the generated <a href="/OTHER/core/other/proxy.pac/?apinonce=b48509037b819842">PAC file</a>.</p><h2>Links</h2><li><a href="/UI">Local API</a></li><li><a href="
https://www.zaproxy.org/">ZAP Website</a></li><li><a href="
https://groups.google.com/group/zaproxy-users">ZAP User Group</a></li><li><a href="
https://groups.google.com/group/zaproxy-develop">ZAP Developer Group</a></li><li><a href="
https://github.com/zaproxy/zaproxy/issues">Report an issue</a></li></body>
Now I found out that the OWASP-ZAP container might redirect to https meaning that when I try to make a route using Edge termination and connect from outside the platform on 443 to the zap2docker service on 8080 it will result in a 302 loop as both parties keep trying to redirect to 443.
However, even when I create a route using RE-Encrypt termination (which should then work as both the container and the openshift paltform expect encrypted traffic) it also does not allow me to get to the welcome OWASP/ZAP welcome page from outside the openshift platform.
Additionally, passthrough also does not work, and no secure traffic at all (port 80) does not work either.
I also tried using a different port than 8080, but OWASP ZAP did not really enjoy that :).
Is there anyone that might have an idea on what I am doing wrong?
- Is the container forcing https over 8080? If so, can I turn it off with a parameter so I can let Openshift handle the https encryption?
- Is there possibly an Openshift termination I did not try yet?
Any help would be much appreciated :)
The goal for me is to be able to get to the hosted OWASP zap container to be able to run it in pipelines hosted outside of the Openshift platform. If there is no solution I might think about creating an API that connects to the OWASP ZAP container for me (using it as a bridge to allow me to connect from outside.
Thanks in advance,
Kind regards,
Ben