Project

General

Profile

Actions

Bug #35500

open

userdata/(:mac)/user-data doesn't work with mac from a smart-proxy

Added by Louis-Philippe Theriault over 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Unattended installations
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Hi,

Trying to provision a cloud-init system through a proxy (3.4.0-rc2).

The proxy doesn't seem to forward the request for a userdata/(:mac)/meta-data or userdata/(:mac)/user-data when providing the mac in the URL.

Details:

If I set the IPv4 Address when declaring the host, I can manage to get the meta-data rendered template using this “s=” URL:

Pointing to the server (WORKING):

ds=nocloud-net;s=http://foreman-server.example.com/userdata/

Logs (server):

2022-09-02T09:04:32 [I|app|36815f54] Started GET "/userdata/meta-data" for x.x.x.x at 2022-09-02 09:04:32 -0400
2022-09-02T09:04:32 [I|app|36815f54] Processing by UserdataController#metadata as TEXT
2022-09-02T09:04:32 [I|app|36815f54] Rendered text template (Duration: 0.0ms | Allocations: 1)
2022-09-02T09:04:32 [I|app|36815f54] Completed 200 OK in 11ms (Views: 0.4ms | ActiveRecord: 2.8ms | Allocations: 2978)
Pointing to the proxy (WORKING):

ds=nocloud-net;s=http://foreman-proxy.example.com:8000/userdata/

Logs (proxy):

2022-09-02T09:08:31 ab276f83 [I] Started GET /userdata/meta-data
2022-09-02T09:08:31 ab276f83 [I] Finished GET /userdata/meta-data with 200 (30.0 ms)
Logs (server):

2022-09-02T09:08:31 [I|app|50ba107b] Started GET "/userdata/meta-data?url=http%3A%2F%2Fforeman-proxy.example.com%3A8000" for x.x.x.x at 2022-09-02 09:08:31 -0400
2022-09-02T09:08:31 [I|app|50ba107b] Processing by UserdataController#metadata as TEXT
2022-09-02T09:08:31 [I|app|50ba107b] Parameters: {"url"=>"http://foreman-proxy.example.com:8000", "userdatum"=>{}}
2022-09-02T09:08:31 [I|app|50ba107b] Rendered text template (Duration: 0.0ms | Allocations: 1)
2022-09-02T09:08:31 [I|app|50ba107b] Completed 200 OK in 10ms (Views: 0.3ms | ActiveRecord: 2.7ms | Allocations: 2962)
So that tells me it is possible to fetch if from the proxy.

But if I remove the IPv4 Address in the host definition (I’d like to keep it MAC only), I can get it work work to the server but not via the proxy:

Pointing to the server (WORKING):

ds=nocloud-net;s=http://foreman-server.example.com/userdata/<%= @host.mac %>/

Logs (server):

2022-09-02T09:14:41 [I|app|1e9cf0e9] Started GET “/userdata/00:50:56:b0:95:09/meta-data” for x.x.x.x at 2022-09-02 09:14:41 -0400
2022-09-02T09:14:41 [I|app|1e9cf0e9] Processing by UserdataController#metadata as TEXT
2022-09-02T09:14:41 [I|app|1e9cf0e9] Parameters: {“mac”=>“00:50:56:b0:95:09”}
2022-09-02T09:14:41 [I|app|1e9cf0e9] Rendered text template (Duration: 0.0ms | Allocations: 1)
2022-09-02T09:14:41 [I|app|1e9cf0e9] Completed 200 OK in 22ms (Views: 0.4ms | ActiveRecord: 9.2ms | Allocations: 6998)

Pointing to the proxy (NOT WORKING):

ds=nocloud-net;s=http://foreman-proxy.example.com:8000/userdata/<%= @host.mac %>/

Logs (proxy):

2022-09-02T09:18:27 bcd693a1 [I] Started GET /userdata/00:50:56:b0:95:09/meta-data
2022-09-02T09:18:27 bcd693a1 [I] Finished GET /userdata/00:50:56:b0:95:09/meta-data with 404 (0.53 ms)
Logs (server):
nothing at all...

Looks like the proxy doesn’t forward to the server when adding the mac in the directory.

Ref:
https://github.com/theforeman/foreman/blob/46ca3e70847d36613d78b099dd69511e3a3bd4fa/config/routes.rb#L466

Actions #1

Updated by Marc Mueller almost 2 years ago

  • Category set to Unattended installations
  • Found in Releases 3.7.0 added

This seems to be still present in 3.7.0. And as the default preseed_* templates have been changed with issue #36180 to always include the mac in userdata requests, this issue becomes more pressing.

Actions

Also available in: Atom PDF