Allow explicitly setting the tap interface

Adding ARG and ENV directives allows users to explicitly set the tap interface at build time with `--buildargs` or at run time with `--env`. This is useful for hosts with multiple network interfaces, or when the tap interface isn't the second interface listed by `/sbin/ip address`.
This commit is contained in:
Patrick Coppock 2019-07-01 08:06:51 -05:00 committed by GitHub
parent 504e3f2734
commit bdb57d0e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,9 @@
FROM alpine
#
# Set tap interface
ARG TAP_IFACE
ENV TAP_IFACE $TAP_IFACE
#
# Include dist
ADD dist/ /root/dist/
#
@ -127,4 +131,4 @@ RUN apk -U --no-cache add \
#
# Start suricata
STOPSIGNAL SIGINT
CMD SURICATA_CAPTURE_FILTER=$(update.sh $OINKCODE) && exec suricata -v -F $SURICATA_CAPTURE_FILTER -i $(/sbin/ip address | grep '^2: ' | awk '{ print $2 }' | tr -d [:punct:])
CMD SURICATA_CAPTURE_FILTER=$(update.sh $OINKCODE) && exec suricata -v -F $SURICATA_CAPTURE_FILTER -i ${TAP_IFACE:-$(/sbin/ip address | grep '^2: ' | awk '{ print $2 }' | tr -d [:punct:])}