Page MenuHomeFreeBSD

geli: try to decrypt using keyfile
Needs ReviewPublic

Authored by oshogbo on Sun, May 19, 1:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 27, 10:26 PM
Unknown Object (File)
Sat, May 25, 7:04 PM
Unknown Object (File)
Tue, May 21, 8:55 PM
Unknown Object (File)
Tue, May 21, 5:17 PM
Unknown Object (File)
Mon, May 20, 6:46 PM
Unknown Object (File)
Mon, May 20, 6:45 PM
Unknown Object (File)
Mon, May 20, 4:43 PM
Subscribers

Details

Summary

Geli has a special parameter iterations that specifies how many times
a passphrase should be strengthened. The special value -1 indicates
that no passphrase was provided. When this value is set, we can skip
asking for a passphrase during boot because it's known to be unused.

However, the situation becomes more complicated because we have two
slots for keys. In one slot, a keyfile may be used, and in the other,
a passphrase. In such cases, iterations will be set, and
the bootloader will prompt for a passphrase. Another scenario is when
a passphrase is removed from a slot, the iterations are not updated to
-1, because geli doesn't know what method was used in the other slot.

This is why this commit adds a test for the keyfile during boot.
If iterations is not set to -1 and a keyfile is used, the system
tests the keyfile alone before attempting to combine it with a passphrase.

This enables us to employ two methods: one using a keyfile and
the other a passphrase. The keyfile is stored on a memory stick
and loaded during boot. We use the passphrase as a backup in case
the keyfile is lost. After this change, when we insert the memory
stick, we won't be asked for the passphrase, allowing the machine
to boot without keyboard interaction.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 57763
Build 54651: arc lint + arc unit

Event Timeline

Can we have a regression test case for this?

sys/geom/eli/g_eli.c
1412

I think this block needs some comment explaining what it does.

1419

It would be easier to read this loop if everything is in one big

if (!skippassphrase) {
    ...
}

block. The block could be lifted into a subroutine.