fix: change the UEFI firmware search path order

Ensure that SecureBoot enabled images come before regular ones.

With Ubuntu 24.04 `ovmf` package, due to the ordering of the search
paths `talosctl` might pick up a wrong image and disable SecureBoot.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2024-07-11 18:28:20 +04:00
parent a727a1d97a
commit 736c1485e2
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811
3 changed files with 13 additions and 3 deletions

View File

@ -1285,6 +1285,10 @@ func getContainerInspector(ctx context.Context, namespace string, driver common.
func (s *Server) Read(in *machine.ReadRequest, srv machine.MachineService_ReadServer) (err error) {
stat, err := os.Stat(in.Path)
if err != nil {
if os.IsNotExist(err) {
return status.Error(codes.NotFound, err.Error())
}
return err
}

View File

@ -448,7 +448,9 @@ func (apiSuite *APISuite) HashKubeletCert(ctx context.Context, node string) (str
_, err = io.Copy(hash, reader)
if err != nil {
return "", err
if client.StatusCode(err) != codes.NotFound { // not found, swallow it
return "", err
}
}
return hex.EncodeToString(hash.Sum(nil)), reader.Close()

View File

@ -124,8 +124,6 @@ func (arch Arch) PFlash(uefiEnabled bool, extraUEFISearchPaths []string) []PFlas
"ovmf-x86_64-4m-vars.bin",
}
uefiSourceFiles = append(uefiSourceFiles, uefiSourceFilesInsecure...)
// Append extra search paths
uefiSourcePathPrefixes = append(uefiSourcePathPrefixes, extraUEFISearchPaths...)
@ -143,6 +141,12 @@ func (arch Arch) PFlash(uefiEnabled bool, extraUEFISearchPaths []string) []PFlas
}
}
for _, p := range uefiSourcePathPrefixes {
for _, f := range uefiSourceFilesInsecure {
uefiSourcePaths = append(uefiSourcePaths, filepath.Join(p, f))
}
}
return []PFlash{
{
Size: 0,