So I enabled DEBUG logging on Foreman-proxy, which produces the following lines on each request:
Foreman 2.4:
2021-05-05T12:05:31 71c0b4d5 [I] Started GET /unattended/iPXE bootstrap=1
2021-05-05T12:05:31 71c0b4d5 [D] Template: request for unattended/iPXE using {"bootstrap"=>"1", "url"=>"http://foreman.lbhr.htm.lan:8000"} at foreman.lbhr.htm.lan
2021-05-05T12:05:31 71c0b4d5 [D] Retrieving a template from https://foreman.lbhr.htm.lan//unattended/iPXE?bootstrap=1&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000
2021-05-05T12:05:31 71c0b4d5 [D] HTTP headers: {"CONNECTION"=>"keep-alive", "USER_AGENT"=>"iPXE/1.20.1+ (g4bd0)", "X-Forwarded-For"=>"192.168.255.151, foreman.lbhr.htm.lan"}
2021-05-05T12:05:31 71c0b4d5 [I] Finished GET /unattended/iPXE with 200 (112.4 ms)
Foreman 2.3:
2021-05-05T12:15:23 a5c13976 [I] Started GET /unattended/iPXE bootstrap=1
2021-05-05T12:15:23 a5c13976 [D] Template: request for unattended/iPXE using {"bootstrap"=>"1", "url"=>"http://foreman.lbhr.htm.lan:8000"} at foreman.lbhr.htm.lan
2021-05-05T12:15:23 a5c13976 [D] Retrieving a template from https://foreman.lbhr.htm.lan//unattended/iPXE?bootstrap=1&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000
2021-05-05T12:15:23 a5c13976 [D] HTTP headers: {"CONNECTION"=>"keep-alive", "USER_AGENT"=>"iPXE/1.20.1+ (g4bd0)", "X-Forwarded-For"=>"192.168.255.154, foreman.lbhr.htm.lan"}
2021-05-05T12:15:23 a5c13976 [I] Finished GET /unattended/iPXE with 200 (416.47 ms)
And shortly after this, a second request (which makes sense)
2021-05-05T12:15:26 d0795d4c [I] Started GET /unattended/iPXE mac=82%3A96%3A86%3Acf%3A26%3A71
2021-05-05T12:15:26 d0795d4c [D] Template: request for unattended/iPXE using {"mac"=>"82:96:86:cf:26:71", "url"=>"http://foreman.lbhr.htm.lan:8000"} at foreman.lbhr.htm.lan
2021-05-05T12:15:26 d0795d4c [D] Retrieving a template from https://foreman.lbhr.htm.lan//unattended/iPXE?mac=82%3A96%3A86%3Acf%3A26%3A71&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000
2021-05-05T12:15:26 d0795d4c [D] HTTP headers: {"CONNECTION"=>"keep-alive", "USER_AGENT"=>"iPXE/1.20.1+ (g4bd0)", "X-Forwarded-For"=>"192.168.255.154, foreman.lbhr.htm.lan"}
2021-05-05T12:15:27 d0795d4c [I] Finished GET /unattended/iPXE with 200 (284.99 ms)
I also added the following to the load_host_details
function:
logger.warn "mango #{query_params}"
Which prints the following on Foreman 2.4:
2021-05-05T12:07:42 [W|app|a6f512f0] mango {"bootstrap"=>"1", "url"=>"http://foreman.lbhr.htm.lan:8000", "format"=>"text", "controller"=>"unattended", "action"=>"host_template", "kind"=>"iPXE", "unattended"=>{}, "locale"=>nil, "ip"=>"192.168.255.15", "mac_list"=>[], "built"=>false}
And the following on Foreman 2.3:
2021-05-05T12:15:27 [W|app|1439d0c6] mango {"mac"=>"82:96:86:cf:26:71", "url"=>"http://foreman.lbhr.htm.lan:8000", "format"=>"text", "controller"=>"unattended", "action"=>"host_template", "kind"=>"iPXE", "unattended"=>{}, "locale"=>nil, "ip"=>"192.168.255.154, foreman.lbhr.htm.lan, 192.168.255.15", "mac_list"=>["82:96:86:cf:26:71"], "built"=>false}
So there is quite a bit of missing information in the request handled by Foreman 2.4.
Digging a bit futher into that, query_params[:mac_list]
is derived from the request.env
variable and that looks like this (rather big…):
2021-05-05T12:28:18 [W|app|abd70c47] mango request.env
{
"rack.version"=>[1, 6],
"rack.errors"=>#<IO:<STDERR>>,
"rack.multithread"=>true,
"rack.multiprocess"=>false,
"rack.run_once"=>false,
"SCRIPT_NAME"=>"",
"QUERY_STRING"=>"bootstrap=1&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000",
"SERVER_PROTOCOL"=>"HTTP/1.1",
"SERVER_SOFTWARE"=>"puma 5.1.1 At Your Service",
"GATEWAY_INTERFACE"=>"CGI/1.2",
"REMOTE_ADDR"=>"127.0.0.1",
"REQUEST_METHOD"=>"GET",
"REQUEST_PATH"=>"/unattended/iPXE",
"REQUEST_URI"=>"/unattended/iPXE?bootstrap=1&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000",
"HTTP_VERSION"=>"HTTP/1.1",
"HTTP_HOST"=>"foreman.lbhr.htm.lan",
"HTTP_ACCEPT_ENCODING"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
"HTTP_ACCEPT"=>"*/*, application/json,version=2",
"HTTP_USER_AGENT"=>"iPXE/1.20.1+ (g4bd0)",
"CONTENT_TYPE"=>"application/json",
"HTTP_X_FORWARDED_FOR"=>"192.168.255.151, foreman.lbhr.htm.lan, 192.168.255.15",
"HTTP_VIA"=>"1.1 foreman.lbhr.htm.lan",
"HTTP_X_FORWARDED_HOST"=>"foreman.lbhr.htm.lan",
"HTTP_X_FORWARDED_SERVER"=>"foreman.lbhr.htm.lan",
"HTTP_CONNECTION"=>"Keep-Alive", "puma.request_body_wait"=>0,
"SERVER_NAME"=>"foreman.lbhr.htm.lan",
"SERVER_PORT"=>"80",
"PATH_INFO"=>"/unattended/iPXE",
"puma.socket"=>#<TCPSocket:fd 25, AF_UNIX, localhost, /run/foreman.sock>,
"rack.hijack?"=>true,
"rack.hijack"=>#<Puma::Client:0x2b0062c2c06c @ready=true>,
"rack.input"=>#<Puma::NullIO:0x00005600c24c5798>, "rack.url_scheme"=>"http",
"HTTP_X_FORWARDED_PROTO"=>"https",
"HTTP_SSL_CLIENT_S_DN"=>"CN=foreman.lbhr.htm.lan,OU=FOREMAN_PROXY,O=FOREMAN,ST=North Carolina,C=US",
"HTTP_SSL_CLIENT_CERT"=>"-----BEGIN CERTIFICATE----- -----END CERTIFICATE-----",
"HTTP_SSL_CLIENT_VERIFY"=>"SUCCESS",
"rack.after_reply"=>[],
"puma.config"=> trimmed
"action_dispatch.http_auth_salt"=>"http authentication", "action_dispatch.signed_cookie_salt"=>"signed cookie", "action_dispatch.encrypted_cookie_salt"=>"encrypted cookie",
"action_dispatch.encrypted_signed_cookie_salt"=>"signed encrypted cookie",
"action_dispatch.authenticated_encrypted_cookie_salt"=>"authenticated encrypted cookie",
"action_dispatch.use_authenticated_cookie_encryption"=>false,
"action_dispatch.encrypted_cookie_cipher"=>nil, "action_dispatch.signed_cookie_digest"=>nil,
"action_dispatch.cookies_serializer"=>nil, "action_dispatch.cookies_digest"=>nil,
"action_dispatch.cookies_rotations"=>#<ActiveSupport::Messages::RotationConfiguration:0x00005600b29c23a0 @signed=[], @encrypted=[]>,
"action_dispatch.use_cookies_with_metadata"=>false, "action_dispatch.content_security_policy"=>nil,
"action_dispatch.content_security_policy_report_only"=>false,
"action_dispatch.content_security_policy_nonce_generator"=>nil,
"action_dispatch.content_security_policy_nonce_directives"=>nil, "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x00005600b8949eb8>,
"ROUTES_47280548368220_SCRIPT_NAME"=>"",
"ORIGINAL_FULLPATH"=>"/unattended/iPXE?bootstrap=1&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000",
"ORIGINAL_SCRIPT_NAME"=>"",
... trimmed a lot of what seemed related to what is above here ...
"action_dispatch.request.parameters"=>
{"bootstrap"=>"1",
"url"=>"http://foreman.lbhr.htm.lan:8000",
"format"=>"text",
"controller"=>"unattended",
"action"=>"host_template",
"kind"=>"iPXE",
"unattended"=>{}},
"action_dispatch.request.formats"=>[#<Mime::Type:0x00005600b4cc8fc0 @synonyms=[], @symbol=:text, @string="text/plain", @hash=-282735470319125783>],
"action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x00007fac846876c0 @set_cookies={}, @delete_cookies={}, @request=#<ActionDispatch::Request:0x00007fac844b3ad8 @env={...}, @filtered_parameters={"bootstrap"=>"1",
"url"=>"http://foreman.lbhr.htm.lan:8000",
"format"=>"text",
"controller"=>"unattended",
"action"=>"host_template",
"kind"=>"iPXE",
"unattended"=>{}}, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method="GET", @remote_ip="192.168.255.15", @original_fullpath=nil, @fullpath="/unattended/iPXE?bootstrap=1&url=http%3A%2F%2Fforeman.lbhr.htm.lan%3A8000", @ip=nil, @headers=#<ActionDispatch::Http::Headers:0x00007fac844c1c28 @req=#<ActionDispatch::Request:0x00007fac844b3ad8 ...>>>, @cookies={}, @committed=false>, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 2097, session_id: "dc4ec97748482b4f85fb91773192476a", data: "BAh7AA==\n", created_at: "2021-05-05 16:28:18", updated_at: "2021-05-05 16:28:18">}