From b0eb74b0afebb362fac08874cdbe2ad2511e2274 Mon Sep 17 00:00:00 2001 From: t3chn0m4g3 Date: Fri, 29 Nov 2024 17:58:07 +0100 Subject: [PATCH] bump to latest master, optmize image --- docker/ipphoney/Dockerfile | 36 +++++++++----------- docker/ipphoney/Dockerfile.old | 60 ++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 docker/ipphoney/Dockerfile.old diff --git a/docker/ipphoney/Dockerfile b/docker/ipphoney/Dockerfile index 6833c1d9..cd458d18 100644 --- a/docker/ipphoney/Dockerfile +++ b/docker/ipphoney/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.19 +FROM alpine:3.20 AS builder # # Include dist COPY dist/ /root/dist/ @@ -27,6 +27,7 @@ RUN apk --no-cache -U add \ py3-service_identity \ py3-setuptools \ py3-twisted \ + py3-tz \ py3-wheel \ python3 \ python3-dev && \ @@ -34,27 +35,22 @@ RUN apk --no-cache -U add \ cd /opt/ && \ git clone https://gitlab.com/bontchev/ipphoney.git/ && \ cd ipphoney && \ - git checkout 7ab1cac437baba17cb2cd25d5bb1400327e1bb79 && \ - cp /root/dist/requirements.txt . && \ - pip3 install --break-system-packages -r requirements.txt && \ - setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \ + git checkout 9da0a9e7f9d839e4522f56b3bb2b790d87d65457 && \ + cp /root/dist/requirements.txt . +WORKDIR /opt/ipphoney +RUN pip3 install --break-system-packages pyinstaller +RUN pip3 install --break-system-packages -r requirements.txt +RUN pyinstaller ipphoney.py \ + --hidden-import output_plugins \ + --hidden-import output_plugins.jsonlog # -# Setup user, groups and configs - addgroup -g 2000 ipphoney && \ - adduser -S -H -s /bin/ash -u 2000 -D -g 2000 ipphoney && \ - mv /root/dist/honeypot.cfg /opt/ipphoney/etc/ && \ -# -# Clean up - apk del --purge build-base \ - git \ - libffi-dev \ - openssl-dev \ - postgresql-dev \ - python3-dev && \ - rm -rf /root/* /var/cache/apk/* /opt/ipphoney/.git +FROM alpine:3.20 +COPY --from=builder /opt/ipphoney/dist/ /opt/ +COPY --from=builder /opt/ipphoney/responses/ /opt/ipphoney/responses/ +COPY dist/honeypot.cfg /opt/ipphoney/etc/ # # Start ipphoney STOPSIGNAL SIGINT -USER ipphoney:ipphoney +USER 2000:2000 WORKDIR /opt/ipphoney/ -CMD ["/usr/bin/python3","ipphoney.py"] +CMD ["./ipphoney"] diff --git a/docker/ipphoney/Dockerfile.old b/docker/ipphoney/Dockerfile.old new file mode 100644 index 00000000..6833c1d9 --- /dev/null +++ b/docker/ipphoney/Dockerfile.old @@ -0,0 +1,60 @@ +FROM alpine:3.19 +# +# Include dist +COPY dist/ /root/dist/ +# +# Install packages +RUN apk --no-cache -U add \ + build-base \ + ca-certificates \ + git \ + libcap \ + libffi-dev \ + openssl \ + openssl-dev \ + postgresql-dev \ + py3-cryptography \ + py3-elasticsearch \ + py3-geoip2 \ + py3-maxminddb \ + py3-mysqlclient \ + py3-requests \ + py3-packaging \ + py3-pip \ + py3-psycopg2 \ + py3-redis \ + py3-requests \ + py3-service_identity \ + py3-setuptools \ + py3-twisted \ + py3-wheel \ + python3 \ + python3-dev && \ + mkdir -p /opt && \ + cd /opt/ && \ + git clone https://gitlab.com/bontchev/ipphoney.git/ && \ + cd ipphoney && \ + git checkout 7ab1cac437baba17cb2cd25d5bb1400327e1bb79 && \ + cp /root/dist/requirements.txt . && \ + pip3 install --break-system-packages -r requirements.txt && \ + setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \ +# +# Setup user, groups and configs + addgroup -g 2000 ipphoney && \ + adduser -S -H -s /bin/ash -u 2000 -D -g 2000 ipphoney && \ + mv /root/dist/honeypot.cfg /opt/ipphoney/etc/ && \ +# +# Clean up + apk del --purge build-base \ + git \ + libffi-dev \ + openssl-dev \ + postgresql-dev \ + python3-dev && \ + rm -rf /root/* /var/cache/apk/* /opt/ipphoney/.git +# +# Start ipphoney +STOPSIGNAL SIGINT +USER ipphoney:ipphoney +WORKDIR /opt/ipphoney/ +CMD ["/usr/bin/python3","ipphoney.py"]