Commit Graph

5016 Commits

Author SHA1 Message Date
Olivier Gayot 8d64d4d3ef
Merge pull request #1296 from CarlosNihelton/username-server-validation
Server-side username validation
2022-05-18 13:50:39 +02:00
Carlos Nihelton 6b3609ae3a
Fix typo "pytest-a(s)yncio" 2022-05-18 07:50:00 -03:00
Carlos Nihelton 13a23a4b46
Fix async test.
Test class inherits form IsolatedAsyncioTestCase to enable coroutines.
Event loop policy is reset on module teardown to avoid conflicting with
next tests.
2022-05-17 12:46:53 -03:00
Carlos Nihelton e6a6f7a92b
Moved the aync validation logic into a mixin class
Intended to be combined with Editor widgets
Able to call async validation functions on focus leave.
2022-05-16 18:15:02 -03:00
Carlos Nihelton df8b157ae8
Validation on focus leave.
Reduces the amount of async calls.
Challenging revalidation scheme.
2022-05-16 17:07:27 -03:00
Dan Bungert d77112b387
Merge pull request #1297 from dbungert/partition-show-path
storage/v2: show partition paths
2022-05-13 08:42:19 -06:00
Dan Bungert 112b24e6bc storage/v2: show partition paths 2022-05-12 19:09:42 -06:00
Carlos Nihelton dbe131fb59
Initializes `existing_usernames` for system_setup.
Since in WSL the target system is already mounted when Subiquity runs
its safe to Initialize that field with the target existing passwd
database.
2022-05-12 17:04:19 -03:00
Carlos Nihelton 7a4356c29f
Let `existing_usernames` be a customisation point.
Initializes it with just 'root' by default.
Server variants may find appropriate ways to initialize it.
Reading the passwd database of the target is not a reliable thing to do.
Need to find a stronger way before placing that in the main server.
2022-05-12 17:01:23 -03:00
Carlos Nihelton a0f82f0b5b
Removes the unnecessary todo
That comment was a leftover from the experimentation phase
which survived across rebases.
2022-05-12 16:09:51 -03:00
Carlos Nihelton ad3734f2b6
Removes leftover class variable in ...
the client identity controller
2022-05-12 15:40:56 -03:00
Carlos Nihelton aea54f961e
Moves model.add_user call to the right place
After the conditional
2022-05-12 11:59:45 -03:00
Carlos Nihelton f576c6fc85
Won't store validation results in the controller.
Instead the form itself keeps track of the active async task.
The validation state is returned from the task object itself.
2022-05-11 16:52:14 -03:00
Carlos Nihelton 888eb344a2
Strengths invalid characters detection in username
By doing re.fullmatch per ogayot's recommendation.
Added a test case to validate it.
The added test would fail without the fullmatch.
2022-05-11 13:00:01 -03:00
Carlos Nihelton 79205ed3ea
Reads the passwd file instead of pwd module.
Can be mocked. In dry-run reads it from resource_path.
In live run, reads it from self.app.base_model.target.
The returning set of usernames may be empty without a problem.
2022-05-11 13:00:01 -03:00
Carlos Nihelton f80880ca59
Added a passwd file copied from a livecd filesystem
To be used in dry-run.

One test case updated due the fact that the name 'lxd' will not be in use.
But 'gdm' will.
2022-05-11 12:58:58 -03:00
Carlos Nihelton b5e6506852
Exception on POST if invalid username 2022-05-11 09:14:56 -03:00
Carlos Nihelton 0798f46a33
Exception instead of checking if the file exists.
reserved-usernames
2022-05-11 09:14:42 -03:00
Olivier Gayot 73250b0c95
Merge pull request #1292 from ogayot/FR-2153
Add visual indication for starred snap developers
2022-05-11 10:33:01 +02:00
Dan Bungert b97b09341d
Merge pull request #1284 from dbungert/workflow-kinetic
workflows: +kinetic
2022-05-10 09:10:54 -06:00
Dan Bungert d750126e7f
Merge pull request #1295 from dbungert/dual-boot-win
curtin: merge 2 fixes for dual-boot support
2022-05-10 07:43:35 -06:00
Carlos Nihelton a8e3f9a218
Removes the comprehension expression with :=
Prevents flake8 error on Focal.
2022-05-10 09:58:59 -03:00
Carlos Nihelton f9d2d3100e
Fix set type hint for older Python versions 2022-05-10 09:31:48 -03:00
Carlos Nihelton 0dba0722ab
WSL Validates the username with the endpoint. 2022-05-10 09:17:36 -03:00
Carlos Nihelton 9cb27da947
Makes the TUI validate username with the endpoint. 2022-05-10 08:53:31 -03:00
Carlos Nihelton 46347d1bcc
Adds UI tests for the invalid cases. 2022-05-10 08:53:13 -03:00
Carlos Nihelton b06073d86d
Adds server side username validation.
- system_reserved_names populated from a reserved-names file.
- subiquity.server.IdentityController loads it on init.
- validation compares the submitted against it.
- also checks if exists on passwd database.
2022-05-10 08:52:26 -03:00
Carlos Nihelton 65a701e44b
API Test for the username validation. 2022-05-10 08:50:31 -03:00
Carlos Nihelton 8525a363e0
Adds type and endpoint for username validation.
identity is not simple_endpoint anymore.
2022-05-10 08:49:16 -03:00
Olivier Gayot 37de61f245 snaplist: display starred indication (✪) in orange
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-05-10 09:45:25 +02:00
Olivier Gayot cad618d91a font: allow to display circled white star in console font
The console font now embeds a representation of the circled white star.
The glyph is based on 9x15.bdf from console-setup.

Unfortunately, our font expects glyphs of width 8 so I chopped off the
first column of points from the glyph.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-05-10 09:45:25 +02:00
Olivier Gayot 2fdeb55218 snaplist: improve hack to display double stars instead of ✓
We used to rely on the narrow non-breakable space to be displayed as a
star in basic mode. This is not great and could impact other screens.

We now make use of two check-marks (each replaced by a star in basic
mode) and mask one of them in rich mode using display attributes.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-05-10 09:45:25 +02:00
Dan Bungert 89e51b468a snapcraft: update curtin 2022-05-09 14:26:01 -06:00
Dan Bungert 5eacceaf40 model: partition_type on Partition 2022-05-09 14:25:10 -06:00
Michael Hudson-Doyle 7d6d50d66d
Merge pull request #1293 from dbungert/probert-lp-1970116
probert: update for raid fix
2022-05-09 09:47:48 +12:00
Dan Bungert ef39546a08 probert: update for raid fix 2022-05-06 08:44:20 -06:00
Olivier Gayot 829dc32f42
Merge pull request #1291 from ogayot/fix-back
storage: fix crash when coming back from FS screen
2022-05-05 09:44:25 +02:00
Olivier Gayot fcb33b8a0a snaplist: do not use green color for stars in basic mode
The "**" signs replace the check-mark for a verified publisher when in
basic mode.

These "**" signs where still used green foreground color. This was the
only place where we tried to display colors in basic mode.

Keep the default colors instead. This should be more compatible.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-05-04 10:32:32 +02:00
Olivier Gayot e5017256a2 snaplist: add visual indication for starred publishers
In addition to verified publishers being indicated by a check-mark, we
now have starred publishers indicated with a circled star.

If unicode support is not available, for instance with serial
connections, we use a different number of stars to represent:

 * verified publishers: 2 stars
 * starred publishers: 1 star
 * others: no star

Because our mechanism to substitute unicode characters with ascii
equivalents expect a 1:1 mapping, we cannot simply replace the circled
start by two stars. To workaround the issue, we added a narrow
non-breakable space.

When support of unicode is available, this character shows up as a
normal space.
When support of unicode is not available, it gets replaced by a star.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-05-04 10:32:32 +02:00
Olivier Gayot d037c5f437 storage: fix crash when coming back from FS screen
In order to fix a screen not refreshing issue, the following patch
changed the return type of make_ui from an object to a callable in the
storage controller:

414a2235 storage: fix screen sometimes not refreshing after slow probing

The storage controller is the only one that reuses its make_ui()
coroutine internally. Unfortunately, the code that calls await make_ui()
was not updated in the storage controller.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-05-03 16:13:37 +02:00
Dan Bungert 3aa9263e73
Merge pull request #1290 from ogayot/FR-2310
curtin: pickup fix for HTTP proxy settings being discarded
2022-04-29 18:18:51 -06:00
Olivier Gayot b6c68a40b3 curtin: pickup fix for HTTP proxy settings being discarded
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-29 10:51:19 +02:00
Michael Hudson-Doyle a0906aa4ac
Merge pull request #1287 from ogayot/optional-search_drivers
source: add a default value for search_drivers in POST /source
2022-04-29 14:01:05 +12:00
Michael Hudson-Doyle e0f9ae5b22
Merge pull request #1285 from mwhudson/extended-part-display
indent logical partitions and gaps in extended partitions
2022-04-29 13:59:39 +12:00
Olivier Gayot d981029ddc source: add a default value for search_drivers in POST /source
For backward compatibility reasons with the desktop installer
implementation, we now provide a default value (i.e., false) for the new
search_drivers parameter in /source.

Added non-regressions test for it.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-28 19:34:47 +02:00
Olivier Gayot 0267f7d66f
Merge pull request #1286 from ogayot/tap-network
Add ability to pass custom -nic options to QEMU
2022-04-28 19:14:46 +02:00
Olivier Gayot e58d1d00c2 kvm-test: introduce ability to pass -nic options to QEMU
The only way we had to pass -nic options to QEMU was to specify the
number of networks using the --nets option. Depending on its value, the
option would instruct QEMU to:
 * instantiate *n* user host networks if --nets >= 1
 * instantiate no network if --nets is 0
 * instantiate a "dead" network if --nets < 0

To simulate more advanced networks (such as networks where HTTP proxy is
needed), we want to add the possibility to use TAP network interfaces.

This patch adds the ability to pass custom -nic options to QEMU.

Three new options are available:

 * The --nic option passes the argument as-is to QEMU -nic option
 * The --nic-user option passes a user host network -nic option to QEMU
   - with SSH forwarding enabled. This is just like we do when using the
     --nets >= 1 option)
 * The --net-tap takes the name of an existing tap interface and
   generates the following -nic argument:

    tap,id={ifname},ifname={ifname},script=no,downscript=no,model=e1000

In the example below:
 * the first network uses the tap0 interface.
 * the second network uses the tap1 interface (it is syntactically
   equivalent to the first one)
 * the third network uses a user host network (with SSH forwarding)

  $ kvm-test.py \
    --nic tap,id=tap0,ifname=tap0,script=no,downscript=no,model=e1000 \
    --nic-tap tap1 \
    --nic-user

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-28 14:48:51 +02:00
Michael Hudson-Doyle 31a652ae2a indent logical partitions and gaps in extended partitions 2022-04-28 15:58:03 +12:00
Olivier Gayot eb7dee2c9e kvm-test: get rid of unused import random
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-27 20:04:33 +02:00
Olivier Gayot 6165c0a423 kvm-test: don't require LIVEFS_EDITOR if not building
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-27 19:59:37 +02:00