tpotce/docker/honeypy/Dockerfile

58 lines
2.2 KiB
Text
Raw Normal View History

FROM debian:buster-slim
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
RUN apt-get update -y && \
apt-get install -y \
build-essential \
2019-03-08 21:32:09 +00:00
git \
libcap2-bin \
python2 \
python2-dev \
python-pip && \
2019-12-27 19:58:22 +00:00
#
# Install virtualenv
pip install --no-cache-dir virtualenv==20.4.7 && \
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
addgroup --gid 2000 honeypy && \
adduser --system --no-create-home --shell /bin/bash --uid 2000 --disabled-password --disabled-login --gid 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
apt-get purge -y \
build-essential \
git \
python2-dev \
python-pip && \
apt-get autoremove --purge -y && \
apt-get clean && \
rm -rf /root/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
2019-12-27 19:58:22 +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"]