Decrease image size, use pyinstaller

This commit is contained in:
t3chn0m4g3 2024-11-26 13:38:26 +01:00
parent 626b657082
commit d28fcb6a22
3 changed files with 20 additions and 26 deletions
docker
ciscoasa
ddospot
elasticpot

View file

@ -1,7 +1,7 @@
FROM alpine:3.20 AS builder
#
# Install packages
RUN apk --no-cache add \
RUN apk --no-cache -U add \
build-base \
git \
libffi \

View file

@ -46,9 +46,9 @@ RUN pyinstaller ddospot.py \
--hidden-import twisted.internet.reactor \
--hidden-import twisted.names.client \
--hidden-import twisted.names.server \
--hidden-import=twisted.python \
--hidden-import=OpenSSL.crypto \
--hidden-import=OpenSSL.SSL
--hidden-import twisted.python \
--hidden-import OpenSSL.crypto \
--hidden-import OpenSSL.SSL
#
FROM alpine:3.20
COPY --from=builder /opt/ddospot/ddospot/dist/ddospot/ /opt/ddospot/ddospot

View file

@ -1,4 +1,4 @@
FROM alpine:3.19
FROM alpine:3.20 AS builder
#
# Include dist
COPY dist/ /root/dist/
@ -31,29 +31,23 @@ RUN apk --no-cache -U add \
mkdir -p /opt && \
cd /opt/ && \
git clone https://gitlab.com/bontchev/elasticpot.git/ && \
cd elasticpot && \
git checkout d12649730d819bd78ea622361b6c65120173ad45 && \
cp /root/dist/requirements.txt . && \
pip3 install --break-system-packages -r requirements.txt && \
cd elasticpot && \
git checkout d12649730d819bd78ea622361b6c65120173ad45 && \
cp /root/dist/requirements.txt .
WORKDIR /opt/elasticpot
RUN pip3 install --break-system-packages pyinstaller
RUN pip3 install --break-system-packages -r requirements.txt
RUN pyinstaller elasticpot.py \
--hidden-import output_plugins \
--hidden-import output_plugins.jsonlog
#
# Setup user, groups and configs
addgroup -g 2000 elasticpot && \
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 elasticpot && \
mv /root/dist/honeypot.cfg /opt/elasticpot/etc/ && \
#
# Clean up
apk del --purge build-base \
git \
libffi-dev \
openssl-dev \
postgresql-dev \
python3-dev && \
rm -rf /root/* \
/var/cache/apk/* \
/opt/elasticpot/.git
FROM alpine:3.20
COPY --from=builder /opt/elasticpot/dist/ /opt/
COPY --from=builder /opt/elasticpot/responses/ /opt/elasticpot/responses/
COPY --from=builder /root/dist/honeypot.cfg /opt/elasticpot/etc/
#
# Start elasticpot
STOPSIGNAL SIGINT
USER elasticpot:elasticpot
USER 2000:2000
WORKDIR /opt/elasticpot/
CMD ["/usr/bin/python3","elasticpot.py"]
CMD ["./elasticpot"]