tpotce/docker/deprecated/honeypy/Dockerfile

56 lines
2.1 KiB
Text
Raw Normal View History

2021-09-23 22:28:33 +00:00
FROM alpine:3.11
2019-12-27 19:58:22 +00:00
#
2019-03-08 21:32:09 +00:00
# Include dist
ADD dist/ /root/dist/
2019-12-27 19:58:22 +00:00
#
2019-03-08 21:32:09 +00:00
# Install packages
2021-09-23 22:28:33 +00:00
RUN sed -i 's/dl-cdn/dl-2/g' /etc/apk/repositories && \
apk -U --no-cache add \
build-base \
2019-03-08 21:32:09 +00:00
git \
2021-09-23 22:28:33 +00:00
libcap \
python2 \
python2-dev \
py2-pip && \
2019-12-27 19:58:22 +00:00
#
# Install virtualenv
2021-09-23 22:28:33 +00:00
pip install --no-cache-dir virtualenv && \
2019-12-27 19:58:22 +00:00
#
2019-03-08 21:32:09 +00:00
# Clone honeypy from git
2020-09-04 12:37:28 +00:00
git clone https://github.com/foospidy/HoneyPy /opt/honeypy && \
2019-03-08 21:32:09 +00:00
cd /opt/honeypy && \
2020-09-04 12:37:28 +00:00
git checkout feccab56ca922bcab01cac4ffd82f588d61ab1c5 && \
2019-03-10 18:15:59 +00:00
sed -i 's/local_host/dest_ip/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/local_port/dest_port/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/remote_host/src_ip/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/remote_port/src_port/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/service/proto/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/event/event_type/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/bytes/size/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/date_time/timestamp/g' /opt/honeypy/loggers/file/honeypy_file.py && \
2019-03-13 21:13:36 +00:00
sed -i 's/data,/data.decode("hex"),/g' /opt/honeypy/loggers/file/honeypy_file.py && \
2020-02-25 16:59:22 +00:00
sed -i 's/urllib3/urllib3 == 1.21.1/g' /opt/honeypy/requirements.txt && \
2019-03-08 21:32:09 +00:00
virtualenv env && \
cp /root/dist/services.cfg /opt/honeypy/etc && \
cp /root/dist/honeypy.cfg /opt/honeypy/etc && \
/opt/honeypy/env/bin/pip install -r /opt/honeypy/requirements.txt && \
2019-12-27 19:58:22 +00:00
#
2019-03-08 21:32:09 +00:00
# Setup user, groups and configs
2021-09-23 22:28:33 +00:00
addgroup -g 2000 honeypy && \
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 honeypy && \
2019-03-08 21:32:09 +00:00
chown -R honeypy:honeypy /opt/honeypy && \
2020-02-26 14:22:48 +00:00
setcap cap_net_bind_service=+ep /opt/honeypy/env/bin/python && \
2019-12-27 19:58:22 +00:00
#
2019-03-08 21:32:09 +00:00
# Clean up
2021-09-23 22:28:33 +00:00
apk del --purge build-base \
git \
python2-dev \
py2-pip && \
rm -rf /root/* && \
rm -rf /var/cache/apk/*
2019-12-27 19:58:22 +00:00
#
2021-09-23 22:28:33 +00:00
# Set workdir and start honeypy
2019-03-08 21:32:09 +00:00
USER honeypy:honeypy
WORKDIR /opt/honeypy
CMD ["/opt/honeypy/env/bin/python2", "/opt/honeypy/Honey.py", "-d"]