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

introduction of custom iPXE firmware support #429

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

Rozzii
Copy link
Member

@Rozzii Rozzii commented Aug 8, 2023

This PR adds the following, :

  - Support for detecting iPXE certificates
  - When iPXE certs are detected, the iPXE services
    and conigs will be advertised with https addresses
  - Enforce chainloading of the iPXE firmware provided by
    the user even if the client machine comes with an iPXE
    firmware by default
  - Adds modular iPXE apache2 config file to enable separate
    iPXE specific virtual host (port) where TLS is enforced
  - Adds ipxe builder script that can be run as an entry point
    to standalone container or as a K8s pod init container
  - custom iPXE config file template has been added thus Ironic can
    generate node specific iPXE config files that use the custom iPXE
    firmware
  - a set of environment variable that control the new iPXE related
    features

This PR builds on top of #428 so it will be on hold until that is merged.

IPXE building functionality was originally planned to be hosted in this repository but after extensive community discussion I have decided to move the iPXE firmware builder to it's own repository.

@metal3-io metal3-io deleted a comment from metal3-io-bot Aug 8, 2023
@metal3-io-bot metal3-io-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 8, 2023
@metal3-io metal3-io deleted a comment from metal3-io-bot Aug 8, 2023
@metal3-io metal3-io deleted a comment from metal3-io-bot Aug 8, 2023
@Rozzii
Copy link
Member Author

Rozzii commented Aug 8, 2023

/test-ubuntu-integration-main

@Rozzii Rozzii changed the title Ipxe adam introduction of custom iPXE firmware support Aug 8, 2023
@Rozzii
Copy link
Member Author

Rozzii commented Aug 8, 2023

/hold

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 8, 2023
@Rozzii
Copy link
Member Author

Rozzii commented Aug 8, 2023

/test-centos-integration-main

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits

README.md Outdated Show resolved Hide resolved
ironic-config/httpd.conf.j2 Outdated Show resolved Hide resolved
ironic-config/httpd.conf.j2 Outdated Show resolved Hide resolved
scripts/buildipxe Outdated Show resolved Hide resolved
scripts/buildipxe Outdated Show resolved Hide resolved
scripts/buildipxe Outdated Show resolved Hide resolved
@Rozzii
Copy link
Member Author

Rozzii commented Aug 11, 2023

/test-ubuntu-integration-main

3 similar comments
@Rozzii
Copy link
Member Author

Rozzii commented Aug 11, 2023

/test-ubuntu-integration-main

@Rozzii
Copy link
Member Author

Rozzii commented Aug 11, 2023

/test-ubuntu-integration-main

@Rozzii
Copy link
Member Author

Rozzii commented Aug 17, 2023

/test-ubuntu-integration-main

@Rozzii
Copy link
Member Author

Rozzii commented Sep 1, 2023

/hold cancel

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 1, 2023
@tuminoid
Copy link
Member

tuminoid commented Sep 1, 2023

/cc @lentzi90
/assign @elfosardo

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work from what I can understand. I must confess this is a bit outside of my expertise though

scripts/buildipxe Outdated Show resolved Hide resolved
@metal3-io-bot metal3-io-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 4, 2023
@metal3-io metal3-io deleted a comment from metal3-io-bot Sep 4, 2023
@metal3-io-bot metal3-io-bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2023
@Rozzii
Copy link
Member Author

Rozzii commented Nov 16, 2023

/test-ubuntu-integration-main

</VirtualHost>

<Location ~ "^/grub.*/">
SSLRequireSSL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why not just everywhere?

Copy link
Member Author

@Rozzii Rozzii Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a few things in mind when I have done this

  • I want to use the modular functionality of the Apache config files, so config files that are related to a type of boot interface should only restrict files that are also related to the same Ironic boot interface/boot method.
  • The other thing is that, at the moment firmware loading is not secured by TLS only the image download this I will explain in detail under your other comments.

# Client is PXE booting over EFI without iPXE ROM; send EFI version of iPXE chainloader
# Client is PXE booting over EFI without iPXE ROM; send EFI version of iPXE chainloader do the same also if iPXE ROM boots but TLS is enabled
{%- if env.IPXE_TLS_SETUP == "true" %}
dhcp-boot=tag:efi,tag:ipxe,snponly.efi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look right. You're saying "if iPXE on UEFI, boot iPXE".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal here is to always force the chain loading of our iPXE firmware and not whatever is running on the machine by default. Our firmware will have the ability to exit this loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so it will only work for your custom firmware? :-/

Copy link
Member Author

@Rozzii Rozzii Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because the firmware has to contain the correct certificate, although by default iPXE supports the Mozzilla cert bundle but in our case we have our own for Ironic.

I could add https address support for loading the boot.ipxe directly but then that would exclude all machines that doesn't have a TLS enabled IPXE with the Mozzilla bundle because I can't enable the two addresses at the same time because the dhcp "tag:"s have to match.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have looked into the possibility to differentiate our custom firmware from a regular TLS enabled iPXE via a custom dhcp tag but I have not found any documented ways to do it . I am not sure in general whether a custom DHCP tag is a thing or not.

@@ -29,13 +29,23 @@ dhcp-option=option{% if ":" in env["DNS_IP"] %}6{% endif %}:dns-server,{{ env["D
# IPv4 Configuration:
dhcp-match=ipxe,175
# Client is already running iPXE; move to next stage of chainloading
{%- if env.IPXE_TLS_SETUP == "true" %}
# iPXE with (U)EFI
dhcp-boot=tag:efi,tag:ipxe,http://{{ env.IRONIC_URL_HOST }}:{{ env.HTTP_PORT }}/custom-ipxe/snponly.efi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"http://" here sorta defeats the whole point.. if the attacker can intersect the connection, they can provide a different image?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right this will load the firmware via http, at the moment the TLS support is only introduced for the later part of the chain loading .There are a simple reason for this, we don't know what will be running on a machine by default, it could be and iPXE firmware that is unable to use https and first we need to provide a firmware that we can use with TLS.

The topic of man in the middle during firmware loading is very important I agree but that will be a followup feature based on all the things that are getting introduced in the ipxe-builder image and here. Securing the firmware loading won't be as easy as turning on TLS as I have mentioned we don't know what the host machine is capable at the initial stage of the loading. I plan to go into the direction of "trusted firmware" which would mean that we would only allow a firmware to get to our images if it can identify itself as a trusted image.

@@ -0,0 +1,81 @@
#!ipxe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know Ironic allows copying this file, but I'd much rather prefer we don't do it. You're going to miss any upstream fixes, and reconciling will be very hard. Can we add the missing functionality in Ironic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to get this in first, but for sure I can later implement changes from the Ironic side also I agree eventually a natively supported approach should be the way to do it.

@Rozzii Rozzii force-pushed the ipxe_adam branch 2 times, most recently from 4c62c59 to 00e3478 Compare November 20, 2023 18:30
This commit adds the following:

  - Support for detecting iPXE certificates
  - When iPXE certs are detected, the iPXE services
    and configs will be advertised with https addresses
  - Enforce chainloading of the iPXE firmware provided by
    the user even if the client machine comes with an iPXE
    firmware by default
  - Adds modular iPXE apache2 config file to enable separate
    iPXE specific virtual host (port) where TLS is enforced
  - Custom iPXE config file template has been added thus Ironic can
    generate node specific iPXE config files that use the custom iPXE
    firmware
  - A set of environment variable that control the new iPXE related
    features

Signed-off-by: Adam Rozman <adam.rozman@est.tech>
@Rozzii
Copy link
Member Author

Rozzii commented Nov 20, 2023

/test-ubuntu-integration-main

1 similar comment
@Rozzii
Copy link
Member Author

Rozzii commented Nov 21, 2023

/test-ubuntu-integration-main

@Rozzii
Copy link
Member Author

Rozzii commented Dec 6, 2023

/test-centos-integration-main

@elfosardo
Copy link
Member

/approve

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 6, 2023
@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elfosardo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Rozzii
Copy link
Member Author

Rozzii commented Dec 6, 2023

/hold

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 6, 2023
@Rozzii
Copy link
Member Author

Rozzii commented Dec 7, 2023

@lentzi90 could you please lgtm this? it has the "hold" only because we are not sure this should go in the first ironic-image release or not

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 7, 2023
@Rozzii
Copy link
Member Author

Rozzii commented Dec 12, 2023

/hold cancel
Now that the first release is done I will merge this as agreed @elfosardo .

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2023
@metal3-io-bot metal3-io-bot merged commit 5dffc24 into metal3-io:main Dec 12, 2023
5 checks passed
@metal3-io-bot metal3-io-bot deleted the ipxe_adam branch December 12, 2023 07:51
dtantsur pushed a commit to dtantsur/ironic-image that referenced this pull request Jan 2, 2024
OCPBUGS-23903: Ironic side of external_http_url (METAL-163) is not wired in correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants