Skip to content

metalman: add HTTPS support for PXE boot - #544

Draft
Jordan Olshevski (jveski) wants to merge 2 commits into
mainfrom
feature/metalman-https-0ik
Draft

metalman: add HTTPS support for PXE boot#544
Jordan Olshevski (jveski) wants to merge 2 commits into
mainfrom
feature/metalman-https-0ik

Conversation

@jveski

Copy link
Copy Markdown
Contributor
  • Add --tls-cert-file, --tls-private-key-file, and --tls-ca-file flags to the PXE HTTP server
  • Serve HTTPS when TLS flags are provided, otherwise fall back to plain HTTP
  • Validate TLS flag combinations and certificate/key pairing at startup
  • Install trust certificates into BMC UEFI HTTPS boot store before setting boot overrides
  • Best-effort certificate installation: failures are logged but do not block repave operations
  • Add parseTrustCertificate helper for PEM-encoded CA certificate validation
  • Remove dead-code branch in validateTLSFlags

The all && none condition can never be true - if any flag is set, none is
false, and vice versa. Simplify to just check if all flags are empty and
return early.
Add a comment explaining that cert installation is best-effort: the
certificate may already be present from a prior run, and returning an
error would block the entire repave operation.
Copilot AI review requested due to automatic review settings July 23, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds initial plumbing for HTTPS-based HTTP boot in metalman by threading TLS-related configuration into the serve-pxe command and the MachineOperation reconciliation flow, with the intent to install a trust CA into the BMC UEFI HTTPS boot store before setting HTTP boot overrides.

Changes:

  • Extends MachineOperation power client interactions to (best-effort) ensure an HTTPS boot trust certificate is present before setting an HTTPS HTTP-boot override.
  • Adds --tls-cert-file, --tls-private-key-file, and --tls-ca-file flags and uses them to select an http:// vs https:// serve URL and pass TLS inputs through to the HTTP artifact server and reconciler.
  • Adds TLS flag validation and a PEM certificate parsing helper for the trust CA file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/metalman/machineops/controller.go Adds trust-certificate plumbing into the repave HTTP-boot path and extends the PowerClient interface.
internal/metalman/commands/serve_pxe.go Adds TLS CLI flags, TLS validation, trust CA parsing, and wires TLS/trust config into the server and reconciler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 336 to +340
httpServer := &netboot.HTTPServer{
BindAddr: bindAddress,
Port: httpPort,
TLSCertFile: tlsCertFile,
TLSKeyFile: tlsPrivateKeyFile,
SetHTTPBootOverride(ctx context.Context, bootURL string) error
SetBIOSStaticIPv4(ctx context.Context, config redfish.StaticIPv4Config) error
SetBIOSHTTPBootURI(ctx context.Context, bootURL string) error
EnsureHTTPBootCertificate(ctx context.Context, trustCertPEM []byte) error
Comment on lines +456 to +468
func parseTrustCertificate(pemData []byte) (*x509.Certificate, error) {
block, _ := pem.Decode(pemData)
if block == nil {
return nil, fmt.Errorf("no PEM block found")
}

switch block.Type {
case "CERTIFICATE":
return x509.ParseCertificate(block.Bytes)
default:
return nil, fmt.Errorf("expected PEM type CERTIFICATE, got %s", block.Type)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants