mirror of
https://github.com/kairos-io/kcrypt.git
synced 2025-04-27 19:29:09 +00:00
Allow random partitions encryption
Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
parent
654d4de653
commit
a1295df1c6
@ -208,9 +208,12 @@ func formatLuks(device, name, mapper, label, pass string, logger types.KairosLog
|
||||
}
|
||||
|
||||
l.Debug().Msg("discards")
|
||||
out, err = SH(fmt.Sprintf("cryptsetup refresh --persistent --allow-discards %s", mapper))
|
||||
// Refresh needs the password as its doing actions on the device directly
|
||||
cmd := exec.Command("cryptsetup", "refresh", "--persistent", "--allow-discards", mapper)
|
||||
cmd.Stdin = strings.NewReader(pass)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("refresh err: %w, out: %s", err, out)
|
||||
return fmt.Errorf("refresh err: %w, out: %s", err, string(output))
|
||||
}
|
||||
|
||||
l.Debug().Msg("close")
|
||||
|
@ -72,8 +72,14 @@ func UnlockAllWithLogger(tpm bool, log types.KairosLogger) error {
|
||||
}
|
||||
} else {
|
||||
p.FilesystemLabel, err = config.GetLabelForUUID(volumeUUID)
|
||||
// This is a not known filesystem label, so we will try to unlock by uuid or by partition label
|
||||
// Notice that we lock by uuid and filesystem label so the label usually wont match between the fs label and partition label
|
||||
// Unless set by the user to be the same one
|
||||
if err != nil {
|
||||
return err
|
||||
if p.FilesystemLabel == "" || p.FilesystemLabel == "unknown" {
|
||||
p.FilesystemLabel = p.Label
|
||||
}
|
||||
logger.Warn().Msg("Not known filesystem label, will try to unlock by uuid or by partition label")
|
||||
}
|
||||
err = UnlockDisk(p)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user