feat(pxe): default to client IP when DHCP option 43.70 is unset#1464
feat(pxe): default to client IP when DHCP option 43.70 is unset#1464chet wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
|
I thought we moved to using the source IP for identifying what to do a long time ago, and actually don't require these parameters anymore. Can you double check? |
@Matthias247 Yeah so Or we just introduce this as step 1, and maybe drop 43.70 separately as step 2? Or something entirely different? |
Why can't everything use source IP? |
@Matthias247 Sooo we could definitely use source IP, BUT, the problem (well not problem, but added complexity) comes in wrt IPv4/IPv6. So But |
The external DHCP / provisioning infrastructure won't use our iPXE kernel either so this change probably doesn't make any difference to them. |
|
@chet I don't understand how the iPXE variables are involved into that. I think the flow is
|
@Matthias247 If there's something sitting in between the client -> PXE server (like a proxy), we'd get the client IP of the proxy and not the actual host. |
|
@chet Ah yes. In that case the requirement for the proxy can be to include the original IP (e.g. via |
@Matthias247 Yeah we definitely could -- it just seemed nice to use So then, options are:
If you want it to be source IP across the board, I'll update this. Lemme know! |
|
I prefer the client IP. I would have said its less prone to spoofing, but with supporting x-forwarded-for that's actually not true either. But we could at least hide x-forwarded-for support behind a config flag. |
963a95c to
a728560
Compare
a728560 to
14f12b6
Compare
Okay @Matthias247, updated to client IP. Honestly I could probably drop the 43.70 check entirely, but we could also do a phased approach and next remove it from carbide-dhcp, and then unwind it from here after that if we wanted. Lemme know. |
We use client IP already for `whoami` and `cloud-init` (`user-data` and `meta-data`) calls, do the same for `boot`.
This introduces a new `chain` where, if `43.70` is NOT set, we just pass through a URL to `carbide-pxe` that excludes it, and then `carbide-pxe` pulls out the client IP (prioritizing `X-Forwarded-For` if it exists), and then calling back to `find_by_ip` to get the corresponding `machine_interface_id` (the same one that would have been populated by `43.70`).
The flow is:
- *iPXE boots*, runs `embed.ipxe`.
- `:carbide` checks `isset ${43.70}`.
- If yes, chain with `?uuid=${43.70}` (existing path).
- If no, chain without it.
- `carbide-pxe` accepts either `uuid` as a query param (or plucks an `ip_address`), plumbs it through to `carbide-api` via `PxeInstructionRequest`.
- `carbide-api` either:
- Sees `uuid` and uses that as `interface_id`.
- Sees `ip_address` and uses that to call `find_by_ip` to resolve the `interface_id`.
- Identical flow from here on
Tests added!
Signed-off-by: Chet Nichols III <chetn@nvidia.com>
14f12b6 to
ab4b6e5
Compare
Description
We use client IP already for
whoamiandcloud-init(user-dataandmeta-data) calls, do the same forboot.This introduces a new
chainwhere, if43.70is NOT set, we just pass through a URL tocarbide-pxethat excludes it, and thencarbide-pxepulls out the client IP (prioritizingX-Forwarded-Forif it exists), and then calling back tofind_by_ipto get the correspondingmachine_interface_id(the same one that would have been populated by43.70).The flow is:
embed.ipxe.:carbidechecksisset ${43.70}.?uuid=${43.70}(existing path).carbide-pxeaccepts eitheruuidas a query param (or plucks anip_address), plumbs it through tocarbide-apiviaPxeInstructionRequest.carbide-apieither:uuidand uses that asinterface_id.ip_addressand uses that to callfind_by_ipto resolve theinterface_id.Tests added!
Signed-off-by: Chet Nichols III chetn@nvidia.com
Type of Change
Related Issues (Optional)
Breaking Changes
Testing
Additional Notes