healthcheck, watch pid not cpu
cleanup dockerfiles
bump dicompot, heralding, elasticpot, endlessh to alpine 3.19
bump dionaea, heralding to latest master
This commit is contained in:
t3chn0m4g3 2024-02-28 19:07:22 +01:00
parent 285b37a00d
commit be74fc75ca
69 changed files with 314 additions and 190 deletions

View file

@ -5,11 +5,11 @@ COPY dist/ /root/dist/
# #
# Install packages # Install packages
RUN apk --no-cache -U add \ RUN apk --no-cache -U add \
git \ git \
procps \ procps \
py3-psutil \ py3-psutil \
py3-requests \ py3-requests \
python3 && \ python3 && \
# #
# Install adbhoney from git # Install adbhoney from git
git clone https://github.com/huuck/ADBHoney /opt/adbhoney && \ git clone https://github.com/huuck/ADBHoney /opt/adbhoney && \
@ -17,7 +17,7 @@ RUN apk --no-cache -U add \
# git checkout 2417a7a982f4fd527b3a048048df9a23178767ad && \ # git checkout 2417a7a982f4fd527b3a048048df9a23178767ad && \
git checkout 42afd98611724ca3d694a48b694c957e8d953db4 && \ git checkout 42afd98611724ca3d694a48b694c957e8d953db4 && \
cp /root/dist/adbhoney.cfg /opt/adbhoney && \ cp /root/dist/adbhoney.cfg /opt/adbhoney && \
cp /root/dist/cpu_check.py /opt/adbhoney && \ cp /root/dist/cpu_check.py / && \
sed -i 's/dst_ip/dest_ip/' /opt/adbhoney/adbhoney/core.py && \ sed -i 's/dst_ip/dest_ip/' /opt/adbhoney/adbhoney/core.py && \
sed -i 's/dst_port/dest_port/' /opt/adbhoney/adbhoney/core.py && \ sed -i 's/dst_port/dest_port/' /opt/adbhoney/adbhoney/core.py && \
# #
@ -32,8 +32,8 @@ RUN apk --no-cache -U add \
# #
# Set workdir and start adbhoney # Set workdir and start adbhoney
STOPSIGNAL SIGINT STOPSIGNAL SIGINT
# Adbhoney sometimes hangs at 100% CPU usage, if detected process will be killed and container restarts per docker-compose settings # Adbhoney sometimes hangs at 100% CPU usage, if detected container will become unhealthy and restarted by tpotinit
HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /opt/adbhoney/cpu_check.py HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /cpu_check.py $(pgrep -of run.py) 99
USER adbhoney:adbhoney USER adbhoney:adbhoney
WORKDIR /opt/adbhoney/ WORKDIR /opt/adbhoney/
CMD /usr/bin/python3 run.py CMD /usr/bin/python3 run.py

View file

@ -1,10 +1,42 @@
import psutil import psutil
import sys
import time
# Get the overall CPU usage percentage if len(sys.argv) != 3:
cpu_usage = psutil.cpu_percent(interval=1) print("Usage: script.py <PID> <CPU_USAGE_THRESHOLD>")
print(cpu_usage) sys.exit(1)
# Check CPU usage threshold
if cpu_usage >= 75: # Adjust the threshold as needed try:
exit(1) pid = int(sys.argv[1])
except ValueError:
print("Please provide a valid integer value for the PID.")
sys.exit(1)
try:
cpu_threshold = float(sys.argv[2])
except ValueError:
print("Please provide a valid number for the CPU usage threshold.")
sys.exit(1)
try:
target_process = psutil.Process(pid)
except psutil.NoSuchProcess:
print(f"No process with the PID {pid} was found.")
sys.exit(1)
# Prepare to calculate the average CPU usage over 3 intervals of 1 second each
cpu_usages = []
for _ in range(3):
cpu_usages.append(target_process.cpu_percent(interval=1))
# Calculate the average CPU usage
average_cpu_usage = sum(cpu_usages) / len(cpu_usages)
print(f"Average CPU Usage of PID {pid} over 3 seconds: {average_cpu_usage}%")
# Check average CPU usage against the threshold
if average_cpu_usage >= cpu_threshold:
print(f"Average CPU usage of PID {pid} is above or equal to the threshold of {cpu_threshold}%.")
sys.exit(1)
else: else:
exit(0) print(f"Average CPU usage of PID {pid} is below the threshold of {cpu_threshold}%. Exiting with code 0.")
sys.exit(0)

View file

@ -6,15 +6,15 @@ COPY dist/ /root/dist/
# Setup env and apt # Setup env and apt
RUN apk --no-cache -U upgrade && \ RUN apk --no-cache -U upgrade && \
apk --no-cache add build-base \ apk --no-cache add build-base \
git \ git \
libffi \ libffi \
libffi-dev \ libffi-dev \
openssl \ openssl \
openssl-dev \ openssl-dev \
py3-cryptography \ py3-cryptography \
py3-pip \ py3-pip \
python3 \ python3 \
python3-dev && \ python3-dev && \
# #
# Setup user # Setup user
addgroup -g 2000 ciscoasa && \ addgroup -g 2000 ciscoasa && \

View file

@ -2,11 +2,11 @@ FROM alpine:3.19
# #
# Install packages # Install packages
RUN apk --no-cache -U add \ RUN apk --no-cache -U add \
git \ git \
libcap \ libcap \
openssl \ openssl \
py3-pip \ py3-pip \
python3 && \ python3 && \
# #
pip3 install --break-system-packages --no-cache-dir python-json-logger && \ pip3 install --break-system-packages --no-cache-dir python-json-logger && \
# #

View file

@ -72,6 +72,7 @@ RUN apk --no-cache -U add \
wget https://www.wireshark.org/download/automated/data/manuf -o /usr/share/wireshark/manuf && \ wget https://www.wireshark.org/download/automated/data/manuf -o /usr/share/wireshark/manuf && \
cp /root/dist/conpot.cfg /etc/conpot/conpot.cfg && \ cp /root/dist/conpot.cfg /etc/conpot/conpot.cfg && \
cp -R /root/dist/templates /usr/lib/$(readlink -f $(type -P python3) | cut -f4 -d"/")/site-packages/conpot/ && \ cp -R /root/dist/templates /usr/lib/$(readlink -f $(type -P python3) | cut -f4 -d"/")/site-packages/conpot/ && \
cp /root/dist/cpu_check.py / && \
addgroup -g 2000 conpot && \ addgroup -g 2000 conpot && \
adduser -S -s /bin/ash -u 2000 -D -g 2000 conpot && \ adduser -S -s /bin/ash -u 2000 -D -g 2000 conpot && \
# #
@ -93,7 +94,7 @@ RUN apk --no-cache -U add \
# #
# Start conpot # Start conpot
STOPSIGNAL SIGINT STOPSIGNAL SIGINT
# Conpot sometimes hangs at 100% CPU usage, if detected process will be killed and container restarts per docker-compose settings # Conpot sometimes hangs at 100% CPU usage, if detected container will become unhealthy and restarted by tpotinit
HEALTHCHECK CMD if [ $(ps -C mpv -p 1 -o %cpu | tail -n 1 | cut -f 1 -d ".") -gt 75 ]; then kill -2 1; else exit 0; fi HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /cpu_check.py $(pgrep -of conpot) 99
USER conpot:conpot USER conpot:conpot
CMD exec /usr/bin/conpot --mibcache $CONPOT_TMP --temp_dir $CONPOT_TMP --template $CONPOT_TEMPLATE --logfile $CONPOT_LOG --config $CONPOT_CONFIG CMD exec /usr/bin/conpot --mibcache $CONPOT_TMP --temp_dir $CONPOT_TMP --template $CONPOT_TEMPLATE --logfile $CONPOT_LOG --config $CONPOT_CONFIG

42
docker/conpot/dist/cpu_check.py vendored Normal file
View file

@ -0,0 +1,42 @@
import psutil
import sys
import time
if len(sys.argv) != 3:
print("Usage: script.py <PID> <CPU_USAGE_THRESHOLD>")
sys.exit(1)
try:
pid = int(sys.argv[1])
except ValueError:
print("Please provide a valid integer value for the PID.")
sys.exit(1)
try:
cpu_threshold = float(sys.argv[2])
except ValueError:
print("Please provide a valid number for the CPU usage threshold.")
sys.exit(1)
try:
target_process = psutil.Process(pid)
except psutil.NoSuchProcess:
print(f"No process with the PID {pid} was found.")
sys.exit(1)
# Prepare to calculate the average CPU usage over 3 intervals of 1 second each
cpu_usages = []
for _ in range(3):
cpu_usages.append(target_process.cpu_percent(interval=1))
# Calculate the average CPU usage
average_cpu_usage = sum(cpu_usages) / len(cpu_usages)
print(f"Average CPU Usage of PID {pid} over 3 seconds: {average_cpu_usage}%")
# Check average CPU usage against the threshold
if average_cpu_usage >= cpu_threshold:
print(f"Average CPU usage of PID {pid} is above or equal to the threshold of {cpu_threshold}%.")
sys.exit(1)
else:
print(f"Average CPU usage of PID {pid} is below the threshold of {cpu_threshold}%. Exiting with code 0.")
sys.exit(0)

View file

@ -5,33 +5,33 @@ COPY dist/ /root/dist/
# #
# Get and install dependencies & packages # Get and install dependencies & packages
RUN apk --no-cache -U add \ RUN apk --no-cache -U add \
bash \ bash \
build-base \ build-base \
git \ git \
gmp-dev \ gmp-dev \
libcap \ libcap \
libffi-dev \ libffi-dev \
mpc1-dev \ mpc1-dev \
mpfr-dev \ mpfr-dev \
openssl \ openssl \
openssl-dev \ openssl-dev \
py3-appdirs \ py3-appdirs \
py3-asn1-modules \ py3-asn1-modules \
py3-attrs \ py3-attrs \
py3-bcrypt \ py3-bcrypt \
py3-cryptography \ py3-cryptography \
py3-dateutil \ py3-dateutil \
py3-greenlet \ py3-greenlet \
py3-mysqlclient \ py3-mysqlclient \
py3-openssl \ py3-openssl \
py3-packaging \ py3-packaging \
py3-parsing \ py3-parsing \
py3-pip \ py3-pip \
py3-service_identity \ py3-service_identity \
py3-treq \ py3-treq \
py3-twisted \ py3-twisted \
python3 \ python3 \
python3-dev && \ python3-dev && \
# #
# Setup user # Setup user
addgroup -g 2000 cowrie && \ addgroup -g 2000 cowrie && \

View file

@ -5,18 +5,18 @@ COPY dist/ /root/dist/
# #
# Install packages # Install packages
RUN apk --no-cache -U add \ RUN apk --no-cache -U add \
build-base \ build-base \
git \ git \
libcap \ libcap \
py3-colorama \ py3-colorama \
py3-greenlet \ py3-greenlet \
py3-pip \ py3-pip \
py3-schedule \ py3-schedule \
py3-sqlalchemy \ py3-sqlalchemy \
py3-twisted \ py3-twisted \
py3-wheel \ py3-wheel \
python3 \ python3 \
python3-dev && \ python3-dev && \
# #
# Install ddospot from GitHub and setup # Install ddospot from GitHub and setup
mkdir -p /opt && \ mkdir -p /opt && \

View file

@ -1,10 +1,13 @@
FROM alpine:3.17 FROM alpine:3.19
#
# Include dist
COPY dist/ /root/dist/
# #
# Setup apk # Setup apk
RUN apk -U add --no-cache \ RUN apk -U add --no-cache \
build-base \ build-base \
git \ git \
g++ && \ g++ && \
apk -U add --no-cache go --repository http://dl-3.alpinelinux.org/alpine/edge/community && \ apk -U add --no-cache go --repository http://dl-3.alpinelinux.org/alpine/edge/community && \
# #
# Setup go, build dicompot # Setup go, build dicompot
@ -20,6 +23,7 @@ RUN apk -U add --no-cache \
# Setup dicompot # Setup dicompot
mkdir -p /opt/dicompot/images && \ mkdir -p /opt/dicompot/images && \
cp /opt/go/bin/server /opt/dicompot && \ cp /opt/go/bin/server /opt/dicompot && \
cp -R /root/dist/dcm_pts/P1/ /opt/dicompot/images && \
# #
# Setup user, groups and configs # Setup user, groups and configs
addgroup -g 2000 dicompot && \ addgroup -g 2000 dicompot && \

View file

@ -7,7 +7,7 @@ services:
# Dicompot service # Dicompot service
# Get the Horos Client for testing: https://horosproject.org/ # Get the Horos Client for testing: https://horosproject.org/
# Get Dicom images (CC BY 3.0): https://www.cancerimagingarchive.net/collections/ # Get Dicom images (CC BY 3.0): https://dataverse.harvard.edu/dataverse/harvard/?q=dicom
# Put images (which must be in Dicom DCM format or it will not work!) into /data/dicompot/images # Put images (which must be in Dicom DCM format or it will not work!) into /data/dicompot/images
dicompot: dicompot:
build: . build: .
@ -22,5 +22,5 @@ services:
image: "dtagdevsec/dicompot:alpha" image: "dtagdevsec/dicompot:alpha"
read_only: true read_only: true
volumes: volumes:
- /data/dicompot/log:/var/log/dicompot - $HOME/tpotce/data/dicompot/log:/var/log/dicompot
# - /data/dicompot/images:/opt/dicompot/images # - $HOME/tpotce/data/dicompot/images:/opt/dicompot/images

View file

@ -17,36 +17,37 @@ RUN ARCH=$(arch) && \
apt install ./libemu2_0.2.0+git20120122-1.2+b1_$ARCH.deb \ apt install ./libemu2_0.2.0+git20120122-1.2+b1_$ARCH.deb \
./libemu-dev_0.2.0+git20120122-1.2+b1_$ARCH.deb -y && \ ./libemu-dev_0.2.0+git20120122-1.2+b1_$ARCH.deb -y && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
check \ check \
cmake \ cmake \
cython3 \ cython3 \
git \ git \
libcap2-bin \ libcap2-bin \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libev-dev \ libev-dev \
libglib2.0-dev \ libglib2.0-dev \
libloudmouth1-dev \ libloudmouth1-dev \
libnetfilter-queue-dev \ libnetfilter-queue-dev \
libnl-3-dev \ libnl-3-dev \
libpcap-dev \ libpcap-dev \
libssl-dev \ libssl-dev \
libtool \ libtool \
libudns-dev \ libudns-dev \
procps \ procps \
python3 \ python3 \
python3-dev \ python3-dev \
python3-boto3 \ python3-boto3 \
python3-bson \ python3-bson \
python3-yaml \ python3-yaml \
fonts-liberation && \ python3-psutil \
fonts-liberation && \
# #
# Get and install dionaea # Get and install dionaea
# Latest master is unstable, SIP causes crashing # git clone --depth=1 https://github.com/dinotools/dionaea -b 0.11.0 /root/dionaea/ && \
git clone --depth=1 https://github.com/dinotools/dionaea -b 0.11.0 /root/dionaea/ && \ git clone --depth=1 https://github.com/dinotools/dionaea /root/dionaea/ && \
cd /root/dionaea && \ cd /root/dionaea && \
#git checkout 1426750b9fd09c5bfeae74d506237333cd8505e2 && \ git checkout 4e459f1b672a5b4c1e8335c0bff1b93738019215 && \
mkdir build && \ mkdir build && \
cd build && \ cd build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dionaea .. && \ cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dionaea .. && \
@ -62,6 +63,7 @@ RUN ARCH=$(arch) && \
chown -R dionaea:dionaea /opt/dionaea/var && \ chown -R dionaea:dionaea /opt/dionaea/var && \
rm -rf /opt/dionaea/etc/dionaea/* && \ rm -rf /opt/dionaea/etc/dionaea/* && \
mv /root/dist/etc/* /opt/dionaea/etc/dionaea/ && \ mv /root/dist/etc/* /opt/dionaea/etc/dionaea/ && \
cp /root/dist/cpu_check.py / && \
# #
# Setup runtime and clean up # Setup runtime and clean up
apt-get purge -y \ apt-get purge -y \
@ -88,7 +90,7 @@ RUN ARCH=$(arch) && \
python3-bson \ python3-bson \
python3-yaml \ python3-yaml \
wget && \ wget && \
#
apt-get install -y \ apt-get install -y \
ca-certificates \ ca-certificates \
python3 \ python3 \
@ -111,7 +113,8 @@ RUN ARCH=$(arch) && \
# #
# Start dionaea # Start dionaea
STOPSIGNAL SIGINT STOPSIGNAL SIGINT
# Dionaea sometimes hangs at 100% CPU usage, if detected process will be killed and container restarts per docker-compose settings #
HEALTHCHECK CMD if [ $(ps -C mpv -p 1 -o %cpu | tail -n 1 | cut -f 1 -d ".") -gt 75 ]; then kill -2 1; else exit 0; fi # Dionaea sometimes hangs at 100% CPU usage, if detected container will become unhealthy and restarted by tpotinit
HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /cpu_check.py $(pgrep -of dionaea) 99
USER dionaea:dionaea USER dionaea:dionaea
CMD ["/opt/dionaea/bin/dionaea", "-u", "dionaea", "-g", "dionaea", "-c", "/opt/dionaea/etc/dionaea/dionaea.cfg"] CMD ["/opt/dionaea/bin/dionaea", "-u", "dionaea", "-g", "dionaea", "-c", "/opt/dionaea/etc/dionaea/dionaea.cfg"]

42
docker/dionaea/dist/cpu_check.py vendored Normal file
View file

@ -0,0 +1,42 @@
import psutil
import sys
import time
if len(sys.argv) != 3:
print("Usage: script.py <PID> <CPU_USAGE_THRESHOLD>")
sys.exit(1)
try:
pid = int(sys.argv[1])
except ValueError:
print("Please provide a valid integer value for the PID.")
sys.exit(1)
try:
cpu_threshold = float(sys.argv[2])
except ValueError:
print("Please provide a valid number for the CPU usage threshold.")
sys.exit(1)
try:
target_process = psutil.Process(pid)
except psutil.NoSuchProcess:
print(f"No process with the PID {pid} was found.")
sys.exit(1)
# Prepare to calculate the average CPU usage over 3 intervals of 1 second each
cpu_usages = []
for _ in range(3):
cpu_usages.append(target_process.cpu_percent(interval=1))
# Calculate the average CPU usage
average_cpu_usage = sum(cpu_usages) / len(cpu_usages)
print(f"Average CPU Usage of PID {pid} over 3 seconds: {average_cpu_usage}%")
# Check average CPU usage against the threshold
if average_cpu_usage >= cpu_threshold:
print(f"Average CPU usage of PID {pid} is above or equal to the threshold of {cpu_threshold}%.")
sys.exit(1)
else:
print(f"Average CPU usage of PID {pid} is below the threshold of {cpu_threshold}%. Exiting with code 0.")
sys.exit(0)

View file

@ -36,12 +36,12 @@ services:
image: "dtagdevsec/dionaea:alpha" image: "dtagdevsec/dionaea:alpha"
read_only: true read_only: true
volumes: volumes:
- /data/dionaea/roots/ftp:/opt/dionaea/var/dionaea/roots/ftp - $HOME/tpotce/data/dionaea/roots/ftp:/opt/dionaea/var/dionaea/roots/ftp
- /data/dionaea/roots/tftp:/opt/dionaea/var/dionaea/roots/tftp - $HOME/tpotce/data/dionaea/roots/tftp:/opt/dionaea/var/dionaea/roots/tftp
- /data/dionaea/roots/www:/opt/dionaea/var/dionaea/roots/www - $HOME/tpotce/data/dionaea/roots/www:/opt/dionaea/var/dionaea/roots/www
- /data/dionaea/roots/upnp:/opt/dionaea/var/dionaea/roots/upnp - $HOME/tpotce/data/dionaea/roots/upnp:/opt/dionaea/var/dionaea/roots/upnp
- /data/dionaea:/opt/dionaea/var/dionaea - $HOME/tpotce/data/dionaea:/opt/dionaea/var/dionaea
- /data/dionaea/binaries:/opt/dionaea/var/dionaea/binaries - $HOME/tpotce/data/dionaea/binaries:/opt/dionaea/var/dionaea/binaries
- /data/dionaea/log:/opt/dionaea/var/log - $HOME/tpotce/data/dionaea/log:/opt/dionaea/var/log
- /data/dionaea/rtp:/opt/dionaea/var/dionaea/rtp - $HOME/tpotce/data/dionaea/rtp:/opt/dionaea/var/dionaea/rtp

View file

@ -1,40 +1,40 @@
FROM alpine:3.17 FROM alpine:3.19
# #
# Include dist # Include dist
COPY dist/ /root/dist/ COPY dist/ /root/dist/
# #
# Install packages # Install packages
RUN apk -U --no-cache add \ RUN apk -U --no-cache add \
build-base \ build-base \
ca-certificates \ ca-certificates \
git \ git \
libffi-dev \ libffi-dev \
openssl \ openssl \
openssl-dev \ openssl-dev \
postgresql-dev \ postgresql-dev \
py3-cryptography \ py3-cryptography \
py3-elasticsearch \ py3-elasticsearch \
py3-geoip2 \ py3-geoip2 \
py3-maxminddb \ py3-maxminddb \
py3-mysqlclient \ py3-mysqlclient \
py3-packaging \ py3-packaging \
py3-psycopg2 \ py3-psycopg2 \
py3-redis \ py3-redis \
py3-requests \ py3-requests \
py3-service_identity \ py3-service_identity \
py3-setuptools \ py3-setuptools \
py3-pip \ py3-pip \
py3-twisted \ py3-twisted \
py3-wheel \ py3-wheel \
python3 \ python3 \
python3-dev && \ python3-dev && \
mkdir -p /opt && \ mkdir -p /opt && \
cd /opt/ && \ cd /opt/ && \
git clone https://gitlab.com/bontchev/elasticpot.git/ && \ git clone https://gitlab.com/bontchev/elasticpot.git/ && \
cd elasticpot && \ cd elasticpot && \
git checkout d12649730d819bd78ea622361b6c65120173ad45 && \ git checkout d12649730d819bd78ea622361b6c65120173ad45 && \
cp /root/dist/requirements.txt . && \ cp /root/dist/requirements.txt . && \
pip3 install -r requirements.txt && \ pip3 install --break-system-packages -r requirements.txt && \
# #
# Setup user, groups and configs # Setup user, groups and configs
addgroup -g 2000 elasticpot && \ addgroup -g 2000 elasticpot && \
@ -43,11 +43,11 @@ RUN apk -U --no-cache add \
# #
# Clean up # Clean up
apk del --purge build-base \ apk del --purge build-base \
git \ git \
libffi-dev \ libffi-dev \
openssl-dev \ openssl-dev \
postgresql-dev \ postgresql-dev \
python3-dev && \ python3-dev && \
rm -rf /root/* && \ rm -rf /root/* && \
rm -rf /var/cache/apk/* /opt/elasticpot/.git rm -rf /var/cache/apk/* /opt/elasticpot/.git
# #

View file

@ -19,4 +19,4 @@ services:
image: "dtagdevsec/elasticpot:alpha" image: "dtagdevsec/elasticpot:alpha"
read_only: true read_only: true
volumes: volumes:
- /data/elasticpot/log:/opt/elasticpot/log - $HOME/tpotce/data/elasticpot/log:/opt/elasticpot/log

View file

@ -1,13 +1,13 @@
FROM alpine:3.13 as builder FROM alpine:3.16 as builder
# #
# Include dist # Include dist
ADD dist/ /root/dist/ ADD dist/ /root/dist/
# #
# Install packages # Install packages
RUN apk -U add --no-cache \ RUN apk -U add --no-cache \
build-base \ build-base \
git \ git \
libcap && \ libcap && \
# #
# Install endlessh from git # Install endlessh from git
git clone https://github.com/skeeto/endlessh /opt/endlessh && \ git clone https://github.com/skeeto/endlessh /opt/endlessh && \
@ -16,13 +16,13 @@ RUN apk -U add --no-cache \
make && \ make && \
mv /opt/endlessh/endlessh /root/dist mv /opt/endlessh/endlessh /root/dist
# #
FROM alpine:3.17 FROM alpine:3.19
# #
COPY --from=builder /root/dist/* /opt/endlessh/ COPY --from=builder /root/dist/* /opt/endlessh/
# #
# Install packages # Install packages
RUN apk -U add --no-cache \ RUN apk -U add --no-cache \
libcap && \ libcap && \
# #
# Setup user, groups and configs # Setup user, groups and configs
mkdir -p /var/log/endlessh && \ mkdir -p /var/log/endlessh && \

View file

@ -1,31 +1,31 @@
FROM alpine:3.18 FROM alpine:3.19
# #
# Include dist # Include dist
COPY dist/ /root/dist/ COPY dist/ /root/dist/
# #
# Install packages # Install packages
RUN apk -U --no-cache add \ RUN apk -U --no-cache add \
build-base \ build-base \
git \ git \
libcap \ libcap \
libffi-dev \ libffi-dev \
openssl-dev \ openssl-dev \
py3-pyzmq \ py3-pyzmq \
postgresql-dev \ postgresql-dev \
py3-attrs \ py3-attrs \
py3-mysqlclient \ py3-mysqlclient \
py3-nose \ py3-nose \
py3-pip \ py3-pip \
py3-psycopg2 \ py3-psycopg2 \
py3-pycryptodome \ py3-pycryptodome \
py3-pyzmq \ py3-pyzmq \
py3-requests \ py3-requests \
py3-rsa \ py3-rsa \
py3-typing-extensions \ py3-typing-extensions \
py3-wheel \ py3-wheel \
py3-yaml \ py3-yaml \
python3 \ python3 \
python3-dev && \ python3-dev && \
# #
# Setup heralding # Setup heralding
mkdir -p /opt && \ mkdir -p /opt && \
@ -33,32 +33,32 @@ RUN apk -U --no-cache add \
# git clone https://github.com/johnnykv/heralding && \ # git clone https://github.com/johnnykv/heralding && \
git clone https://github.com/t3chn0m4g3/heralding && \ git clone https://github.com/t3chn0m4g3/heralding && \
cd heralding && \ cd heralding && \
git checkout 319065810d6e8ba62fb696a96584ac7500752380 && \ git checkout e863c8aa4cee6dd6308ccb20b2d6c816a0fda2a5 && \
cp /root/dist/requirements.txt . && \ cp /root/dist/requirements.txt . && \
pip3 install --upgrade pip && \ pip3 install --break-system-packages --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt && \ pip3 install --break-system-packages --no-cache-dir -r requirements.txt && \
pip3 install --no-cache-dir . && \ pip3 install --break-system-packages --no-cache-dir . && \
# #
# Setup user, groups and configs # Setup user, groups and configs
addgroup -g 2000 heralding && \ addgroup -g 2000 heralding && \
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 heralding && \ adduser -S -H -s /bin/ash -u 2000 -D -g 2000 heralding && \
mkdir -p /var/log/heralding/ /etc/heralding && \ mkdir -p /var/log/heralding/ /etc/heralding && \
mv /root/dist/heralding.yml /etc/heralding/ && \ mv /root/dist/heralding.yml /etc/heralding/ && \
setcap cap_net_bind_service=+ep /usr/bin/python3.11 && \ setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \
chown -R heralding:heralding /var/log/heralding && \ chown -R heralding:heralding /var/log/heralding && \
# #
# Clean up # Clean up
apk del --purge \ apk del --purge \
build-base \ build-base \
git \ git \
libcap \ libcap \
libffi-dev \ libffi-dev \
openssl-dev \ openssl-dev \
postgresql-dev \ postgresql-dev \
python3-dev && \ python3-dev && \
rm -rf /root/* \ rm -rf /root/* \
/var/cache/apk/* \ /var/cache/apk/* \
/opt/heralding /opt/heralding
# #
# Start Heralding # Start Heralding
STOPSIGNAL SIGINT STOPSIGNAL SIGINT

View file

@ -41,6 +41,6 @@ RUN apk --no-cache -U add \
# #
# Run tpotinit # Run tpotinit
WORKDIR /opt/tpot WORKDIR /opt/tpot
HEALTHCHECK --interval=5s CMD pgrep -f autoheal || exit 1 HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD pgrep -f autoheal || exit 1
STOPSIGNAL SIGKILL STOPSIGNAL SIGKILL
CMD ["/opt/tpot/entrypoint.sh"] CMD ["/opt/tpot/entrypoint.sh"]

View file

@ -305,7 +305,7 @@ echo
# Start autoheal if running on a supported os # Start autoheal if running on a supported os
if [ "${myOSTYPE}" != "linuxkit" ]; if [ "${myOSTYPE}" != "linuxkit" ];
then then
sleep 1 sleep 60
echo "# Dropping UDP connection tables to improve visibility of true source IPs." echo "# Dropping UDP connection tables to improve visibility of true source IPs."
/usr/sbin/conntrack -D -p udp /usr/sbin/conntrack -D -p udp
# Starting container health monitoring # Starting container health monitoring