34 Commits

Author SHA1 Message Date
Michael Vogt
718717e5c5 daemon: make marker clearer (thanks to Samuele) 2021-11-22 13:19:02 +01:00
Michael Vogt
47b7888897 daemon: amend ssh keys coming from the store
This commit adds a comment to ssh keys writen to ~/.authorized_keys
that come from the store. This will enable us in the future to
update keys that come from the store because we now have the
information what keys got added by snapd and which were added by
other means.
2021-09-10 17:31:54 +02:00
Samuele Pedroni
716b13b5f9 daemon: simplify SyncResponse
it doesn't take Meta anymore
2021-06-03 13:49:26 +02:00
Samuele Pedroni
7a84ff7d01 daemon: switch api_users.go to apiError, also cover related paths
this also adds some unit tests to cover some of the touched code paths
that weren't tested before
2021-06-01 18:48:43 +02:00
James Henstridge
eebe1636b2 Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-04-07 17:02:42 +08:00
James Henstridge
63be0de66e Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-03-18 12:15:16 +08:00
Samuele Pedroni
d0a7d7f357 daemon: rename getStore to storeFrom 2021-03-16 11:42:38 +01:00
Samuele Pedroni
926de177e3 daemon: change getStore(*Command) -> getStore(*Daemon)
this helps avoiding passing *Command around which complicates exposing
helpers if they actually want to be tested

with this we don't need to export ThemesCmd to the tests anymore
2021-03-16 11:42:38 +01:00
Samuele Pedroni
4567f6ec37 daemon,o/c/configcore: introduce users.create.automatic
the option if set to false disables automatic user creation on assertion
auto-import

it is processed early which means its setting available
before snapd starts serving users API requests
2021-03-01 17:06:18 +01:00
James Henstridge
885de6ed72 Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-01-04 15:28:41 +08:00
Michael Vogt
a954d35a91 client,daemon,snap: auto-import does not error on managed devices
The snap auto-import code right will always try to create all
known system-users when it imports any assertions. However this
leads to systemd errors and a degraded boot when a device is already
managed and a removable device with a user assertion is attached
to the device.

This commit changes the auto-import code to send a new
`automatic: true` json when running auto-imports. With that
option already managed device just return that no users are
created and no error.

This fixes https://bugs.launchpad.net/newparis/+bug/1893331
2020-10-13 11:30:41 +02:00
James Henstridge
6dca0bae80 daemon: reorder access checkers after method functions, to match struct layout 2020-08-27 13:48:57 +08:00
James Henstridge
89b0f97d4f daemon: use constants for polkit action IDs 2020-08-07 10:27:33 +08:00
James Henstridge
8dd53dfad6 Merge remote-tracking branch 'upstream/master' into daemon-access-check 2020-08-07 08:52:36 +08:00
James Henstridge
ea3c3c4b6a daemon: don't export access checkers, and rename RootOnlyAccess to rootAccess 2020-08-07 08:42:36 +08:00
James Henstridge
14b9e7ec62 daemon: have each command list a ReadAccess and/or WriteAccess policy directly.
This is simpler than determining how the current set of flags
interoperate, and more closely matches how API access is documented to
work.
2020-08-07 08:32:56 +08:00
Samuele Pedroni
3c944b608b daemon: switch to use client.ErrorKind and drop the local errorKind... 2020-08-02 16:22:51 +02:00
Michael Vogt
86b88ec13e daemon: tweak per-serial system-user assertion handling
Thanks to Samuele for the suggestions
2020-06-17 11:41:27 +02:00
Michael Vogt
1d20b3cf88 asserts,daemon: add support for "serials" field in system-user assertion
This will allow to hand out system-user assertions limited to a
limited set of serial assertions.

Implements the spec in https://forum.snapcraft.io/t/18163
2020-06-15 09:31:51 +02:00
Michael Vogt
6818fa805d daemon: fix error message from snap remove-user foo on classic
Currently we output on classic:
```
$ sudo snap remove-user foo
error: system user administration via snapd is not allowed on this
       system%!(EXTRA string=POST)
```

This commit fixes this.
2020-04-21 17:36:34 +02:00
Samuele Pedroni
dffc2489f3 Merge remote-tracking branch 'upstream/master' into snap-remove-user 2020-02-11 09:46:12 +01:00
Samuele Pedroni
e53c703bc8 many: have the user removal API return identification information
this way the API result will not need to change when we support
removing users by email
2020-02-07 13:50:47 +01:00
Robert Ancell
9b5fe04d18 daemon: Allow clients to call /v2/logout via Polkit
/v2/logout was added in e35c869d, but doesn't have allow Polkit access like
/v2/login does. This change gives it the same access as a client that is
allowed to login should also be allowed to logout.
2020-02-04 16:24:55 +13:00
Samuele Pedroni
f1a9ee12f4 daemon: adjust comment 2020-01-31 08:59:09 +01:00
Samuele Pedroni
0420aa8190 Merge remote-tracking branch 'upstream/master' into HEAD
fix conflicts
2020-01-31 08:53:42 +01:00