Project

General

Profile

Actions

Bug #8198

closed

[API] Consider X-Forwarded-For when setting Node ip_address on first ping

Added by Brett Smith over 8 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Radhika Chippada
Category:
API
Target version:
Story points:
1.0

Description

Problem: There's some Python at the bottom of the compute node install guide that creates the node record and sets up pings. It has some logic to detect the node's IP address. That logic does the wrong thing on nodes with a standard Debian-ish hosts setup: it'll get the IP address as 127.0.1.1 (from /etc/hosts), and create the node record with that. The script needs to be made smarter to choose a public IP address.

Solution:

  • The API server already has code to set the node's IP address on first ping, if it's not already set. Extend this code to account for the X-Forwarded-For header so it works behind the Nginx proxy. (This might be as simple as changing ENV['REMOTE_ADDR']request.remote_ip; rails has built-in support for X-Forwarded-For, including a configurable list of trusted proxies that includes 127.0.0.1 by default.)
  • Add a controller test to match.
  • Update the compute node install guide to remove the IP address detection and setting code from the Python script at the bottom.

Subtasks 1 (0 open1 closed)

Task #8271: Review branch: 8198-node-ip-addressResolvedPeter Amstutz01/12/2016Actions
Actions

Also available in: Atom PDF