forked from WebGoat/WebGoat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* all-in-one Dockerfile preparations * some cleanup * add to main pom and add links in index.html * updated deploy script from build pipeline * additional line feed just in case
- Loading branch information
Showing
9 changed files
with
290 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM openjdk:11.0.1-jre-slim-stretch | ||
|
||
ARG webgoat_version=v8.0.0-SNAPSHOT | ||
ENV webgoat_version_env=${webgoat_version} | ||
|
||
RUN apt-get update && apt-get install | ||
RUN useradd --home-dir /home/webgoat --create-home -U webgoat | ||
RUN apt-get -y install apt-utils nginx | ||
|
||
USER webgoat | ||
RUN cd /home/webgoat/; mkdir -p .webgoat-${webgoat_version} | ||
|
||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY index.html /usr/share/nginx/html/ | ||
COPY webgoat-server-${webgoat_version}.jar /home/webgoat/webgoat.jar | ||
COPY webwolf-${webgoat_version}.jar /home/webgoat/webwolf.jar | ||
COPY start.sh /home/webgoat | ||
|
||
EXPOSE 8080 | ||
EXPOSE 9090 | ||
|
||
ENV WEBGOAT_PORT 8080 | ||
ENV WEBGOAT_SSLENABLED false | ||
|
||
ENV GOATURL https://127.0.0.1:$WEBGOAT_PORT | ||
ENV WOLFURL http://127.0.0.1:9090 | ||
|
||
|
||
WORKDIR /home/webgoat | ||
ENTRYPOINT /bin/bash /home/webgoat/start.sh $webgoat_version_env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Docker all-in-one image | ||
|
||
## Docker build | ||
|
||
docker build --no-cache --build-arg webgoat_version=v8.0.0-SNAPSHOT -t webgoat/goatandwolf:latest . | ||
|
||
## Docker run | ||
|
||
docker run -d -p 80:8888 -p 8080:8080 -p 9090:9090 -e TZ=Europe/Amsterdam webgoat/goatandwolf:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<h1>OWASP WebGoat Training tools</h1> | ||
<p> | ||
Use the following links to access the WebGoat and WebWolf applications. | ||
Register a user using WebGoat. The same user can access WebWolf. | ||
</p> | ||
|
||
<h2>Use without special host name entries</h2> | ||
|
||
<table> | ||
<tr> | ||
<td>WebGoat URL</td> | ||
<td><a href="http://127.0.0.1:8080/WebGoat" target="_blank">http://127.0.0.1:8080/WebGoat</a></td> | ||
</tr> | ||
<tr> | ||
<td>WebWolf URL</td> | ||
<td><a href="http://127.0.0.1:9090/WebWolf" target="_blank">http://127.0.0.1:9090/WebWolf</a></td> | ||
</tr> | ||
<table> | ||
|
||
<h2>Use with www.webgoat.local and www.webwolf.local</h2> | ||
<p> | ||
Add the following entries to your local <b><i>hosts</i></b> file on Windows (c:\Windows\System32\drivers\etc\hosts) or Linux (/etc/hosts) | ||
|
||
<pre> | ||
127.0.0.1 www.webgoat.local www.webwolf.local | ||
</pre> | ||
Then use the following URL's: | ||
</p> | ||
<table> | ||
<tr> | ||
<td>WebGoat URL</td> | ||
<td><a href="http://www.webgoat.local/WebGoat" target="_blank">http://www.webgoat.local/WebGoat</a></td> | ||
</tr> | ||
<tr> | ||
<td>WebWolf URL</td> | ||
<td><a href="http://www.webwolf.local/WebWolf" target="_blank">http://www.webwolf.local/WebWolf</a></td> | ||
</tr> | ||
<table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
error_log /tmp/error.log; | ||
pid /tmp/nginx.pid; | ||
|
||
worker_processes 1; | ||
|
||
events { worker_connections 1024; } | ||
|
||
http { | ||
|
||
client_body_temp_path /tmp/client_body; | ||
fastcgi_temp_path /tmp/fastcgi_temp; | ||
proxy_temp_path /tmp/proxy_temp; | ||
scgi_temp_path /tmp/scgi_temp; | ||
uwsgi_temp_path /tmp/uwsgi_temp; | ||
|
||
sendfile on; | ||
|
||
upstream docker-webgoat { | ||
server 127.0.0.1:8080; | ||
} | ||
|
||
upstream docker-webwolf { | ||
server 127.0.0.1:9090; | ||
} | ||
|
||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
|
||
server { | ||
listen 8888; | ||
server_name www.webgoat.local; | ||
|
||
root /var/www; | ||
|
||
access_log /tmp/goataccess.log; | ||
error_log /tmp/goaterror.log; | ||
|
||
location ~* \.(png|jpg|jpeg|gif|ico|woff|otf|ttf|mvc|svg|txt|pdf|docx?|xlsx?)$ { | ||
access_log off; | ||
proxy_pass http://docker-webgoat; | ||
proxy_redirect off; | ||
} | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
add_header Cache-Control no-cache; | ||
expires 0; | ||
} | ||
|
||
location /WebGoat { | ||
proxy_pass http://docker-webgoat; | ||
proxy_redirect off; | ||
} | ||
|
||
} | ||
|
||
server { | ||
listen 8888; | ||
server_name www.webwolf.local; | ||
|
||
root /var/www; | ||
|
||
access_log /tmp/wolfaccess.log; | ||
error_log /tmp/wolferror.log; | ||
|
||
location /WebGoat/PasswordReset/ForgotPassword/create-password-reset-link { | ||
proxy_pass http://docker-webgoat; | ||
proxy_redirect off; | ||
} | ||
|
||
location /PasswordReset/reset/reset-password { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /files { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /tmpdir { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /webjars { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /css { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /login { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /images { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /mail { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /upload { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /js { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /landing { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /logout { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
location /WebWolf { | ||
proxy_pass http://docker-webwolf; | ||
proxy_redirect off; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>webgoat-all-in-one-docker</artifactId> | ||
<packaging>jar</packaging> | ||
<parent> | ||
<groupId>org.owasp.webgoat</groupId> | ||
<artifactId>webgoat-parent</artifactId> | ||
<version>v8.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<version>1.8</version> | ||
<executions> | ||
<execution> | ||
<phase>install</phase> | ||
<configuration> | ||
<target> | ||
<copy file="../webgoat-server/target/webgoat-server-${project.version}.jar" tofile="webgoat-server-${project.version}.jar"/> | ||
<copy file="../webwolf/target/webwolf-${project.version}.jar" tofile="webwolf-${project.version}.jar"/> | ||
</target> | ||
</configuration> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
cd /home/webgoat | ||
service nginx start | ||
sleep 1 | ||
java -Dfile.encoding=UTF-8 -jar webgoat.jar --webgoat.build.version=$1 --server.address=0.0.0.0 > webgoat.log & | ||
|
||
sleep 10 | ||
|
||
java -Dfile.encoding=UTF-8 -jar webwolf.jar --webgoat.build.version=$1 --server.address=0.0.0.0 > webwolf.log & | ||
|
||
tail -300f webgoat.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters