Skip to content

Commit 4df82f0

Browse files
mvollmermartinpitt
authored andcommitted
storage: Fix passphrase remembering with "Reuse encryption"
The Format dialog does remember the passphrase used to unlock a device in the "Reuse existing encryption" scenario, via the call to unlock_with_type. However, later on it would erroneously call "remember_passphrase" with "undefined" during "maybe_mount", which would delete the previously remembered passphrase. We avoid that now. https://bugzilla.redhat.com/show_bug.cgi?id=2354497
1 parent 5e0a4e4 commit 4df82f0

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pkg/storaged/block/format-dialog.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ function format_dialog_internal(client, path, start, size, enable_dos_extended,
596596
const path = new_path || block.path;
597597
const new_block = await client.wait_for(() => client.blocks[path]);
598598

599-
if (is_encrypted(vals))
599+
if (is_encrypted(vals) && vals.passphrase)
600600
remember_passphrase(new_block, vals.passphrase);
601601

602602
if (is_encrypted(vals) && is_filesystem(vals) && vals.mount_options?.ro) {

test/verify/check-storage-anaconda

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,22 @@ class TestStorageAnaconda(storagelib.StorageCase):
146146
}
147147
})
148148

149-
# Activate and mount again, to check location in tear down information
149+
# Activate
150150
b.click(self.card_button("Inactive logical volume", "Activate"))
151-
b.click(self.card_button("Filesystem", "Mount"))
151+
152+
# Crypto is locked. Unlock and mount via the "Reuse existing
153+
# encryption" mode of the Format dialog
154+
self.click_card_dropdown("Filesystem", "Format")
152155
self.dialog_wait_open()
153-
self.dialog_set_val("passphrase", "vainu-reku-toma-rolle-kaja")
156+
self.dialog_wait_val("crypto", " keep")
157+
self.dialog_set_val("old_passphrase", "vainu-reku-toma-rolle-kaja")
158+
b.set_checked("#dialog-confirm", val=True)
154159
self.dialog_apply()
155160
self.dialog_wait_close()
156161

162+
# Passphrase should still be remembered
163+
self.expectExportedDevicePassphrase("/dev/vgroup0/lvol0", "vainu-reku-toma-rolle-kaja")
164+
157165
# Check and delete volume group
158166
b.click(self.card_parent_link())
159167
b.wait_visible(self.card_row("LVM2 volume group", name=disk))

0 commit comments

Comments
 (0)