Swap Werkzeug for Caddy as the protocol layer for http and https decoy services. Flask keeps owning app logic (fake_app, custom_body, headers, syslog) on 127.0.0.1:8080; Caddy terminates h1/h2/h2c/h3 on the wire with real-world TLS/QUIC fingerprints. - Add `multi_enum` FieldType to ServiceConfigField + _coerce - Add `http_versions` field to HTTPService (h1/h2c) and HTTPSService (h1/h2/h3); selecting h3 emits UDP/443 port mapping in compose - Rewrite both Dockerfiles with multi-stage Caddy binary copy + setcap for port binding as the logrelay user - Entrypoints parse HTTP_VERSIONS JSON, render a Caddyfile, start Flask in background, wait for it, then exec Caddy - https/server.py drops direct TLS handling; Caddy owns the cert - Add ProxyFix to both server.py so Flask sees real attacker IPs - Frontend: multi_enum checkbox-group renderer in ServiceConfigFields; FormValue union extended to string[]; compactPayload skips [] - Fix stale test_smtp_relay_schema_matches_smtp: relay schema is a superset of smtp, not equal; update assertions accordingly
41 lines
1.3 KiB
Docker
41 lines
1.3 KiB
Docker
FROM caddy:2 AS caddy-bin
|
|
|
|
ARG BASE_IMAGE=debian:bookworm-slim@sha256:f9c6a2fd2ddbc23e336b6257a5245e31f996953ef06cd13a59fa0a1df2d5c252
|
|
FROM ${BASE_IMAGE}
|
|
|
|
COPY --from=caddy-bin /usr/bin/caddy /usr/bin/caddy
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
python3 python3-pip openssl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
|
RUN pip3 install --no-cache-dir flask jinja2
|
|
|
|
COPY syslog_bridge.py /opt/syslog_bridge.py
|
|
COPY instance_seed.py /opt/instance_seed.py
|
|
COPY server.py /opt/server.py
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
RUN mkdir -p /opt/tls
|
|
|
|
EXPOSE 443
|
|
|
|
RUN useradd -r -s /bin/false -d /opt logrelay \
|
|
&& chown -R logrelay:logrelay /opt/tls \
|
|
&& mkdir -p /etc/caddy /opt/.local/share/caddy /opt/.config/caddy \
|
|
&& chown -R logrelay:logrelay /etc/caddy /opt/.local /opt/.config \
|
|
&& apt-get update && apt-get install -y --no-install-recommends libcap2-bin \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& setcap 'cap_net_bind_service+eip' /usr/bin/caddy \
|
|
&& (find /usr/bin/ -maxdepth 1 -name 'python3*' -type f -exec setcap 'cap_net_bind_service+eip' {} \; 2>/dev/null || true)
|
|
|
|
ENV XDG_DATA_HOME=/opt/.local/share XDG_CONFIG_HOME=/opt/.config
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD kill -0 1 || exit 1
|
|
|
|
USER logrelay
|
|
ENTRYPOINT ["/entrypoint.sh"]
|