Skip to content

Commit

Permalink
Set ARKIME_NODE_HOST from OS_HOST interface rather than default route
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Eaton <[email protected]>
  • Loading branch information
divinehawk committed Sep 11, 2024
1 parent 1b5e003 commit 564d916
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,16 @@ if [[ -n $SUPERVISOR_PATH ]] && [[ -r "$SUPERVISOR_PATH"/arkime/config.ini ]]; t
fi

# identify node in session metadata for PCAP reachback
PRIMARY_IP=$(ip route get 255.255.255.255 | grep -Po '(?<=src )(\d{1,3}.){4}' | sed "s/ //g")
ROUTE_DEST_IP=
if [[ -n "$OS_HOST" ]]; then
if [[ "$OS_HOST" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
ROUTE_DEST_IP="$OS_HOST"
else
ROUTE_DEST_IP=$(dig +short "$OS_HOST" 2>/dev/null | head -n 1)
fi
fi
[[ -n "$ROUTE_DEST_IP" ]] || ROUTE_DEST_IP=255.255.255.255
PRIMARY_IP=$(ip route get "$ROUTE_DEST_IP" | grep -Po '(?<=src )(\d{1,3}.){4}' | sed "s/ //g")
export ARKIME_NODE_NAME="$(hostname --long)"
export ARKIME_NODE_HOST="$PRIMARY_IP"

Expand Down

0 comments on commit 564d916

Please sign in to comment.