1104 Commits

Author SHA1 Message Date
James Henstridge
f272f3e57d interfaces: add private /dev/shm support to shared-memory interface
* interfaces: add a "private" attribute to the shared-memory interface

* interfaces: forbid mixing private and non private shared-memory plugs/slots on a snap

* interfaces: add mount entries for private shared-memory plugs

* cmd/snap-update-ns: set permissions for private shared-memory directory

* tests: update test-snapd-policy-app-consumer:shared-memory plug definition

* interfaces: BeforePrepareSlot is not called on implicit slots, so don't try to do anything there.

* interfaces/builtin: update shared-memory base declaration

* interfaces, cmd/snap-update-ns: allow writing to /dev/shm

* tests: add a test for private /dev/shm support

* interfaces: small fixes from review feedback

* tests: update description of spread test

* interfaces: fix typo mentioned in review

* many: use slot-snap-id to constraint shared-memory slot installation

this makes --dangerous install work while blocking actually app slots
not allowed by the store

* interfaces/policy: test that core and snapd snaps can provide a shared-memory slot

* interfaces/policy: add tests for shared-memory interface connection

* interfaces/policy: check shared-memory auto-connect behaviour of base declaration

* interfaces, tests: if /dev/shm is a symlink, refuse to connect a private shared-memory plug

Co-authored-by: Samuele Pedroni <pedronis@lucediurna.net>
2022-04-04 15:52:26 +02:00
Samuele Pedroni
d2f39e631e asserts,interfaces/policy: slot-snap-id allow-installation constraints
The use case for this is that we have now the unsupported situation of
an interface that is superprivileged but still wants to have special
system snap slots.

Because it needs to cover also the --dangerous case the
base-declaration slot side slot-snap-type constraint cannot express
this, it needs to allow both core and app. To restrict this as needed
we then allow to use slot-snap-id which can list the well-known system
snap ids.

Notice that this kind of constraint makes sense only in the
base-declaration.  In a snap-declaration the snap-id is fixed and
implied. We also do not want to put interface rules in the actual
snap-declarations of the system snaps.

Although there's no clear use case, as the system snaps don't have
plugs, we support also plug side allow-installation plug-snap-id for
symmetry.
2022-03-25 10:14:24 +01:00
Michael Vogt
51f2f283c1 Merge pull request #11501 from mvo5/less-sanity-2
many: replace use of "sanity" with more inclusive naming in comments
2022-03-15 16:02:20 +01:00
Michael Vogt
53e100759f Merge pull request #11502 from pedronis/disable-authority-delegation
asserts: minimal changes to disable authority-delegation before full revert
2022-03-15 15:00:00 +01:00
Samuele Pedroni
331724d76d asserts: minimal changes to disable authority-delegation before full revert
authority-delegation might have been premature, disable until we might
decide for a full revert
2022-03-14 18:47:04 +01:00
Michael Vogt
277eb06412 many: replace use of "sanity" with more inclusive naming
This commit replaces the use of "sanity" with more inclusive
naming.

When `sanity` is used in a more general sense either `validity`
or `quick` is used.
2022-03-14 18:22:34 +01:00
Michael Vogt
439f267378 many: replace use of "sanity" for interface implementation checks
This commit replaces the use of "sanity" with more inclusive
naming. When `// sanity` is used to check if an interface is
implemented the comment `expected interface is implemented`
is used.
2022-03-14 17:35:33 +01:00
Maciej Borzecki
b1709a9e07 asserts: tweak external keypair manager error to include more info
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-03-02 16:49:09 +01:00
Maciej Borzecki
00bb743c35 asserts: simplify keypair manager errors
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-03-02 16:14:36 +01:00
Maciej Borzecki
bf89ad6f86 asserts: return an explicit error when key cannot be found
Return an explicit error, which can be checked for, when a key with given
ID/name is not found by the keypair manager.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-03-02 12:01:04 +01:00
Paweł Stołowski
17977aa380 Renamed preseed-sha3-384 to artifact-sha3-384. 2022-02-21 16:15:38 +01:00
Paweł Stołowski
746c6c235e uc20 -> UC20. 2022-02-21 16:07:50 +01:00
Paweł Stołowski
b1ba7f2c75 Drop the check for brand-id since it must match authority-id (and there
needs to be a valid account assertion).
2022-02-21 16:07:50 +01:00
Paweł Stołowski
626b74ea69 Check brand-id, remove AccountID getter, add missing comments. 2022-02-21 16:07:50 +01:00
Paweł Stołowski
3553b89fca Move ValidateUC20SeedSystemLabel from seed/internal to asserts and
rename to IsValidSystemLabel.
2022-02-21 16:07:50 +01:00
Paweł Stołowski
0fe92618b3 Add missing tests, remove account-id, check that authority matches
brand.
2022-02-21 16:07:50 +01:00
Paweł Stołowski
13ed0da7ba Fix gci error. 2022-02-21 16:07:49 +01:00
Paweł Stołowski
537b9b1612 Add preseed assertion type. 2022-02-21 16:07:49 +01:00
Samuele Pedroni
f8d77dabc7 asserts,interfaces/policy: move and prepare DeviceScopeConstraint for reuse
Merge pull request #11387 from pedronis/device-scope-constraint

this moves DeviceScopeConstraint to constraint.go and adds a Check method in preparation for reuse of DeviceScopeConstraint for assertion constraints from authority-delegation.
2022-02-15 11:50:39 +01:00
Samuele Pedroni
b8ce8ad908 asserts: add comments about SignatoryID() not being empty when fetching 2022-02-15 11:03:00 +01:00
Samuele Pedroni
cfaf48ef20 asserts,interfaces/policy: introduce DeviceScopeConstraint.Check
this is logic extracted from the helpers in interface/policy as now
DeviceScopeConstraint will also be used by assertion constraints for
delegation
2022-02-14 15:21:55 +01:00
Samuele Pedroni
0656be2213 asserts: adapt to new usage of compileDeviceScopeConstraint
as used in baseCompileConstraints

it now does its own detection and returns nil for no device-scope
constraints
2022-02-14 15:21:55 +01:00
Samuele Pedroni
52de97d821 asserts: move DeviceScopeConstraint to constraint.go
cleanup some things
have dedicated tests
2022-02-14 15:21:55 +01:00
Samuele Pedroni
8b397923cb asserts: teach Pool about delegation 2022-02-14 15:20:29 +01:00
Samuele Pedroni
d3bc9d65bc asserts: teach the Fetcher implemention about delegation
it should fetch authority-delegation assertions as needed
2022-02-14 15:20:29 +01:00