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

Update exit list signing infra for contract based exits #988

Merged
merged 17 commits into from
Oct 22, 2024

Conversation

jkilpatr
Copy link
Member

@jkilpatr jkilpatr commented Sep 9, 2024

This pr can be split into modernization/update work and then exit list functionality changes.

The goal is that routers have a list of keys which can be used as the root of trust for the exit list. An exit list server exists online, publicly queryable, and returns a signed list of exits as they exit in the exit registration smart contract.

This allows exits to simply query and pass along this list to clients at will, the clients can then verify the list against their stored root of trust, and bootstrap using these exits. This resolves the need to trust a local exit to bootstrap from it and simplifies the previous structures in which the exits needed other exits configured in which to serve their own lists.

@jkilpatr jkilpatr force-pushed the jkilpatr/exit-list-infra-changes branch 13 times, most recently from a3c6fa4 to 1e8db00 Compare September 14, 2024 14:02
@jkilpatr jkilpatr force-pushed the jkilpatr/exit-list-infra-changes branch 4 times, most recently from 734c1db to 1a9ebb2 Compare September 19, 2024 00:57
@jkilpatr jkilpatr force-pushed the jkilpatr/exit-list-infra-changes branch from 1a9ebb2 to 0e2f050 Compare September 22, 2024 18:49
@ch-iara
Copy link
Contributor

ch-iara commented Oct 7, 2024

Some questions for the signing loop:
Is the idea to sign all cached values, then store them in a second cache to load? Otherwise I'm not seeing the point there when to_encrypted_server_list can be run when a client requests a signed list (and from my understanding these are one and the same caches we're accessing between the signing loop and the endpoint- but perhaps that's not true since as it stands there is a cache sent in to the endpoint as an argument?)

And then, how do I retrieve data for a contract that is not already in the cache?

@ch-iara ch-iara force-pushed the jkilpatr/exit-list-infra-changes branch from ffbf411 to 3ee30d8 Compare October 7, 2024 17:32
exit_trust_root/src/bin.rs Outdated Show resolved Hide resolved
exit_trust_root/src/bin.rs Outdated Show resolved Hide resolved
@ch-iara ch-iara force-pushed the jkilpatr/exit-list-infra-changes branch from 076305b to a10327d Compare October 11, 2024 19:06
exit_trust_root/config.toml Outdated Show resolved Hide resolved
exit_trust_root/src/bin.rs Outdated Show resolved Hide resolved
exit_trust_root/src/tls.rs Outdated Show resolved Hide resolved
let sig = list.clone().signature;
match list.data.verify(key, sig) {
true => Ok(list),
false => Err(RitaClientError::MiscStringError(
Copy link
Member Author

Choose a reason for hiding this comment

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

where it's feasible try to make a new error on RitaClientError rather than just using miscstring error it's a catch all that ideally we use sparingly and eventually eliminate. Having a specific error type will make it easier for callers to match on and handle the signature failed error if they ever want to.

@ch-iara ch-iara force-pushed the jkilpatr/exit-list-infra-changes branch 2 times, most recently from 8913a7d to 3bc3504 Compare October 18, 2024 11:20
@jkilpatr jkilpatr force-pushed the jkilpatr/exit-list-infra-changes branch from b0585b0 to be1a1ce Compare October 18, 2024 15:56
@ch-iara ch-iara force-pushed the jkilpatr/exit-list-infra-changes branch from fa33a13 to f08969d Compare October 18, 2024 19:52
@jkilpatr jkilpatr force-pushed the jkilpatr/exit-list-infra-changes branch 7 times, most recently from 20688ef to 5ba0da4 Compare October 22, 2024 00:24
jkilpatr and others added 17 commits October 21, 2024 20:26
This root of trust server allows clients to register via untrusted
exits. By viewing trusted signatures from registration server, which
signs exit lists for arbitrary registration contracts based on trusted
keys already in the client.
And cleanup for exit server list handling. We no longer need to have
ExitList and ExitListV2 with the new ExitServerList which simply
verifies received SignedExitServerList from an exit.
The multi-exit test now has clients performing the exit list
request loop between the exits and the root of trust server.
We have 180 possible regions and the miscount was causing a
serialization issue with the string representation of the data.
This patch centers around making the SignedExitList generally more
robust. By making the individual vars private with only getters, and
adding a signer field to the struct itself it's generally impossible to
accidentially modify the data and mess up a signature. Or to construct a
signed exit list when it's not needed.
…ExitList

Hashsets are iterated in random order on serialization, resulting in
signing and verification not working when the order of specific elements
had changed.

Sorting these elements before abi serializing produces a cannonical
order and makes it extremely difficult to break verification.
This patch does the actual background work required for the exits to
listen on a single multhomed ip for exit list requests.

We convert mesh_ip_v2 into an arbitrary list of additional ip's to
listen on, which is more flexible and a little cleaner considering that
we have to listen on these extra ip's in rita_common despite only
needing it for rita_exit.

We also change the exit list ip to a proper constant, rather than a
string.
...and must now query an exit visible to them to serve the
signed exit server list.
This patch removes the -async naming prefix for actix dependencies that
we adopted when pre-async and async dependencies had to co-exist in the
same binary.

While doing this all actix deps and openssl are unified into workspace
dependencies. Making them easier to track and manage.

Finally we use openssl instead of rustls for ssl in the exit trust root
as it turns out that any use of rustls poisons the workspace for easy
cross complilation.
Reqwest was at one time the best way to do a simple blocking http call.
But now we can easily do that with a async closure and awc
This patch makes the integraiton test registration retry function more
robust to failures caused when the routers don't have exit info yet.
For some reason this specific test does not init the settings that it
needs.
At this point we have passed the check test, so we know the code
compiles and the cause of failure is probably a very small tweak in the
actual logic. Therefore we should cache the build artifact to speed up
the next run.
The denied state is only for situations where the exit can not accept
the clients period for some long term or even permenant reason.

Instead the denied state was being returned even for momentary
connectivity issues, which resulted in CI failing any time the
registration server didn't finish starting up fast enough.
@jkilpatr jkilpatr force-pushed the jkilpatr/exit-list-infra-changes branch from 5ba0da4 to d84dfbc Compare October 22, 2024 00:28
@jkilpatr jkilpatr merged commit d84dfbc into master Oct 22, 2024
15 checks passed
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.

2 participants