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

Conversation

divinehawk
Copy link

When using Hedgehog that has an OOB/VPN connection, ARKIME_NODE_HOST is set incorrectly to the IP address of the default gateway interface.

This patch will use the IP interface of the route for the OS_HOST, if set, rather than the default.

@mmguero
Copy link
Collaborator

mmguero commented Sep 11, 2024

Thanks, that makes sense. I'll get this pulled in to my development branch for the next release. See mmguero-dev/Malcolm@ef5e672

mmguero added a commit to mmguero-dev/Malcolm that referenced this pull request Sep 11, 2024
@mmguero
Copy link
Collaborator

mmguero commented Sep 11, 2024

I ended up tweaking it just a bit for cases where OS_HOST isn't already an IP address (i.e., it's a hostname):

Here's what I ended up on for that logic:

  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")

Thanks for the find!

Signed-off-by: Matt Eaton <git@divinehawk.com>
@divinehawk
Copy link
Author

divinehawk commented Sep 11, 2024

Updated this pull request just in case. Should I close it out?

@mmguero
Copy link
Collaborator

mmguero commented Sep 11, 2024

I've got already your commits pulled in to my development fork which is where I'll stage the release from, so this PR could be closed, but it's fine to just leave it open until I put the next release out.

@mmguero
Copy link
Collaborator

mmguero commented Sep 18, 2024

prepping for release, your commits have been pulled in manually. closing this PR.

@mmguero mmguero closed this Sep 18, 2024
@mmguero mmguero self-assigned this Sep 18, 2024
@mmguero mmguero added arkime Relating to Malcolm's use of Arkime sensor For issues dealing with the Hedgehog OS capture sensor bug Something isn't working labels Sep 18, 2024
@mmguero mmguero added this to the v24.09.0 milestone Sep 18, 2024
This was referenced Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arkime Relating to Malcolm's use of Arkime bug Something isn't working sensor For issues dealing with the Hedgehog OS capture sensor
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

2 participants