| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
|
| |
|
|
| |
The responder always sends an AUTH_CHALLENGE cell.
|
| |
|
|
|
|
| |
Rename them to respectively sensitive() and not_sensitive().
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
To make the code a bit better here. Also, at this commit, the
UnverifiedChannel::finish() and VerifiedChannel::finish() are basically
the exact same.
A refactoring to use a finish() helper would work nicely.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
Every specific types know if the peer is sensitive or not so now the
finish() of each of these channel types builds the right PeerInfo with
MaybeSensitive.
This is passed on the Channel so from that point on, the Channel will
never leak peer data in the logs.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
Only the R2R channel that the PeerAddr becomes unsensitive. The rest, we
keep it sensitive as it can be a client or a client's guard/bridge.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
It was all commented out until now that we have a final
RelayIdentities.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Responder relay handshake requires the peer address at the very start as
it sends its NETINFO right away.
For initiators, we only need it during the finalization process which is
when the NETINFO is sent and the Channel is created.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
This is a large change but it is basically using PeerAddr in the channel
builder through the channel handshake code and into the Channel itself.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
For the responder to build the authentication data, it needs its own
certificate of the TLS handshake that it is responding to (as a TLS
server).
This resolves an important TODO(relay) in the code.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
During the channel handshake, we require the peer IP address for the
canonicity check which requires the exact peer IP we are connected to.
This commit adds a function that enforces this requirement on a
ChannelMethod so anything else results in an error.
It is to basically have stronger guarantee on the channel method we use
in the handshake.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
All handshake pass the NETINFO cell, the advertised addresses (if any)
and the peer address in order to build the Canonicity and build the
channel with it.
In order to pull this off, the "my_addrs" were added to several object
along the NETINFO cell.
We also pass the channel method when connecting (initiator) to a relay
as we need this for this canonicity build.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
| |
This type is needed in the tor-chanmgr crate in order to decide to
verify or not the underlying relay channel.
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Add the unverified, verified, non verifiable flavor types of a responder
channel.
This follow on the previous commit to use the type system for stronger
guarantees.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds the Unverified and Verified flavor of a relay channel
specific to an initiator.
We decided to use the type system for safety and avoid patterns like:
"if chan.is_initiator() {...} else {...}"
This allows us also to not duplicate code between initiator and
responder code.
The downside is that we expose these types outside of tor-proto meaning
the caller needs to feature gate the usage of these types with the
"relay" flag.
Small price to pay for strong guarantees with the type system.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
| |
This commits returns either Some(AUTH_CELL, CERTS) or None. We future
proof ourselves against one Some and other None even if an error check
is done before.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the channel type from Unverified and Verified channels and
instead use the channel type in the underlying channel codec.
The codec requires such type in order to restrict messages sets. Instead
of duplicating it, this commit simply makes it that there is now only a
single channel type attached to a channel structure.
The resulting `struct Channel` in the end gets it copied from the
channel codec as the framed_tls gets split and given to the `Reactor`.
Down the line, we need a channel type attached to the `Channel` in order
to know if it is a client or not and authenticated or not.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
Instead, use the static AUTHTYPE_ED25519_SHA256_RFC5705 value which is
for now the only version we support.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
A Responder receiving cells from the Initiator, if it gets a CERTS, an
AUTHENTICATE must also be present (and vice-versa).
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Once channel is verified and authenticate if need be, send the NETINFO.
We require our advertised IP addresses for this so pass them to launch()
as well to the UnverifiedRelayChannel.
A cargo fmt change slipped in here, sorry about that.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is a bit loaded but it is coherent.
First, we set Eq and PartialEq to the channel message Authenticate so we
can compare it with the one we expected.
Second, the AuthenticationCell enum is introduced to store either an
AUTH_CHALLENGE or an AUTHENTICATE since one side of the handshake can
only have one. This allows us to store one or the other in
UnverifiedRelayChannel.
Depending on what we have, the authentication process is different as it
dictates which side we are on (initiator vs responder). Keep in mind
that the handshake code enforces receiving a AUTH_CHALLENGE along side
CERTS. And same goes for AUTHENTICATE which means that if we have an
AUTH_CHALLENGE in the UnverifiedRelayChannel, it is certain that the
other side wants to authenticate and we are the initiator.
Finally, the sending of CERTS and AUTHENTICATE by the initiator is now
in UnverifiedRelayChannel::check() done right after verifying the
channel CERTS and holding a "VerifiedChannel" object.
This means that the last piece, sending the `NETINFO` by the initiator
will be done in the check() but in a future commit. This leaves the
VerifiableChannel::finish() to send nothing and only finalize the
channel with the NETINFO (canonicity).
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
We need this trait for the underlying TLS stream in order to access data
such as the certificates or keying material.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces the RelayResponderHandshake object used when
accepting an inbound connection to open a channel.
There are still TODOs pepperred in the code but the base is implemented.
The Unverified and Verified channel need to be adjusted for this new
handshake.
This will come in the next commits.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This requires to make a series of cert and digest also optionnable in
the VerifiedChannel.
This change is needed because as a relay responder, you might get the
CERTS or not depending on if the other side wants to authenticate.
Client and bridges do not authenticate and thus it is expected to not
have a CERTS cell.
This leads to the UnverifiedChannel::check() function to return early
with a VerifiedChannel without any identity attached to it.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
| |
Code movement only.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
| |
They are public but avoid anyone outside implementing them.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add traits that will be returned outside tor-proto allowing us to not
expose client and relay specific channels.
The goal is for the tor-chanmgr to get those objects implementing those
traits and can build and run the reactor without knowing the specific
underlying type.
This allows us to have less code duplication and less client/relay
distinction in the chanmgr.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
The UnverifiedChannel::finish() was split in previous commit so this
adds the support for sending the right NETINFO cell instead of the
client specific one.
Added more TODOs for followup commits.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
| |
Add the finish() function that for now simply calls the generic
finish(). There is a bunch of TODO in the code in this commit explaining
why we haven't made the implementation relay specific just yet.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commits takes out the relay specific code out of UnverifiedChannel
and puts it in UnverifiedRelayChannel.
In order to pull this off, we added some fiels to the VerifiedChannel
struct so the relay code get back generated data from the
UnverifiedChannel::check() in order to do its validation work and yield
a VerifiedRelayChannel.
This also lead to a cleanup of expect() and ChannelType::is_initiator().
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
The new UnverifiedRelayChannel and VerifiedRelayChannel struct are added
to decouple the client code and put the relay component in its module.
Both objects hold the to become generic object that both client and
relay will use to create a channel.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is only done if we kept the AUTH_CHALLENGE cell and we have relay
identities. In other words, this is only when the UnverifiedChannel was
created from a RelayInitiatorHandshake.
Note: The check_internal() function is too large and should be
refactored in smaller pieces.
Note: It is also likely that we need to split UnverifiedChannel and
VerifiedChannel as it is getting client or relay members. Not great.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
The client and relay channel builder don't share anything and return
different objects hence the seperation.
Furthermore, this seperation avoids having the client ChanMgr ability to
launch relay channels.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a intermediary object between tor-chanmgr and tor-proto that is
when building a relay channel, those keys/certs need to be set in the
ChannelBuilder so the tor-proto can use them to authenticate.
We avoid that way making tor-proto depending on tor-keymgr for the
ultimate goal to avoid tor-proto to have access to all the keys in the
KeyMgr.
Future commits will introduce a relay channel builder which will use
that object to set the keys.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
This commit only adds a struct holding all the authentication data that
needs to be built during the verification process after all handshake
cells needed for authentication have been sent.
It lives in the VerifiedChannel struct so it can be used to build the
AUTHENTICATE cell and be sent before the NETINFO.
Signed-off-by: David Goulet <[email protected]>
|
|
|
This implements the relay initiator side of the handshake up to the
creation of an unverified channel.
Signed-off-by: David Goulet <[email protected]>
|