From a06f2538c3a0ca3546999bdbd375daa67dd74fb3 Mon Sep 17 00:00:00 2001 From: Leo Verto Date: Mon, 13 Dec 2021 17:46:59 +0000 Subject: [PATCH] Dockerize honeypot using multi-stage Dockerfile (#1) * Add Dockerfile * Add instructions for running as docker container --- .dockerignore | 6 ++++++ Dockerfile | 16 ++++++++++++++++ README.md | 11 ++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c5aeed3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +payloads/ +.idea/ +.dockerignore +.gitignore +Dockerfile +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a85c6f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# Build environment +FROM golang:1.17-alpine AS builder + +COPY . $GOPATH/src/github.com/Adikso/minecraft-log4j-honeypot +WORKDIR $GOPATH/src/github.com/Adikso/minecraft-log4j-honeypot +RUN go install . + +# Export binary only from builder environment +FROM alpine:latest AS runner + +COPY --from=builder /go/bin/minecraft-log4j-honeypot /usr/local/bin/minecraft-log4j-honeypot + +VOLUME payloads +EXPOSE 25565 + +ENTRYPOINT ["/usr/local/bin/minecraft-log4j-honeypot"] diff --git a/README.md b/README.md index 4334219..5ce86a0 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,19 @@ This honeypots runs fake Minecraft server (1.7.2 - 1.16.5 without snapshots) wai ## Running - +### Natively ``` git clone https://github.com/Adikso/minecraft-log4j-honeypot.git cd minecraft-log4j-honeypot go build . ./minecraft-log4j-honeypot ``` + +### Using docker +``` +git clone https://github.com/Adikso/minecraft-log4j-honeypot.git +cd minecraft-log4j-honeypot +docker build -t minecraft-log4j-honeypot . +mkdir payloads +docker run --rm -it --mount type=bind,source="${PWD}/payloads",target=/payloads --user=`id -u` -p 25565:25565 minecraft-log4j-honeypot +``` \ No newline at end of file