40 Commits

Author SHA1 Message Date
Ian Johnson
372f7f4987 kernel/fde, osutil: rename functions, add doc-comments
Thanks to Samuele for the suggestions.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-11-22 09:19:23 -06:00
Ian Johnson
00969d1403 osutil/disks, kernel/fde: rename device mapper back resolver
Thanks to Maciej for the suggestion.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-11-16 15:42:31 -06:00
Ian Johnson
96141d32a0 kernel/fde: add DeviceUnlockKernelHookDeviceMapperHandler, use w/ disks pkg
Add two new functions, IsEncryptedDeviceMapperName to identify if a device
mapper node is with a device-unlock encrypted mapper name device, and
DeviceUnlockKernelHookDeviceMapperHandler to combine the identification with
the task of "un-mapping" the device mapper to the original source disk. Also
register this with the disks package so users of the disks package will get
this built-in when they also import the fde package.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-11-09 19:05:41 -06:00
Michael Vogt
b7b5cf2f5c fde: tweak/fix doc strings (thanks to Ian) 2021-10-07 09:43:03 +02:00
Michael Vogt
b2c926d5cf Merge remote-tracking branch 'upstream/master' into ice/refactor-fde-minimal 2021-09-25 20:09:06 +02:00
Michael Vogt
c3ac482011 Merge pull request #10815 from mvo5/ice/has-device-unlock
fde: add HasDeviceUnlock() helper
2021-09-23 09:53:41 +02:00
Michael Vogt
73e43db495 fde: fix typos
Co-authored-by: Pawel Stolowski <stolowski@gmail.com>
2021-09-23 09:21:24 +02:00
Michael Vogt
074ef7e853 fde: add new device-setup support to fde-setup
This adds support for inline cryto hardware like Qualcomm ICE to
the fde-setup binary. A new `op:device-setup` is used
for this.
2021-09-22 13:45:23 +02:00
Michael Vogt
982e8fbf8e fde,devicestate: add new fde.CheckFeatures() and use in DeviceManager 2021-09-22 13:40:20 +02:00
Michael Vogt
d2e7e6b19f fde: add HasDeviceUnlock() helper
This method is used to determine if the fde-device-unlock helper is
available.
2021-09-21 09:41:41 +02:00
Alberto Mardegan
2efa777f8c kernel/fde: mock systemd-run in unit test
This test has been occasionally failing under spread:

```
FAIL: fde_test.go:492: fdeSuite.TestRevealErr

using shellcheck: ""
fde_test.go:508:
    c.Assert(err, ErrorMatches, `(?s)cannot run fde-reveal-key "reveal":
    -----
    failed
    service result: exit-code
    -----`)
... error string = "cannot run fde-reveal-key \"reveal\": exit status 1"
... regex string = "" +
...     "(?s)cannot run fde-reveal-key \"reveal\": \n" +
...     "-----\n" +
...     "failed\n" +
...     "service result: exit-code\n" +
...     "-----"

OOPS: 9 passed, 5 skipped, 1 FAILED
```

While we couldn't yet reproduce it locally and find what exactly
triggers it, it makes sense to exclude systemd-run from the picture by
mocking it. We now simply check that it was invoked with the right
parameters and that its output is captured correctly.
2021-09-20 09:18:42 +03:00
Michael Vogt
8229fcb8b9 kernel: fix typo/improve comment (thanks to Pawel) 2021-04-27 17:49:40 +02:00
Samuele Pedroni
134203ec32 many: drop some now spurious [:] slicing 2021-04-25 13:56:57 +02:00
Samuele Pedroni
c671a47246 kernel/fde,secboot: small cleanups 2021-04-25 13:47:39 +02:00
Samuele Pedroni
ff83cead1e kernel/fde: typo in filename reveal_key.go 2021-04-25 13:25:11 +02:00
Samuele Pedroni
ed9bb579d8 Merge remote-tracking branch 'upstream/master' into fde-hooks-v2.4
Adjusted code to the refactoring using kernel/fde.
Split responsibility to deal with v1/v2 hooks with kernel/fde.
Now dealing with aux key will come later.
2021-04-24 19:33:52 +02:00
Samuele Pedroni
e4c4589ca4 kernel/fde,secboot: move infra to run fde-reveal-key to kernel/fde
deprecate KeyName in fde-reveal-key "reveal"
2021-04-23 20:06:40 +02:00
Samuele Pedroni
9b2c3e0fbd kernel/fde: drop unused SetupRequest.Models 2021-04-23 20:06:40 +02:00
Samuele Pedroni
0a2d2856ca kernel/fde: fix v1 marker handle 2021-04-23 20:06:40 +02:00
Samuele Pedroni
e509090cac many: disentagle kernel/fde from secboot, reorg files in the latter
this stops kernel/fde from importing secboot, which also means that
secboot can now kernel/fde naturally

rename/reorg/split secboot_tpm.go into hooks specific bits
and general secboot-using secboot_sb.go
2021-04-23 16:09:58 +02:00
Michael Vogt
cf3ce57662 boot,fde: cleanup after master merge 2021-04-23 11:06:51 +02:00
Michael Vogt
8ed6aa2a18 fix tests, remove left-over code 2021-04-23 07:54:45 +02:00
Michael Vogt
ff3fbc4112 fix tests 2021-04-22 22:27:38 +02:00
Michael Vogt
511cd88dd0 update tests 2021-04-22 19:04:05 +02:00
Michael Vogt
cec0146d60 Merge branch 'fde-hooks-split-from-10149-1' into fde-hooks-v2.4 2021-04-22 18:39:01 +02:00