Skip to content

Commit

Permalink
Enables 'fdo.di_mfg_string_type_mac_iface' variable passing
Browse files Browse the repository at this point in the history
Makes necessary changes for 'fdo.di_mfg_string_type_mac_iface' variable to be passed to manufacturing-client.service when the manufacturing-client is run via the simplified-installer.
  • Loading branch information
djach7 committed Oct 16, 2023
1 parent defc83d commit 791f324
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
9 changes: 5 additions & 4 deletions internal/fdo/fdo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package fdo
import "github.com/osbuild/images/pkg/blueprint"

type Options struct {
ManufacturingServerURL string
DiunPubKeyInsecure string
DiunPubKeyHash string
DiunPubKeyRootCerts string
ManufacturingServerURL string
DiunPubKeyInsecure string
DiunPubKeyHash string
DiunPubKeyRootCerts string
DiMfgStringTypeMacIface string
}

func FromBP(bpFDO blueprint.FDOCustomization) *Options {
Expand Down
5 changes: 3 additions & 2 deletions pkg/blueprint/customizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ type FDOCustomization struct {
DiunPubKeyInsecure string `json:"diun_pub_key_insecure,omitempty" toml:"diun_pub_key_insecure,omitempty"`
// This is the output of:
// echo "sha256:$(openssl x509 -fingerprint -sha256 -noout -in diun_cert.pem | cut -d"=" -f2 | sed 's/://g')"
DiunPubKeyHash string `json:"diun_pub_key_hash,omitempty" toml:"diun_pub_key_hash,omitempty"`
DiunPubKeyRootCerts string `json:"diun_pub_key_root_certs,omitempty" toml:"diun_pub_key_root_certs,omitempty"`
DiunPubKeyHash string `json:"diun_pub_key_hash,omitempty" toml:"diun_pub_key_hash,omitempty"`
DiunPubKeyRootCerts string `json:"diun_pub_key_root_certs,omitempty" toml:"diun_pub_key_root_certs,omitempty"`
DiMfgStringTypeMacIface string `json:"di_mfg_string_type_mac_iface,omitempty" toml:"di_mfg_string_type_mac_iface,omitempty"`
}

type KernelCustomization struct {
Expand Down
5 changes: 4 additions & 1 deletion pkg/distro/rhel8/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,11 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
if customizations.GetFDO().DiunPubKeyRootCerts != "" {
diunSet++
}
if customizations.GetFDO().DiMfgStringTypeMacIface != "" {
diunSet++
}
if diunSet != 1 {
return warnings, fmt.Errorf("boot ISO image type %q requires specifying one of [FDO.DiunPubKeyHash,FDO.DiunPubKeyInsecure,FDO.DiunPubKeyRootCerts] configuration to install to", t.name)
return warnings, fmt.Errorf("boot ISO image type %q requires specifying one of [FDO.DiunPubKeyHash,FDO.DiunPubKeyInsecure,FDO.DiunPubKeyRootCerts,FDO.DiMfgStringTypeMacIface] configuration to install to", t.name)
}
}
} else if t.name == "edge-installer" {
Expand Down
5 changes: 4 additions & 1 deletion pkg/distro/rhel9/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,11 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
if customizations.GetFDO().DiunPubKeyRootCerts != "" {
diunSet++
}
if customizations.GetFDO().DiMfgStringTypeMacIface != "" {
diunSet++
}
if diunSet != 1 {
return warnings, fmt.Errorf("boot ISO image type %q requires specifying one of [FDO.DiunPubKeyHash,FDO.DiunPubKeyInsecure,FDO.DiunPubKeyRootCerts] configuration to install to when using FDO", t.name)
return warnings, fmt.Errorf("boot ISO image type %q requires specifying one of [FDO.DiunPubKeyHash,FDO.DiunPubKeyInsecure,FDO.DiunPubKeyRootCerts,FDO.DiMfgStringTypeMacIface] configuration to install to when using FDO", t.name)
}
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/image/ostree_simplified_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func (img *OSTreeSimplifiedInstaller) InstantiateManifest(m *manifest.Manifest,
if img.FDO.DiunPubKeyRootCerts != "" {
kernelOpts = append(kernelOpts, "fdo.diun_pub_key_root_certs=/fdo_diun_pub_key_root_certs.pem")
}
if img.FDO.DiMfgStringTypeMacIface != "" {
kernelOpts = append(kernelOpts, "fdo.di_mfg_string_type_mac_iface="+img.FDO.DiMfgStringTypeMacIface)
}
}

bootTreePipeline.KernelOpts = kernelOpts
Expand Down

0 comments on commit 791f324

Please sign in to comment.