Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit trust establishment #383

Merged
merged 29 commits into from
Oct 8, 2024
Merged

Conversation

roosterfish
Copy link
Contributor

@roosterfish roosterfish commented Aug 26, 2024

This PR adds the explicit trust establishment to MicroCloud according to the spec in https://discourse.ubuntu.com/t/explicit-trust-establishment-mechanism-for-microcloud/44261.

The PR adds the EFF wordlist with over 1300 lines so please consider this for the review.
The license information is based on https://www.eff.org/copyright.

It has the following dependencies which have to be met before it can be marked as ready:

In addition we are currently waiting on MicroCeph to merge the v2 of MicroCluster which is also are requirement for this PR.

Open TODO's:

cmd/microcloud/session.go Fixed Show resolved Hide resolved
@roosterfish roosterfish changed the title Add excplicit trust establishment Add explicit trust establishment Aug 27, 2024
@roosterfish roosterfish force-pushed the explicit_trust branch 2 times, most recently from f59031a to 719e37f Compare August 29, 2024 11:38
@roosterfish
Copy link
Contributor Author

Added some changes as microcloud service add was broken due to the wrong certificate being used.
Functions like RemoteClusterMembers are used both during pre-init and after bootstrap/join but the latter has to use the cluster certificate.

I also made a mistake whilst rebasing #358. As the remote token creation/deletion always happens after the MicroCloud's microcluster is formed, we neither need a secret nor a custom certificate as we can already use full mTLS.

@roosterfish roosterfish force-pushed the explicit_trust branch 2 times, most recently from e60811f to d34ebe5 Compare August 29, 2024 14:23
Copy link
Contributor

@masnax masnax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, and intuitive to follow, nice job @roosterfish! :)

I mostly have nits to report, primarily structuring of the messages that are printed to the user.

Couple things that stand out:

  • During a snap mismatch, the error seems incorrect now because the multicast lookup behaviour is different: Error: Failed to read join confirmation: Failed to send join intent: Skipping peer "micro01" due to missing services (MicroOVN)

  • During preseed, it seems we require listen_address to be set, but that defeats the purpose of multicast lookup

  • the --add flag for preseed seems redundant can be improved

  • The biggest one (but also not a blocker) is the behaviour if a joiner's session ends. On the initiator there's no feedback, so as you are flipping through your joiners and typing the password, if one of them dies in the background, by the time you get back to the initiator and confirm the systems in the table, you have no way of knowing that a problem occurred, and the initiation fails. It would be nice if we could have a column for "session status" in the table so that we know when a joiner has closed its session, and can work around it. I don't believe our current table package allows for easy updates though, so we can deal with this later.

api/session.go Outdated Show resolved Hide resolved
api/session.go Outdated Show resolved Hide resolved
client/websocket.go Outdated Show resolved Hide resolved
api/session_join.go Show resolved Hide resolved
client/websocket.go Outdated Show resolved Hide resolved
service/lxd.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Show resolved Hide resolved
@roosterfish roosterfish force-pushed the explicit_trust branch 2 times, most recently from 89d9fb8 to 0d67d00 Compare September 2, 2024 14:53
cmd/microcloud/session.go Fixed Show fixed Hide fixed
api/session_join.go Outdated Show resolved Hide resolved
cmd/microcloud/session.go Outdated Show resolved Hide resolved
Copy link
Contributor

@masnax masnax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a handful of more nits, and some validation suggestions :)

Comment on lines 151 to 159
if !c.autoSetup && target == "" {
fmt.Println("Searching an eligible system ...")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "Searching for an eligible system ..." right?

Also maybe s/system/initiator/?

api/session.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Outdated Show resolved Hide resolved
cmd/microcloud/preseed.go Outdated Show resolved Hide resolved
cmd/microcloud/session.go Dismissed Show dismissed Hide dismissed
@roosterfish roosterfish force-pushed the explicit_trust branch 7 times, most recently from 829fe4c to 136a328 Compare September 9, 2024 14:25
masnax added a commit to canonical/microcluster that referenced this pull request Sep 9, 2024
This PR adds another `QueryRaw` function to the client which allows
accessing the raw `*http.Response`.
That is required for the
canonical/microcloud#383 in order to access the
remotes certificate used in the TLS connection.

Furthermore the parsing of API responses is moved into the public facing
package to allow any user of `QueryRaw` to both access the raw response
and parsing it as usual.
@roosterfish
Copy link
Contributor Author

roosterfish commented Oct 4, 2024

@masnax preseed test succeeded after resolving the conflict, so I would carefully say it's ready for review again :)

The test run before showed green for all jobs.

Signed-off-by: Julian Pelizäus <[email protected]>
This new func allows extracting the passphrase from the stdout of 'microcloud init'
and running multiple 'microcloud join' using this passphrase in interactive mode.

Signed-off-by: Julian Pelizäus <[email protected]>
Also move the join message out of waitForJoin to not indicate a join
if not all of the peers clusters are joined.

Signed-off-by: Julian Pelizäus <[email protected]>
This ensures the mDNS multicast traffic flowing between the nodes isn't interrupted as
this behavior was observed on the GitHub runners.

Signed-off-by: Julian Pelizäus <[email protected]>
@roosterfish
Copy link
Contributor Author

Did another small push as I saw a slice was initialized with the wrong capacity which caused this output during preseed:

root@micro03:~# microcloud preseed < p
Successfully joined the MicroCloud cluster and closing the session.
Commencing cluster join of the remaining services (, , , , LXD, MicroCeph, MicroOVN)

Copy link
Contributor

@masnax masnax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that 1 nit, this looks great! Thanks for the hard work @roosterfish!


# capture_and_join: extracts the passphrase from stdin and outputs text that is being passed to `TEST_CONSOLE=1 microcloud join`
# to simulate terminal input to the interactive CLI.
# Set the first argument to either true or false if you want to skip missing services.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it we removed the missing services question from microcloud join, so this description is misleading now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch, fixed with #416.

@masnax masnax merged commit 780afbb into canonical:main Oct 8, 2024
16 checks passed
@roosterfish roosterfish deleted the explicit_trust branch October 9, 2024 07:38
masnax added a commit that referenced this pull request Oct 10, 2024
masnax added a commit that referenced this pull request Oct 16, 2024
I figured the README requires some more clarification after merging
#383 as you also have to run
`microcloud join` on all the other machines if you don't want to setup
MicroCloud on a single machine.

In addition this also gives the hint that you can now have a MicroCloud
using a single machine.
roosterfish added a commit that referenced this pull request Oct 21, 2024
The `--auto` and `--wipe` flags seem to be a left over of from the
`init` command when crafting the skeleton for the new `join` command
introduced with #383.

This PR removes the flags that don't have any value for the `join`
command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants