37 Commits

Author SHA1 Message Date
Michael Vogt
b6dcc7e048 asserts: tweak error/code layout in assembleModel around storageSafety checks 2020-11-17 12:59:01 +01:00
Michael Vogt
9efbec05da asserts: set defaults on uc20 for storage-safety (if unset) 2020-11-16 18:21:56 +01:00
Michael Vogt
c00944e7de asserts: tweak error for uc16/uc18 storage-safety headers 2020-11-16 18:14:53 +01:00
Michael Vogt
fdd376bb76 asserts: ensure "grade: secured" has "storage-safety: encrypted" 2020-11-16 18:12:02 +01:00
Michael Vogt
66e5550646 asserts: rename ModelStorageSafety* -> StorageSafety* 2020-11-16 18:10:49 +01:00
Michael Vogt
b813989119 asserts: rework storage-safety to the latest spec
This commit reworks the "storage-safety" value in the model assertion
so that the new values are:
"encrypted|prefer-encrpyted|prefer-unencrypted"

This makes it clearer what the meaning of each option is.
2020-10-28 19:17:06 +01:00
Michael Vogt
83c3e849cd asserts: use ModelStorageSafety* when checking for valid storage-safety values
Thanks to Ian for the suggestion
2020-10-28 08:30:50 +01:00
Michael Vogt
ebbacd0648 asserts: implement "storage-safety" in uc20 model assertion
This commit implements the new "storage-safety" header for the
model assertion. This header controls the encryption handling
for the given model and grade. Valid values for the storage-safety
header are "optional" and "encrypted". Note that the the
combination of "model: secured" and "storage-safety: optional"
is an error.

In addition to the assertion change this will need work on the
devicemanager to honor the settings and there will be a new
option for the gadget.yaml:
```
storage-safety-default: encrypted|unencrypted
```
Based on this default the recovery-chooser will offer defaults
about installing the device encrypted or unencrypted.
2020-10-27 17:30:51 +01:00
Ian Johnson
e58632b3c3 asserts/model.go: fix typos
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2020-08-28 09:50:03 -05:00
Samuele Pedroni
0b929cd3a0 asserts,seed: split handling of essential/not essential model snaps
this splits the handling of essential and not essential model snaps
by having model.EssentialSnaps and model.SnapsWithoutEssential
instead of AllSnaps

notice that the order of snaps is still relevant in seedwriter and
seed, but is now managed more explicitly:

 * system snap first (if implicit)
 * essential snaps (in the EssentialSnaps order)
 * not essential snaps (in SnapsWithoutEssential order)
2020-06-23 18:10:32 +02:00
Samuele Pedroni
66c91e6ecb asserts: improve doc comments
thanks @mvo5, @cmatsuoka
2020-04-20 17:45:38 +02:00
Samuele Pedroni
4efd06b13b asserts: introduce ModelGrade.Code
the use case is having a fixed size bit representation of grades for
measuring in secboot code
2020-04-20 09:14:07 +02:00
Samuele Pedroni
d29d558943 asserts: UC20 mandatory ids: the code was not matching new naming 2020-04-08 14:25:56 +02:00
Samuele Pedroni
c9fd2e1c56 asserts: it should be possible to omit many snap-ids if allowed, fix
we were checking for snap id reuse even for the empty/omitted
snap-ids, those are allowed in grade dangerous for any snap
2020-04-08 14:25:56 +02:00
Michael Vogt
1ca48cd75c Merge pull request #8277 from pedronis/serial-authority-support
asserts,o/devicestate: support model specified alternative serial-authority
2020-03-26 11:31:06 +01:00
Samuele Pedroni
24e4cebd60 many: introduce naming.WellKnownSnapID
use it to infer well-known bases or snapd snap-id when dealing with
seeds

require the base to have an entry in the "snaps" stanza if not
well-known and model is not dangerous
2020-03-24 20:18:00 +01:00
Samuele Pedroni
8a37e93238 many: move snap-id validation to snap/naming, use it more 2020-03-24 18:49:57 +01:00
Samuele Pedroni
b9a815e239 asserts: cleanup a bit checkOptionalSerialAuthority 2020-03-20 12:00:13 +01:00
Samuele Pedroni
1d8b143162 asserts: support serial-authority header in model
this lets list additional authorities that can sign serials
for the model on top of the brand
2020-03-16 18:54:35 +01:00
Samuele Pedroni
266ac58888 asserts: always include the brand in SystemUserAuthority
a brand can anyway always sign a new model revision and this makes for
a more coherent behavior wrt the coming "serial-authority" header
2020-03-16 18:54:35 +01:00
Samuele Pedroni
bffab73799 test various kinds of overriding for the snapd snap in Core 20
fix issues related to support listing it explicitly in the model
2019-11-21 11:57:22 +01:00
Michael Vogt
5f913f9dfb asserts: use strings.Join() in checkModelSnap to construct error message 2019-11-06 07:57:02 +01:00
Michael Vogt
a86748023b asserts: add "snapd" type to valid types in the model assertion
This commit adds the "snapd" snap type to the valid types of the
model assertion.
2019-11-06 07:07:14 +01:00
Samuele Pedroni
7b748a5f1a * no more track field in the Core 20 snaps stanza entries
* go back to the "pinned track" terminology now that is stricly for
  Core 18
* make it the seed policy responsibility to decide what to use
  as default channel if nothing is otherwise specified, for now
  keep Core 16/18 using the latest/or default track at image build
  time
2019-10-15 16:56:50 +02:00
Samuele Pedroni
5bba757609 asserts: introduce explicit support for grade for Core 20 models
Grade can be secured|signed|dangerous. For Core 16/18 models we report grade as 'unset'.
With grade dangerous snap ids are optional in the "snaps" stanza entries.
2019-10-10 17:54:23 +02:00