Skip to content

Commit

Permalink
flowgen_wrapper.sh: support domain names
Browse files Browse the repository at this point in the history
Create a wrapper script to support domain names to specify the
collector.
  • Loading branch information
msune committed Apr 21, 2024
1 parent df597ac commit 30db4e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#### Base Image: Debian 12 (Bookworm)
FROM debian:bookworm-slim as builder

RUN apt-get update && apt-get -y install gcc make
RUN apt-get update && apt-get -y install gcc make dnsutils
COPY * /tmp/
RUN cd tmp && make && ls -la
RUN apt-get -y clean && rm -rf /var/lib/apt/lists/*

FROM debian:bookworm-slim
COPY --from=builder /tmp/flowgen /usr/bin/
ENTRYPOINT ["/usr/bin/flowgen"]
COPY --from=builder /tmp/flowgen_wrapper.sh /usr/bin/
ENTRYPOINT ["/usr/bin/flowgen_wrapper.sh"]
9 changes: 9 additions & 0 deletions flowgen_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

# Attempt to resolve domain name
IP=$(dig +short ${@: -1})

#Print resolution
echo "Sending flow records to ${IP}..."
flowgen ${@:1:$#-1} ${IP}

0 comments on commit 30db4e6

Please sign in to comment.