Skip to content

Commit

Permalink
storage: Remove two obsolete clevis workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed May 21, 2021
1 parent b78fd09 commit 625bf56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 1 addition & 8 deletions pkg/storaged/content-views.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,7 @@ function create_tabs(client, target, is_partition) {
var dev = utils.decode_filename(block.Device);
var clear_dev = "luks-" + block.IdUUID;
return cockpit.spawn(["clevis", "luks", "unlock", "-d", dev, "-n", clear_dev],
{ superuser: true })
.catch(() => {
// HACK - https://github.com/latchset/clevis/issues/36
// Clevis-luks-unlock before version 10 always exit 1, so
// we check whether the expected device exists afterwards.
return cockpit.spawn(["test", "-e", "/dev/mapper/" + clear_dev],
{ superuser: true });
});
{ superuser: true, err: "message" });
}

function unlock() {
Expand Down
9 changes: 3 additions & 6 deletions pkg/storaged/crypto-keyslots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,9 @@ function clevis_add(block, pin, cfg, passphrase) {
}

function clevis_remove(block, key) {
// HACK - only clevis version 10 brings "luks unbind", but it is important to use it
// when it exists because our fallback can't deal with all cases, such as LUKSv2.
// cryptsetup needs a terminal on stdin, even with -q or --key-file.
var script = 'if which clevis-luks-unbind; then clevis-luks-unbind -d "$0" -s "$1" -f; else cryptsetup luksKillSlot -q "$0" "$1" && luksmeta wipe -d "$0" -s "$1" -f; fi';
return cockpit.spawn(["/bin/sh", "-c", script, decode_filename(block.Device), key.slot],
{ superuser: true, err: "message", pty: true });
// clevis-luks-unbind needs a tty on stdin for some reason.
return cockpit.spawn(["clevis", "luks", "unbind", "-d", decode_filename(block.Device), "-s", key.slot, "-f"],
{ superuser: true, pty: true, err: "message" });
}

export function clevis_recover_passphrase(block) {
Expand Down

0 comments on commit 625bf56

Please sign in to comment.