mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-01 12:32:12 +00:00
Continue work on builder
- add conditional proxy support - use xargs to parallelize image builds - some tweaking and notes
This commit is contained in:
parent
acf09bc160
commit
024d79d001
10 changed files with 123 additions and 25 deletions
|
@ -19,6 +19,10 @@ TPOT_GHCR_REPO=ghcr.io/telekom-security
|
||||||
TPOT_VERSION=testing
|
TPOT_VERSION=testing
|
||||||
|
|
||||||
# T-Pot platforms (architectures)
|
# T-Pot platforms (architectures)
|
||||||
# Most docker features are available on linux
|
# Most docker features are available on linux
|
||||||
TPOT_AMD64=linux/amd64
|
TPOT_AMD64=linux/amd64
|
||||||
TPOT_ARM64=linux/arm64
|
TPOT_ARM64=linux/arm64
|
||||||
|
|
||||||
|
# Proxy
|
||||||
|
# Set Proxy (i.e. "http://proxy:3128") to improve speed (while caching)
|
||||||
|
# PROXY="http://proxy:3128"
|
||||||
|
|
19
docker/_builder/builder.sh
Executable file
19
docker/_builder/builder.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ANSI color codes for green (OK) and red (FAIL)
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# List of services to build
|
||||||
|
services="adbhoney nginx map"
|
||||||
|
#test=$(docker compose config --services)
|
||||||
|
#echo $test
|
||||||
|
|
||||||
|
# Loop through each service
|
||||||
|
echo $services | tr ' ' '\n' | xargs -I {} -P 3 bash -c '
|
||||||
|
echo "Building service: {}" && \
|
||||||
|
docker compose build {} --no-cache 2>&1 > {}.log && \
|
||||||
|
echo -e "Service {}: [\033[0;32mOK\033[0m]" || \
|
||||||
|
echo -e "Service {}: [\033[0;31mFAIL\033[0m]"
|
||||||
|
'
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
# Common build config
|
# Common build config
|
||||||
x-common-build: &common-build
|
x-common-build: &common-build
|
||||||
|
args:
|
||||||
|
PROXY: ${PROXY}
|
||||||
dockerfile: ./Dockerfile
|
dockerfile: ./Dockerfile
|
||||||
platforms:
|
platforms:
|
||||||
- ${TPOT_AMD64}
|
- ${TPOT_AMD64}
|
||||||
|
|
|
@ -39,15 +39,19 @@ echo "Docs: https://docs.docker.com/desktop/multi-arch/"
|
||||||
echo
|
echo
|
||||||
echo "Example (build release): docker compose build"
|
echo "Example (build release): docker compose build"
|
||||||
echo
|
echo
|
||||||
echo "Example (push release): docker compose build --push"
|
echo "Example (build and push release): docker compose build --push"
|
||||||
echo
|
echo
|
||||||
echo "Example (build single image): docker compose build tpotinit"
|
echo "Example (build single image): docker compose build tpotinit"
|
||||||
echo
|
echo
|
||||||
echo "Example (build and push single image): docker compose build tpotinit --push"
|
echo "Example (build and push single image): docker compose build tpotinit --push"
|
||||||
echo
|
echo
|
||||||
echo "Resolve problems running ..."
|
echo "Resolve problems running buildx:"
|
||||||
echo "docker buildx create --use --name mybuilder"
|
echo "docker buildx create --use --name mybuilder"
|
||||||
echo "docker buildx inspect mybuilder --bootstrap"
|
echo "docker buildx inspect mybuilder --bootstrap"
|
||||||
echo "docker login -u <username>"
|
echo "docker login -u <username>"
|
||||||
echo "docker login ghcr.io - <username>"
|
echo "docker login ghcr.io - <username>"
|
||||||
echo
|
echo
|
||||||
|
echo "Resolve segmentation faults when building arm64 images in qemu on amd64:"
|
||||||
|
echo "docker run --rm --privileged multiarch/qemu-user-static --reset -p yes"
|
||||||
|
echo
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
FROM alpine:3.19
|
FROM alpine:3.19
|
||||||
|
ARG PROXY
|
||||||
|
ENV http_proxy=${PROXY}
|
||||||
#
|
#
|
||||||
# Include dist
|
# Include dist
|
||||||
COPY dist/ /root/dist/
|
COPY dist/ /root/dist/
|
||||||
#
|
#
|
||||||
# Install packages
|
# Install packages, use proxy if available and cache using http
|
||||||
RUN apk --no-cache -U add \
|
RUN ash -c 'if [ -n "${http_proxy}" ]; then \
|
||||||
|
sed -i "s/https/http/g" /etc/apk/repositories; \
|
||||||
|
echo "Using HTTP Proxy at ${http_proxy}"; \
|
||||||
|
else \
|
||||||
|
echo "HTTP Proxy not configured, proceeding without proxy"; \
|
||||||
|
fi' && \
|
||||||
|
# Setup apk
|
||||||
|
apk --no-cache -U add \
|
||||||
git \
|
git \
|
||||||
procps \
|
procps \
|
||||||
py3-psutil \
|
py3-psutil \
|
||||||
|
@ -28,7 +37,9 @@ RUN apk --no-cache -U add \
|
||||||
#
|
#
|
||||||
# Clean up
|
# Clean up
|
||||||
apk del --purge git && \
|
apk del --purge git && \
|
||||||
|
sed -i "s/http/https/g" /etc/apk/repositories && \
|
||||||
rm -rf /root/* /opt/adbhoney/.git /var/cache/apk/*
|
rm -rf /root/* /opt/adbhoney/.git /var/cache/apk/*
|
||||||
|
ENV http_proxy=""
|
||||||
#
|
#
|
||||||
# Set workdir and start adbhoney
|
# Set workdir and start adbhoney
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
|
|
|
@ -1,15 +1,27 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
ARG PROXY
|
||||||
|
ENV http_proxy=${PROXY}
|
||||||
#
|
#
|
||||||
# Include dist
|
# Include dist
|
||||||
COPY dist/ /root/dist/
|
COPY dist/ /root/dist/
|
||||||
#
|
#
|
||||||
|
# Check if APT_PROXY is set and configure apt to use the proxy
|
||||||
|
RUN bash -c 'if [ -n "${http_proxy}" ]; then \
|
||||||
|
echo "Using APT proxy at ${http_proxy}"; \
|
||||||
|
echo "Acquire::http::Proxy \"${http_proxy}\";" > /etc/apt/apt.conf.d/01proxy; \
|
||||||
|
else \
|
||||||
|
echo "APT proxy not configured, proceeding without proxy"; \
|
||||||
|
fi' && \
|
||||||
|
# bash -c 'echo "Acquire::http::Proxy::ports.ubuntu.com DIRECT;" > /etc/apt/apt.conf.d/99force-no-proxy' && \
|
||||||
|
#
|
||||||
# Determine arch, get and install packages
|
# Determine arch, get and install packages
|
||||||
RUN ARCH=$(arch) && \
|
ARCH=$(arch) && \
|
||||||
if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; fi && \
|
if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; fi && \
|
||||||
if [ "$ARCH" = "aarch64" ]; then ARCH="arm64"; fi && \
|
if [ "$ARCH" = "aarch64" ]; then ARCH="arm64"; fi && \
|
||||||
echo "$ARCH" && \
|
echo "$ARCH" && \
|
||||||
cd /root/dist/ && \
|
cd /root/dist/ && \
|
||||||
|
# Setup apt
|
||||||
apt-get update -y && \
|
apt-get update -y && \
|
||||||
apt-get install wget -y && \
|
apt-get install wget -y && \
|
||||||
wget http://ftp.us.debian.org/debian/pool/main/libe/libemu/libemu2_0.2.0+git20120122-1.2+b1_$ARCH.deb \
|
wget http://ftp.us.debian.org/debian/pool/main/libe/libemu/libemu2_0.2.0+git20120122-1.2+b1_$ARCH.deb \
|
||||||
|
@ -110,6 +122,7 @@ RUN ARCH=$(arch) && \
|
||||||
apt-get autoremove --purge -y && \
|
apt-get autoremove --purge -y && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /root/* /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /opt/dionaea/.git
|
rm -rf /root/* /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /opt/dionaea/.git
|
||||||
|
ENV http_proxy=""
|
||||||
#
|
#
|
||||||
# Start dionaea
|
# Start dionaea
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
#
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
# VARS
|
ARG PROXY
|
||||||
ENV ES_VER=8.14.2
|
ENV ES_VER=8.14.2
|
||||||
|
ENV http_proxy=${PROXY}
|
||||||
#
|
#
|
||||||
# Include dist
|
# Include dist
|
||||||
COPY dist/ /root/dist/
|
COPY dist/ /root/dist/
|
||||||
#
|
#
|
||||||
RUN apt-get update -y && \
|
# Check if APT_PROXY is set and configure apt to use the proxy only if it's available
|
||||||
|
RUN bash -c 'if [ -n "${http_proxy}" ]; then \
|
||||||
|
echo "Using APT proxy at ${http_proxy}"; \
|
||||||
|
echo "Acquire::http::Proxy \"${http_proxy}\";" > /etc/apt/apt.conf.d/01proxy; \
|
||||||
|
else \
|
||||||
|
echo "APT proxy not configured, proceeding without proxy"; \
|
||||||
|
fi' && \
|
||||||
|
# bash -c 'echo "Acquire::http::Proxy::ports.ubuntu.com DIRECT;" > /etc/apt/apt.conf.d/99force-no-proxy' && \
|
||||||
|
# Setup apt
|
||||||
|
apt-get update -y && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
aria2 \
|
aria2 \
|
||||||
curl && \
|
curl && \
|
||||||
|
@ -17,13 +27,15 @@ RUN apt-get update -y && \
|
||||||
if [ "$ARCH" = "aarch64" ]; then ES_ARCH="arm64"; fi && \
|
if [ "$ARCH" = "aarch64" ]; then ES_ARCH="arm64"; fi && \
|
||||||
echo "$ARCH" && \
|
echo "$ARCH" && \
|
||||||
cd /root/dist/ && \
|
cd /root/dist/ && \
|
||||||
|
mkdir -p /usr/share/elasticsearch/config /etc/elasticsearch && \
|
||||||
|
cp elasticsearch.yml /etc/elasticsearch/ && \
|
||||||
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VER-$ES_ARCH.deb && \
|
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VER-$ES_ARCH.deb && \
|
||||||
dpkg -i elasticsearch-$ES_VER-$ES_ARCH.deb && \
|
dpkg --force-confold -i elasticsearch-$ES_VER-$ES_ARCH.deb && \
|
||||||
#
|
#
|
||||||
# Add and move files
|
# Add and move files
|
||||||
# rm -rf /usr/share/elasticsearch/modules/x-pack-ml && \
|
# rm -rf /usr/share/elasticsearch/modules/x-pack-ml && \
|
||||||
mkdir -p /usr/share/elasticsearch/config && \
|
# mkdir -p /usr/share/elasticsearch/config && \
|
||||||
cp elasticsearch.yml /etc/elasticsearch/ && \
|
# cp elasticsearch.yml /etc/elasticsearch/ && \
|
||||||
#
|
#
|
||||||
# Setup user, groups and configs
|
# Setup user, groups and configs
|
||||||
groupmod -g 2000 elasticsearch && \
|
groupmod -g 2000 elasticsearch && \
|
||||||
|
@ -37,6 +49,7 @@ RUN apt-get update -y && \
|
||||||
apt-get purge aria2 -y && \
|
apt-get purge aria2 -y && \
|
||||||
apt-get autoremove -y --purge && \
|
apt-get autoremove -y --purge && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/*
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/*
|
||||||
|
ENV http_proxy=""
|
||||||
#
|
#
|
||||||
# Healthcheck
|
# Healthcheck
|
||||||
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9200/_cat/health'
|
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9200/_cat/health'
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
#
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
# VARS
|
ARG PROXY
|
||||||
ENV LS_VER=8.14.2
|
ENV LS_VER=8.14.2
|
||||||
|
ENV http_proxy=${PROXY}
|
||||||
|
#
|
||||||
# Include dist
|
# Include dist
|
||||||
COPY dist/ /root/dist/
|
COPY dist/ /root/dist/
|
||||||
#
|
#
|
||||||
# Setup env and apt
|
# Check if PROXY is set and configure apt to use the proxy
|
||||||
RUN apt-get update -y && \
|
RUN bash -c 'if [ -n "${http_proxy}" ]; then \
|
||||||
|
echo "Using APT proxy at ${http_proxy}"; \
|
||||||
|
echo "Acquire::http::Proxy \"${http_proxy}\";" > /etc/apt/apt.conf.d/01proxy; \
|
||||||
|
else \
|
||||||
|
echo "APT proxy not configured, proceeding without proxy"; \
|
||||||
|
fi' && \
|
||||||
|
# bash -c 'echo "Acquire::http::Proxy::ports.ubuntu.com DIRECT;" > /etc/apt/apt.conf.d/99force-no-proxy' && \
|
||||||
|
# Setup apt
|
||||||
|
apt-get update -y && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
aria2 \
|
aria2 \
|
||||||
bash \
|
bash \
|
||||||
|
@ -57,10 +67,11 @@ RUN apt-get update -y && \
|
||||||
# Clean up
|
# Clean up
|
||||||
apt-get autoremove -y --purge && \
|
apt-get autoremove -y --purge && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/*
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/*
|
||||||
|
ENV http_proxy=""
|
||||||
#
|
#
|
||||||
# Healthcheck
|
# Healthcheck
|
||||||
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9600'
|
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9600'
|
||||||
#
|
#
|
||||||
# Start logstash
|
# Start logstash
|
||||||
USER logstash:logstash
|
USER logstash:logstash
|
||||||
CMD ["./entrypoint.sh"]
|
CMD ["entrypoint.sh"]
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
ARG PROXY
|
||||||
|
ENV http_proxy=${PROXY}
|
||||||
#
|
#
|
||||||
# Include dist
|
# Include dist
|
||||||
COPY dist/ /root/dist/
|
COPY dist/ /root/dist/
|
||||||
#
|
#
|
||||||
|
# Check if APT_PROXY is set and configure apt to use the proxy only if it's available
|
||||||
|
RUN bash -c 'if [ -n "${http_proxy}" ]; then \
|
||||||
|
echo "Using APT proxy at ${http_proxy}"; \
|
||||||
|
echo "Acquire::http::Proxy \"${http_proxy}\";" > /etc/apt/apt.conf.d/01proxy; \
|
||||||
|
else \
|
||||||
|
echo "APT proxy not configured, proceeding without proxy"; \
|
||||||
|
fi' && \
|
||||||
|
# bash -c 'echo "Acquire::http::Proxy::ports.ubuntu.com DIRECT;" > /etc/apt/apt.conf.d/99force-no-proxy' && \
|
||||||
# Setup apt
|
# Setup apt
|
||||||
RUN apt-get update && \
|
apt-get update && \
|
||||||
apt-get update -y && \
|
|
||||||
#
|
#
|
||||||
# Install packages
|
# Install packages
|
||||||
apt-get install -y autoconf \
|
apt-get install -y autoconf \
|
||||||
|
@ -56,6 +65,7 @@ RUN apt-get update && \
|
||||||
libpq-dev && \
|
libpq-dev && \
|
||||||
apt-get autoremove -y --purge && \
|
apt-get autoremove -y --purge && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/* /opt/honeytrap/.git
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/* /opt/honeytrap/.git
|
||||||
|
ENV http_proxy=""
|
||||||
#
|
#
|
||||||
# Start honeytrap
|
# Start honeytrap
|
||||||
USER honeytrap:honeytrap
|
USER honeytrap:honeytrap
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
ARG PROXY
|
||||||
|
ENV http_proxy=${PROXY}
|
||||||
#
|
#
|
||||||
# Install packages
|
# Check if APT_PROXY is set and configure apt to use the proxy
|
||||||
RUN apt-get update -y && \
|
RUN bash -c 'if [ -n "${http_proxy}" ]; then \
|
||||||
|
echo "Using APT proxy at ${http_proxy}"; \
|
||||||
|
echo "Acquire::http::Proxy \"${http_proxy}\";" > /etc/apt/apt.conf.d/01proxy; \
|
||||||
|
else \
|
||||||
|
echo "APT proxy not configured, proceeding without proxy"; \
|
||||||
|
fi' && \
|
||||||
|
# bash -c 'echo "Acquire::http::Proxy::ports.ubuntu.com DIRECT;" > /etc/apt/apt.conf.d/99force-no-proxy' && \
|
||||||
|
# Setup apt
|
||||||
|
apt-get update -y && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
cargo \
|
cargo \
|
||||||
|
@ -19,8 +29,8 @@ RUN apt-get update -y && \
|
||||||
python3 \
|
python3 \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
rust-all && \
|
rust-all && \
|
||||||
pip3 install --upgrade pip && \
|
pip3 install --upgrade pip && \
|
||||||
pip3 install poetry pycurl && \
|
pip3 install poetry pycurl && \
|
||||||
#
|
#
|
||||||
# Install log4pot from GitHub and setup
|
# Install log4pot from GitHub and setup
|
||||||
mkdir -p /opt /var/log/log4pot && \
|
mkdir -p /opt /var/log/log4pot && \
|
||||||
|
@ -46,8 +56,9 @@ RUN apt-get update -y && \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
rust-all && \
|
rust-all && \
|
||||||
apt-get autoremove -y --purge && \
|
apt-get autoremove -y --purge && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /opt/Log4Pot/.git
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /opt/Log4Pot/.git
|
||||||
|
ENV http_proxy=""
|
||||||
#
|
#
|
||||||
# Start log4pot
|
# Start log4pot
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
|
|
Loading…
Reference in a new issue