Commit Graph

6508 Commits

Author SHA1 Message Date
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
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
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
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
Michael Hudson-Doyle 162f00b773
Merge pull request #1885 from julian-klode/apt-no-main-sources-list
apt: Only backup/restore sources.list if it exists
2024-01-24 13:15:45 +13:00
Chris Peterson 20759840b9 controller tests: move setting autoinstall_default
Move the assignment of autoinstall_default to the relevant block
where it's being tested.
2024-01-23 14:10:11 -08:00
Olivier Gayot 9b612dac34 apt: ensure we always drop CDROM info from sources.list
Back when sources.list was always present, we would:
 * move the contents of sources.list to sources.list.d/original.list
 * write the CDROM info to sources.list so the CDROM cat be used as an
   APT source
 * restore the original sources.list file when .deconfigure() is called,
   effectively discarding CDROM info

Nowadays, there is no guarantee that sources.list exists. So restoring
the contents of sources.list may mean deleting sources.list if it wasn't
present in the first place.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-22 13:03:35 +01:00
Olivier Gayot 3064343f45 apt: add tests for deconfigure with and without network
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-22 13:03:35 +01:00
Olivier Gayot d7e84a176f
Merge pull request #1888 from ogayot/apport-title-show-curtin-step
apport: show name of curtin stage when an error occurs
2024-01-19 19:12:45 +01:00
Olivier Gayot f555d6800e apport: show name of curtin stage when an error occurs
When an error occurs during the execution of a "$ curtin install"
invocation, the associated bug report would be titled:

  "install failed crashed with CalledProcessError"

This is not very user friendly and it does not immediately give any
insight on:

With the number of reports that we receive these days, I think
classifying these reports would make our life a bit easier, and possibly
make the users understand better what's going on.

This change adds a wat to detect if a bug report is the result of a
"$ curtin install" invocation failing. If it is, subiquity sets the
title of the bug report accordingly. Examples:

 * "partitioning crashed with CurtinInstallError"
 * "extract crashed with CurtinInstallError"
 * "curthooks crashed with CurtinInstallError"

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-19 12:10:35 +01:00
Chris Peterson 54b751cae0 readme: update contribution section wording 2024-01-18 11:23:58 -08:00
Chris Peterson 62de2b1311 readme: add Documentation section 2024-01-18 11:23:40 -08:00
Olivier Gayot eae97db849
Merge pull request #1886 from ogayot/probert-double-os-prober
filesystem: double probert timeout when running os-prober
2024-01-18 17:27:14 +01:00
Ondrej Kubik 9d34332be1 debian: use 'install -D' instead 'mkdir + install'
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2024-01-17 10:45:04 -08:00
Olivier Gayot 3d914e9e30 filesystem: double probert timeout when running os-prober
We know that running os-prober on some systems is slow, potentially very
slow, especially when multiple removable devices are present.

This results in many bug reports showing "block probing crashed with
TimeoutError".

For now, I suggest we double the probert timeout when os-prober is
involved.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-01-17 14:52:13 +01:00
Julian Andres Klode 5db34f84c8 apt: Only backup/restore sources.list if it exists
We backup the sources.list to a file in sources.list.d to be
able to insert our source first; if we do not have a sources.list
this is not necessary.

If an image uses ubuntu.sources, this logic also works fine as
sources.list that we write will be sourced before the ubuntu.sources.
2024-01-15 17:10:05 +01:00
Robert Krátký 753ce9f701
Merge pull request #1883 from rkratky/FR-6244_docs-update
Misc. docs updates and fixes
2024-01-12 15:41:38 +01:00
Olivier Gayot a16a69d489
Merge pull request #1879 from ogayot/nvme-o-tcp-probert-update
Update probert to get NVMe controllers information and add example file using it
2024-01-11 09:06:12 +01:00
Robert Krátký 562248af27 Fix Sphinx/rST warnings. 2024-01-10 16:17:57 +01:00
Robert Krátký b2552a3d96 Add search-bar Go button. 2024-01-10 16:17:57 +01:00
Robert Krátký f2504fe859 Update feedback button color. 2024-01-10 16:17:57 +01:00