Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set ARKIME_NODE_HOST from OS_HOST interface rather than default route #559

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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