Force lowercase luks disk UUID in disk-mapper, disk-rekeying and recovery

Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Malte Poll 2022-05-02 16:57:13 +02:00 committed by Malte Poll
parent e13ec3f914
commit 17d73813a9
2 changed files with 4 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package core
import ( import (
"fmt" "fmt"
"strings"
) )
// GetDiskUUID gets the disk's UUID. // GetDiskUUID gets the disk's UUID.
@ -14,7 +15,7 @@ func (c *Core) GetDiskUUID() (string, error) {
if err != nil { if err != nil {
return "", fmt.Errorf("cannot retrieve uuid of disk: %w", err) return "", fmt.Errorf("cannot retrieve uuid of disk: %w", err)
} }
return uuid, nil return strings.ToLower(uuid), nil
} }
// UpdateDiskPassphrase switches the initial random passphrase of the encrypted disk to a permanent passphrase. // UpdateDiskPassphrase switches the initial random passphrase of the encrypted disk to a permanent passphrase.

View file

@ -3,6 +3,7 @@ package mapper
import ( import (
"errors" "errors"
"fmt" "fmt"
"strings"
cryptsetup "github.com/martinjungblut/go-cryptsetup" cryptsetup "github.com/martinjungblut/go-cryptsetup"
) )
@ -36,7 +37,7 @@ func (m *Mapper) IsLUKSDevice() bool {
// GetUUID gets the device's UUID. // GetUUID gets the device's UUID.
func (m *Mapper) DiskUUID() string { func (m *Mapper) DiskUUID() string {
return m.device.GetUUID() return strings.ToLower(m.device.GetUUID())
} }
// FormatDisk formats the disk and adds passphrase in keyslot 0. // FormatDisk formats the disk and adds passphrase in keyslot 0.