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

add: Support LUKS encryption using IBM CEX secure keys on s390x #536

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fcos/1.6.0-exp: Fix context for boot_device.layout errors
- Use "layout" in the context path for errors related to the layout
  entry in the boot_device  configuration.
- Add tests for those error cases.
- Refactor mirror boot_device check for s390x.

Fixes: #484
  • Loading branch information
travier committed Nov 21, 2024
commit 6531c7f23183b99ff428953fb7f5e7c5d80cea9b
16 changes: 8 additions & 8 deletions config/fcos/v1_6_exp/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package v1_6_exp

import (
"regexp"
"strings"

"github.com/coreos/butane/config/common"
"github.com/coreos/ignition/v2/config/util"
Expand Down Expand Up @@ -56,25 +57,24 @@ func (d BootDevice) Validate(c path.ContextPath) (r report.Report) {
case "aarch64", "ppc64le", "x86_64":
case "s390x-eckd":
if util.NilOrEmpty(d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrNoLuksBootDevice)
r.AddOnError(c.Append("layout"), common.ErrNoLuksBootDevice)
} else if !dasdRe.MatchString(*d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrLuksBootDeviceBadName)
r.AddOnError(c.Append("layout"), common.ErrLuksBootDeviceBadName)
}
case "s390x-zfcp":
if util.NilOrEmpty(d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrNoLuksBootDevice)
r.AddOnError(c.Append("layout"), common.ErrNoLuksBootDevice)
} else if !sdRe.MatchString(*d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrLuksBootDeviceBadName)
r.AddOnError(c.Append("layout"), common.ErrLuksBootDeviceBadName)
}
case "s390x-virt":
default:
r.AddOnError(c.Append("layout"), common.ErrUnknownBootDeviceLayout)
}

if *d.Layout == "s390x-eckd" || *d.Layout == "s390x-zfcp" || *d.Layout == "s390x-virt" {
if len(d.Mirror.Devices) > 0 {
r.AddOnError(c.Append(*d.Layout), common.ErrMirrorNotSupport)
}
// Mirroring the boot disk is not supported on s390x
if strings.HasPrefix(*d.Layout, "s390x") && len(d.Mirror.Devices) > 0 {
r.AddOnError(c.Append("layout"), common.ErrMirrorNotSupport)
}
}
r.Merge(d.Mirror.Validate(c.Append("mirror")))
Expand Down
50 changes: 50 additions & 0 deletions config/fcos/v1_6_exp/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,56 @@ func TestValidateBootDevice(t *testing.T) {
common.ErrTooFewMirrorDevices,
path.New("yaml", "mirror", "devices"),
},
// s390x-eckd/s390x-zfcp layouts require a boot device with luks
{
BootDevice{
Layout: util.StrToPtr("s390x-eckd"),
},
common.ErrNoLuksBootDevice,
path.New("yaml", "layout"),
},
// s390x-eckd/s390x-zfcp layouts do not support mirroring
{
BootDevice{
Layout: util.StrToPtr("s390x-zfcp"),
Luks: BootDeviceLuks{
Device: util.StrToPtr("/dev/sda"),
Tpm2: util.BoolToPtr(true),
},
Mirror: BootDeviceMirror{
Devices: []string{
"/dev/sda",
"/dev/sdb",
},
},
},
common.ErrMirrorNotSupport,
path.New("yaml", "layout"),
},
// s390x-eckd devices must start with /dev/dasd
{
BootDevice{
Layout: util.StrToPtr("s390x-eckd"),
Luks: BootDeviceLuks{
Device: util.StrToPtr("/dev/sda"),
Tpm2: util.BoolToPtr(true),
},
},
common.ErrLuksBootDeviceBadName,
path.New("yaml", "layout"),
},
// s390x-zfcp devices must start with /dev/sd
{
BootDevice{
Layout: util.StrToPtr("s390x-eckd"),
Luks: BootDeviceLuks{
Device: util.StrToPtr("/dev/dasd"),
Tpm2: util.BoolToPtr(true),
},
},
common.ErrLuksBootDeviceBadName,
path.New("yaml", "layout"),
},
}

for i, test := range tests {
Expand Down