Skip to content

Commit d880329

Browse files
Add option in daemonset for suricata listening interface (#102)
1 parent b14a093 commit d880329

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

deploy/suricata-daemon/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM node:lts-bullseye-slim
22

33
RUN apt update
4-
RUN apt install suricata git -y
4+
RUN apt install suricata git iproute2 procps -y
55

66
WORKDIR /app
77

deploy/suricata-daemon/entrypoint.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@ echo "STARTING"
77

88
# INTERFACE=$(ip link | grep -w -P -o "eth.*(?=:)" | awk "NR==1{print $1}")
99
# TODO : grep this from interfaces. Ignore part after @
10-
INTERFACE="eth0"
1110

12-
sed -i "s/\${INTERFACE}/eth0/g" /etc/suricata/suricata.yaml
13-
14-
echo "starting suricata"
15-
/usr/bin/suricata --pidfile /var/run/suricata.pid -c /etc/suricata/suricata.yaml -i $INTERFACE &
11+
if [[ -z "$METLO_LISTEN_INTERFACE" ]]; then
12+
echo "Metlo interface NOT PROVIDED"
13+
echo "Defaulting to interface eth0"
14+
sed -i "s/\${INTERFACE}/eth0/g" /etc/suricata/suricata.yaml
15+
echo $INTERFACE
16+
echo "starting suricata"
17+
/usr/bin/suricata --pidfile /var/run/suricata.pid -c /etc/suricata/suricata.yaml -i eth0 &
18+
else
19+
echo "Metlo interface PROVIDED ${METLO_LISTEN_INTERFACE}"
20+
sed -i "s/\${INTERFACE}/${INTERFACE}/g" /etc/suricata/suricata.yaml
21+
echo $METLO_LISTEN_INTERFACE
22+
echo "starting suricata"
23+
/usr/bin/suricata --pidfile /var/run/suricata.pid -c /etc/suricata/suricata.yaml -i $METLO_LISTEN_INTERFACE &
24+
fi
1625

1726
echo "starting metlo"
1827
node /etc/metlo-ingestor/ingestors/suricata/dist/index.js -s /tmp/eve.sock -u $METLO_ADDR -k $METLO_KEY &

0 commit comments

Comments
 (0)