mirror of
https://github.com/kairos-io/kcrypt.git
synced 2025-08-12 12:51:37 +00:00
Avoid calling udevadm with -v flag (#380)
This commit is contained in:
parent
418027453d
commit
ad07ced68b
@ -53,13 +53,12 @@ func Luksify(label string, logger zerolog.Logger) (string, error) {
|
|||||||
var pass string
|
var pass string
|
||||||
|
|
||||||
// Make sure ghw will see all partitions correctly.
|
// Make sure ghw will see all partitions correctly.
|
||||||
// Some versions of udevadm don't support --settle (e.g. alpine)
|
// older versions don't have --type=all. Try the simpler version then.
|
||||||
// and older versions don't have --type=all. Try the simpler version then.
|
out, err := SH("udevadm trigger settle --type=all || udevadm trigger")
|
||||||
out, err := SH("udevadm trigger --settle -v --type=all || udevadm trigger -v")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("udevadm trigger failed: %w, out: %s", err, out)
|
return "", fmt.Errorf("udevadm trigger failed: %w, out: %s", err, out)
|
||||||
}
|
}
|
||||||
SH("sync") //nolint:errcheck
|
syscall.Sync()
|
||||||
|
|
||||||
part, b, err := FindPartition(label)
|
part, b, err := FindPartition(label)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -107,6 +106,14 @@ func Luksify(label string, logger zerolog.Logger) (string, error) {
|
|||||||
// default for publicKeyPcrs is 11
|
// default for publicKeyPcrs is 11
|
||||||
// default for pcrs is nothing, so it doesn't bind as we want to expand things like DBX and be able to blacklist certs and such
|
// default for pcrs is nothing, so it doesn't bind as we want to expand things like DBX and be able to blacklist certs and such
|
||||||
func LuksifyMeasurements(label string, publicKeyPcrs []string, pcrs []string, logger zerolog.Logger) error {
|
func LuksifyMeasurements(label string, publicKeyPcrs []string, pcrs []string, logger zerolog.Logger) error {
|
||||||
|
// Make sure ghw will see all partitions correctly.
|
||||||
|
// older versions don't have --type=all. Try the simpler version then.
|
||||||
|
out, err := SH("udevadm trigger --type=all || udevadm trigger")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("udevadm trigger failed: %w, out: %s", err, out)
|
||||||
|
}
|
||||||
|
syscall.Sync()
|
||||||
|
|
||||||
part, b, err := FindPartition(label)
|
part, b, err := FindPartition(label)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -166,7 +173,7 @@ func LuksifyMeasurements(label string, publicKeyPcrs []string, pcrs []string, lo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete password slot from luks device
|
// Delete password slot from luks device
|
||||||
out, err := SH(fmt.Sprintf("systemd-cryptenroll --wipe-slot=password %s", device))
|
out, err = SH(fmt.Sprintf("systemd-cryptenroll --wipe-slot=password %s", device))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Err(err).Str("out", out).Msg("Removing password")
|
logger.Err(err).Str("out", out).Msg("Removing password")
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user