From d3d26eac0551784d287f937b34105718a746e0ab Mon Sep 17 00:00:00 2001 From: rsatrio Date: Fri, 14 Mar 2025 06:31:32 +0700 Subject: [PATCH] refactor: change command to get active network interface --- docker/_builder/builder.sh | 2 +- docker/fatt/Dockerfile | 2 +- docker/glutton/Dockerfile | 2 +- docker/p0f/Dockerfile | 2 +- docker/suricata/Dockerfile | 2 +- docker/suricata/Dockerfile.from.source | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/_builder/builder.sh b/docker/_builder/builder.sh index f9af1f0d..f796c0e5 100755 --- a/docker/_builder/builder.sh +++ b/docker/_builder/builder.sh @@ -18,7 +18,7 @@ PUSH_IMAGES=false NO_CACHE=false PARALLELBUILDS=2 UPLOAD_BANDWIDTH=40mbit # Set this to max 90% of available upload bandwidth -INTERFACE=$(/sbin/ip address show | /usr/bin/awk '/inet.*(brd|global)/{ print $NF; exit }') +INTERFACE=$(ip route | grep "^default" | awk '{ print $5 }') # Help message usage() { diff --git a/docker/fatt/Dockerfile b/docker/fatt/Dockerfile index 56e515e8..eb8a3d47 100644 --- a/docker/fatt/Dockerfile +++ b/docker/fatt/Dockerfile @@ -42,4 +42,4 @@ STOPSIGNAL SIGINT ENV PYTHONPATH /opt/fatt WORKDIR /opt/fatt USER fatt:fatt -CMD python3 fatt.py -i $(/sbin/ip address show | /usr/bin/awk '/inet.*(brd|global)/{ print $NF; exit }') --print_output --json_logging -o log/fatt.log +CMD python3 fatt.py -i $(ip route | grep "^default" | awk '{ print $5 }') --print_output --json_logging -o log/fatt.log diff --git a/docker/glutton/Dockerfile b/docker/glutton/Dockerfile index 8b3946ad..3ad73822 100644 --- a/docker/glutton/Dockerfile +++ b/docker/glutton/Dockerfile @@ -40,4 +40,4 @@ RUN apk -U --no-cache upgrade && \ # Start glutton WORKDIR /opt/glutton USER 2000:2000 -CMD exec bin/server -d true -i $(/sbin/ip address show | /usr/bin/awk '/inet.*(brd|global)/{ print $NF; exit }') -l /var/log/glutton/glutton.log > /dev/null 2>&1 +CMD exec bin/server -d true -i $(ip route | grep "^default" | awk '{ print $5 }') -l /var/log/glutton/glutton.log > /dev/null 2>&1 diff --git a/docker/p0f/Dockerfile b/docker/p0f/Dockerfile index d0986944..49dc256f 100644 --- a/docker/p0f/Dockerfile +++ b/docker/p0f/Dockerfile @@ -33,4 +33,4 @@ RUN apk --no-cache -U upgrade && \ # Start p0f WORKDIR /opt/p0f USER p0f:p0f -CMD exec /opt/p0f/p0f -u p0f -j -o /var/log/p0f/p0f.json -i $(/sbin/ip address show | /usr/bin/awk '/inet.*(brd|global)/{ print $NF; exit }') > /dev/null +CMD exec /opt/p0f/p0f -u p0f -j -o /var/log/p0f/p0f.json -i $(ip route | grep "^default" | awk '{ print $5 }') > /dev/null diff --git a/docker/suricata/Dockerfile b/docker/suricata/Dockerfile index 3c50f6cf..57d59b90 100644 --- a/docker/suricata/Dockerfile +++ b/docker/suricata/Dockerfile @@ -37,4 +37,4 @@ RUN apk --no-cache -U upgrade && \ # # Start suricata STOPSIGNAL SIGINT -CMD SURICATA_CAPTURE_FILTER=$(update.sh $OINKCODE) && exec suricata -v -F $SURICATA_CAPTURE_FILTER -i $(/sbin/ip address show | /usr/bin/awk '/inet.*(brd|global)/{ print $NF; exit }') +CMD SURICATA_CAPTURE_FILTER=$(update.sh $OINKCODE) && exec suricata -v -F $SURICATA_CAPTURE_FILTER -i $(ip route | grep "^default" | awk '{ print $5 }') diff --git a/docker/suricata/Dockerfile.from.source b/docker/suricata/Dockerfile.from.source index 60c36f14..41ef9c42 100644 --- a/docker/suricata/Dockerfile.from.source +++ b/docker/suricata/Dockerfile.from.source @@ -135,4 +135,4 @@ RUN apk -U add \ # # Start suricata STOPSIGNAL SIGINT -CMD SURICATA_CAPTURE_FILTER=$(update.sh $OINKCODE) && exec suricata -v -F $SURICATA_CAPTURE_FILTER -i $(/sbin/ip address show | /usr/bin/awk '/inet.*(brd|global)/{ print $NF; exit }') +CMD SURICATA_CAPTURE_FILTER=$(update.sh $OINKCODE) && exec suricata -v -F $SURICATA_CAPTURE_FILTER -i $(ip route | grep "^default" | awk '{ print $5 }')