Commit Graph

6729 Commits

Author SHA1 Message Date
Maciej Borzecki f0183d1cee console_conf: set application level snapd connection
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-08 07:34:48 +01:00
Dan Bungert 3035098d22
Merge pull request #1908 from dbungert/fix-cc-state-dir
tests: fix state_dir failure
2024-02-07 23:31:14 -07:00
Ondrej Kubik 55a1bff166 console_conf: identity: use snapd unix socket
When running in strict snap confinement snap client binary is not
accessible. Additionally output format of snap client binary is
not guaranteed not to change. snapd REST API should be used instead.

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2024-02-08 07:29:16 +01:00
Dan Bungert 17a0a198ef tests: fix state_dir failure 2024-02-07 23:05:56 -07:00
Dan Bungert f03d5b5c5a
Merge pull request #1873 from kubiko/console-conf-use-ready-fingerprints
console_conf: identity: use prepared fingerprints
2024-02-07 22:57:43 -07:00
Dan Bungert cd1fc53126
Merge pull request #1904 from bboozzoo/bboozzoo/console-conf-use-one-run-dir
console-conf: set project name, consistently use as state directory
2024-02-07 22:50:47 -07:00
Dan Bungert 47256905a4 ssh: fix unclosed file 2024-02-07 22:45:06 -07:00
Maciej Borzecki b6f8cf334f console_conf/controllers/identity: use state directory when querying host key info
When obtaining host key fingerprints, use the state directory.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-07 11:44:05 +01:00
Maciej Borzecki 66e8222a09 subiquitycore: use a premade host key fingerprints info if present
It is possible that the platform integration glue may have already prepared a
summary of host key fingerprints at the state directory. If so, use it
otherwise, try to build the summary directly.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-07 11:44:05 +01:00
Ondrej Kubik 082c59a9a9 console_conf: identity: move strict confinement handling to ssh
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2024-02-07 11:30:39 +01:00
Ondrej Kubik e6aa7e1dcc console_conf: identity: allow use of prepared host keys fingerprints
In strict snap confinement, sshd config or host keys are not accessible.
If strict confinement is detected, instead allow reuse of
the host keys fingerprints already prepared by invoking process.
Prepared fingerprints are stored in: /run/console-conf/host-fingerprints.txt

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2024-02-07 11:30:39 +01:00
Maciej Borzecki 87efd8aa18 console_conf: use snap helper for obtaining project name
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-07 11:20:44 +01:00
Maciej Borzecki 0764bb50b9 console_conf/controllers: add unit test for identity controller
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-07 11:20:44 +01:00
Maciej Borzecki 592887b540 console_conf/controllers/identity: store login details in project state directory
Since we set a project name centrally, it implies a specific path to the state
directory. Instead of hardcoding the same value directly again in the controller
code, use the application level state directory.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-07 11:17:20 +01:00
Maciej Borzecki f3043cde88 console_conf/core: use a common project for console-conf related apps
Make sure that console-conf related apps use the same value for project, which
results in using the same shared state directory.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-07 11:17:20 +01:00
Ondrej Kubik 3295691e6b console_conf: use 'console-conf' as project name
'project' value is used to construct /run/<project> path
Other parts are already using 'console-conf', prefer this syntax.
In the future we might consider using SNAP_NAME, and this '_' are
not permitted as part of the snap name.

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2024-02-07 11:17:20 +01:00
Dan Bungert 5a1a2b0faa
Merge pull request #1875 from kubiko/console-conf-wrapper
console_conf: modify wrapper helper to consider consol-conf as snap
2024-02-06 20:44:31 -07:00
Dan Bungert 177df5002c
Merge pull request #1906 from bboozzoo/bboozzoo/snap-helpers
subiquitycore: helpers for probing for snap execution environment
2024-02-06 20:36:17 -07:00
Dan Bungert 61af71f64d
Merge pull request #1905 from bboozzoo/bboozzoo/drop-user-key-fingerprint
console_conf: do not attempt to obtain user's public key fingerprints
2024-02-06 20:35:00 -07:00
Maciej Borzecki b4708b0a51 subiquitycore: helpers for probing for snap execution environment
Add helpers for probing if the process is executing inside a snap.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-06 16:02:08 +01:00
Maciej Borzecki 257910e52d console_conf/models: drop key fingerprints
The fingerprints are not used anywhere, no point in keeping the field.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-06 14:05:41 +01:00
Maciej Borzecki b19c716613 console_conf/controllers: do not attempt to set user's key fingerprint
In preparation for running console-conf as a strictly confined snaps, review of
the existing code has shown that user's key fingerprints are not being used or
displayed anywhere. Since we would not be able to read those public keys anyway,
we may as well drop the code which attempts to device the key fingerprints.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-06 14:03:55 +01:00
Dan Bungert b2441fd91d
Merge pull request #1902 from dbungert/cloud-init-status-json
cloudinit: handle format=json status
2024-02-05 17:19:47 -07:00
Chris Peterson 48e5f9c616
Merge pull request #1897 from Chris-Peterson444/autoinstall-exception-FR-6293
AutoinstallError exception
2024-02-05 16:19:15 -08:00
Dan Bungert b064528ed4 cloudinit: handle format=json status
Add version checks for cloud-init to know if we can read status in JSON
format or not.  If so, use that for a superior answer to the legacy
format.  Handle legacy code paths also.
2024-02-05 10:58:35 -07:00
Chris Peterson 24de248cec AutoinstallError: Disable apport reporting
Autoinstall related failures are more likely than not going to be
user caused, so we shouldn't immediately generate a crash report
for these types of failures. This should hopefully allow the user
to debug their autoinstall data much faster and reduce the number
of autoinstall-related bugs reported.
2024-02-05 09:37:42 -08:00
Dan Bungert fa8cc0371f
Merge pull request #1903 from bboozzoo/bboozzoo/log-dir-owner-in-snap
subiquitycore/log: use 'root' as group for strictly confined snaps
2024-02-05 10:13:35 -07:00
Maciej Borzecki 5c266cc38c subiquitycore/log: use 'root' as group for strictly confined snaps
When setting up the logging in a strictly confined snap, use the 'root' group,
rather than 'adm'. This will not interfere with the sandbox's policy but also
does not result in providing wider access to the logs.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-02-05 16:18:03 +01:00
Chris Peterson f1944dd2f7 AutoinstallValidationError: An error for autoinstall validation failures
Adds a base exception type for Autoinstall related failures and a
specific implementation for autoinstall validation failures.

When a user passes incorrect autoinstall data, the installer will crash
with an AutoinstallValidationError exception. Failure messages are
currently in the form of:

    "Malformed autoinstall in '<autoinstall_key>' section"

where <autoinstall_key> is the name of the top-level key a particular
controller is responsible (e.g., 'apt' and MirrorController).

The section reporting is a little crude in the validation
of the base schema done by SubiquityServer, which can't discern
between the 'interative-sessions' and 'version' keys, but for now
the scope is pretty limited and can be fixed up at a later time.
2024-02-01 10:30:46 -08:00
Chris Peterson e29a2a6c11 SubiquityServer: Include interactive-sections as a property
SubiquityServer is responsible for checking and loading the
interactive-sessions, so it should be responsible for validating
this section as well. Additionally add this to the autoinstall
schema in the docs.
2024-01-29 20:15:45 -08:00
Chris Peterson 53180bbc35
Merge pull request #1898 from Chris-Peterson444/schema-doc-literalinclude
doc: use literalinclude for autoinstall-schema
2024-01-29 16:36:12 -08:00
Dan Bungert fb9679abfa
Merge pull request #1900 from dbungert/workflow-noble
workflow: +noble
2024-01-29 17:18:06 -07:00
Dan Bungert a695329216 ui/identity: remove _AsyncValidatedMixin
_AsyncValidatedMixin has been merged into the parent UsernameEditor,
reluctantly. I like the concept of _AsyncValidatedMixin, but what's
happening here is that UsernameEditor has inherited from 3 classes, the
first of which is in urwid, and when the constructor /
super().__init__() status changed in urwid,
_AsyncValidatedMixin.__init__() stopped being called.

OK cool, so maybe we'll just manually run initializers in the case where
it matters.  That's semi-better, but with old urwid we end up calling
_AsyncValidatedMixin.__init__() twice (once directly, once by the urwid
__init__ using super()).

Further workarounds could be employed but at the moment there is one
user of _AsyncValidatedMixin, so just merge it into UsernameEditor.
2024-01-29 15:40:49 -07:00
Dan Bungert 29b3f361d1 scripts: handle cloud-init status 2 2024-01-29 13:52:58 -07:00
Chris Peterson 25b65e4e1a doc: use literalinclude for autoinstall-schema
Instead of manually changing the autoinstall-schema reference,
use literalinclude to insert the autoinstall-schema.json file
from the root of the repository.
2024-01-29 09:31:32 -08:00
Olivier Gayot 20b131ce07 ubuntu-pro: display warning message on pre-releases
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-26 10:54:59 +01:00
Chris Peterson f6a7819ef9 autoinstall: unittests to validate autoinstall schema
Provided autoinstall data is already validated against a specific
schema by the relevant controller, but these schemas themselves
are never validated against a meta schema to guarantee they are
valid JSON schemas. This patch adds unit tests for each controller,
as well as SubiquityServer, to validate their autoinstall schema
against the latest JSON meta schema draft (that is supported in
jsonschema). A particular draft validator can be used instead by
specifying meta schema in the schema definition.
2024-01-25 13:50:22 -08:00
Dan Bungert 9264e23631 workflows: +noble 2024-01-25 14:31:16 -07:00
Dan Bungert 601650b65d
Merge pull request #1896 from dbungert/workflow-drop-focal
workflows: -focal
2024-01-25 14:25:02 -07:00
Dan Bungert 994097ef1f workflows: -focal 2024-01-25 14:07:09 -07:00
Olivier Gayot 9d4bd5708c
Merge pull request #1893 from ogayot/ssh-fixes
Fix empty list of authorized_keys in /ssh endpoint
2024-01-25 17:35:30 +01:00
Yao Wei (魏銘廷) 7923aee7cd factory-reset: remove factory reset EFI boot entry 2024-01-25 11:08:34 +08:00
Yao Wei (魏銘廷) cf91a281fa make factory reset GRUB entry chainload into reset partition GRUB 2024-01-25 11:03:48 +08:00
Yao Wei (魏銘廷) 58bfe12d21 reset_partition accepts fixed size 2024-01-25 10:23:14 +08:00
Olivier Gayot 2692173a18 ssh: drop unused variable from model
The SSHModel contained a ssh_import_id member variable. According to the
comment, it was originally meant to store meta-data about a SSH key ;
and was supposed to allow showing some sort of info back in the SSH view
if the user decides to go back.

I suspect that this variable has been unused for a long time.
Furthermore, it can only hold information about a single SSH key and we
support multiple keys..

Let's get rid of it.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-24 18:47:29 +01:00
Olivier Gayot b1cdd74775 ssh: pass the autorized_keys in GET /ssh
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-24 18:47:29 +01:00
Chris Peterson 5a301bcdd6
Merge pull request #1889 from Chris-Peterson444/update-reame-with-docs
Update README with hosted documentation
2024-01-24 07:25:00 -08:00
Olivier Gayot ed5329dcff
Merge pull request #1887 from kubiko/deb-build-cleanup
debian: use 'install -D' instead 'mkdir + install'
2024-01-24 14:53:25 +01:00
Olivier Gayot d19171c052 ubuntu-pro: enable on noble, although it's not yet marked LTS
The /etc/lsb-release file currently on noble shows:

  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=24.04
  DISTRIB_CODENAME=noble
  DISTRIB_DESCRIPTION="Ubuntu Noble Numbat (development branch)"

Therefore, the Ubuntu Pro pages get skipped. This makes testing on noble
difficult, so make an exception for noble now and we'll drop it once
it's marked LTS.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-24 13:16:51 +01:00
Olivier Gayot 1f026ac539 apt: use pathlib instead of os
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-24 11:36:50 +01:00