29 lines
826 B
Docker
29 lines
826 B
Docker
# Low-interaction SSH honeypot image (Podman/Docker compatible).
|
|
FROM python:3.12-slim
|
|
|
|
# Don't write .pyc, flush stdout/stderr immediately so `podman logs` is live.
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
HONEYPOT_HOST_KEY=/data/host_key \
|
|
HONEYPOT_LOG_DIR=/data/logs \
|
|
HONEYPOT_BIND=0.0.0.0 \
|
|
HONEYPOT_PORT=2222
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY ssh_honeypot.py .
|
|
|
|
# Run as an unprivileged user. /data is where the host key and logs persist;
|
|
# mount a volume here so they survive container restarts.
|
|
RUN useradd --uid 1000 --create-home --shell /usr/sbin/nologin honeypot \
|
|
&& mkdir -p /data/logs \
|
|
&& chown -R honeypot:honeypot /data
|
|
USER honeypot
|
|
|
|
VOLUME ["/data"]
|
|
EXPOSE 2222
|
|
|
|
ENTRYPOINT ["python", "ssh_honeypot.py"]
|