Commit Graph

87 Commits

Author SHA1 Message Date
Ian Jackson af168c8d4c Merge branch 'hss_send_raw' into 'main'
hss: use send_raw_msg in rend_handshake.

See merge request tpo/core/arti!1536
2023-08-23 12:56:43 +00:00
Ian Jackson 9a0715c6e8 ipt establisher API: pass a struct to new() (fmt)
One of rustfmt's changes here is wrong.  Whatever.
2023-08-23 12:47:42 +01:00
Ian Jackson 0cf3243260 ipt establisher API: pass a struct to new()
Now new() only has a reasonable number of arguments and removes some
repetition in the mocking arrangements in the IPT Manager.

This is the minimum amount that needs to be done in the commit that
touches both the IPT Establisher and the Manager.
2023-08-23 12:47:05 +01:00
Ian Jackson 4f558c4413 tor-hsservice: Add a TODO for breaking up the big function
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934367
2023-08-23 10:06:44 +01:00
Ian Jackson 6bdaa733f1 tor-hsservice: timeout_track: Add some TODOs
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934299
2023-08-23 10:06:44 +01:00
Ian Jackson ee4bc33003 tor-hsservice: ipt-m: Add a TODO about code motion
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934300
2023-08-23 10:06:44 +01:00
Ian Jackson 9189d5817b tor-hsservice: ipt-m: tests: Fix wrong comment
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934298
2023-08-23 10:06:44 +01:00
gabi-250 411a43162f Fix doc formatting. 2023-08-23 10:06:44 +01:00
Ian Jackson a117564140 tor-hsservice: About half of an IPT Manager
There are many TODOs and no tests, but it does compile.
2023-08-23 10:06:44 +01:00
Ian Jackson b39b92b856 tor-hsservice: Expose the ipt_establish and publish modules
I still think putting these in svc/ module doesn't make much sense.
Anyway, we can leave them there for now, but I need to get at them
from crate::ipt_establisher.
2023-08-23 10:04:31 +01:00
Ian Jackson 627708af14 tor-hsservice: Provide timeout tracking utilities - tests 2023-08-23 10:03:44 +01:00
Ian Jackson 11874ac7ec tor-hsservice: Provide timeout tracking utilities
This module is perhaps rather more comprehensive than needed right
now.  But I found I kept wanting to change which bits of it I used.
2023-08-23 10:03:44 +01:00
Nick Mathewson 7a37641aeb Use "typos-cli" to fix a bunch of typos. 2023-08-22 16:23:51 -04:00
Nick Mathewson f7adbce05a hss: use send_raw_msg in rend_handshake. 2023-08-22 10:56:08 -04:00
Nick Mathewson 232c6d957e hss: Improve comments in IptEstablisher::drop. 2023-08-22 10:51:19 -04:00
Nick Mathewson d792bc2a5f hss: Allow IptEstablisher to start in Advertised mode. 2023-08-22 10:51:19 -04:00
Nick Mathewson 980407a894 hss: switch to select_biased 2023-08-22 10:51:19 -04:00
Nick Mathewson 683e607db7 hss: change terminate oneshot to send "void".
We don't actually want to distinguish drop from not-drop.
2023-08-22 10:51:19 -04:00
Nick Mathewson 2a20d1b05a hss: enable tor_proto/experimental-api
Needed for ClientCirc::wait_for_close
2023-08-22 10:51:18 -04:00
Nick Mathewson 1309bc6753 HSS: Use correct timeouts and delays in IptEstablisher 2023-08-22 10:50:43 -04:00
Nick Mathewson 28b8c9c31c HSS: Use a more accurate timeout for ESTABLISH_INTRO handshake. 2023-08-22 10:50:43 -04:00
Nick Mathewson ec6721ec94 HSS: Refactor RendRequest so we can return a stream of it.
We need a type that holds a rend_handshake::IntroRequest object
internally, but where we don't materialize that object from the
Introduce2 message inside the MsgHandler, since that's more crypto
than we want to put in that task.
2023-08-22 10:50:43 -04:00
Nick Mathewson 85c3820a5e HSS: Use DropNotifyWatchSender.
This ensures that the status becomes Faulty when the reactor exits.
2023-08-22 10:50:43 -04:00
Nick Mathewson 8439500e57 HSS: Implement start_accepting and drop for IptEstablisher.
This does not yet do exactly what's documented, but it's closer.
2023-08-22 10:50:43 -04:00
Nick Mathewson 36424540dd hss: launch task to establish introduce requests.
(This requires us to change the type of the data sent in the
stream. I hope to put it back soon.)
2023-08-22 10:50:43 -04:00
Nick Mathewson 07e7eabd3f hss: Once an ipt session is established, let it keep running. 2023-08-22 10:50:43 -04:00
Nick Mathewson 7c14371898 hss: make Ipt establisher code use an mpsc::Sender.
This solves some problems but introduces a few new ones; I've tried
to open comments for the latter.
2023-08-22 10:50:43 -04:00
Nick Mathewson d83ff291bf hss: Establish intro point by RelayIds. 2023-08-22 10:50:43 -04:00
Nick Mathewson 109efd3152 Merge branch 'hss_ct_from_parts' into 'main'
hsservice: Compute rendezvous points correctly.

See merge request tpo/core/arti!1521
2023-08-22 13:55:17 +00:00
Nick Mathewson 1ddf637572 hsservice: Fix an error message. 2023-08-22 08:04:12 -04:00
Nick Mathewson 3352b1373b hsservice: Compute rendezvous points correctly.
This duplicates some code from hsclient as noted in the comments;
it might be good to reduce this, but the remaining nontrivial
duplication is small, and the logic flow is slightly different
because of the two-step process.
2023-08-22 08:04:12 -04:00
gabi-250 15f9da4d0e Merge branch 'hss-err' into 'main'
tor-hsservice errors: Introduce more error types

See merge request tpo/core/arti!1515
2023-08-18 13:39:20 +00:00
gabi-250 fbd3a4f597 Merge branch 'ipt-e-drop' into 'main'
Define drop behaviour of IPT establisher, wrt status watch

See merge request tpo/core/arti!1516
2023-08-18 13:15:19 +00:00
Nick Mathewson af4fcf83ad hsservice: Use correct circparameters_from_netparameters fn
I had incorrectly thought that this function was private.
2023-08-18 08:14:51 -04:00
Nick Mathewson b831bcca9f Merge branch 'allow_stream_req-hop-num' into 'main'
tor-proto: Make ClientCirc::allow_stream_requests take a HopNum.

Closes #1009

See merge request tpo/core/arti!1519
2023-08-18 12:06:29 +00:00
Gabriela Moldovan 67a77680dd
tor-proto: Make ClientCirc::allow_stream_requests take a HopNum.
For consistency with the other `ClientCirc` APIs,
`ClientCirc::allow_stream_requests` now takes a `HopNum` argument. Upon
receiving an incoming stream request, the reactor now checks if the
request came from the hop specified in `allow_stream_requests` (and if
it came from a different hop, the circuit is closed).

Part of #1009
2023-08-18 12:14:01 +01:00
Ian Jackson 61f58daadd tor-hsservice: Change IptEstablisher::new to take RelayIds
The IptEstablisher needs to continuously maintain the IPT even as the
netdir is updated.  Whereas, the IPT manager just wants to select the
relay from the netdir once and then only think about the relay
identity.

So it makes sense for the establisher to do necessary lookups of the
relay's ids in the netdir.
2023-08-17 15:54:54 +01:00
Ian Jackson 64c8b38c25 tor-hsservice: Define drop behaviour of IPT establisher status 2023-08-17 14:42:26 +01:00
Nick Mathewson f63852f449 Merge branch 'rendezvous_handshake' into 'main'
hsservice: new rend_handshake module

See merge request tpo/core/arti!1512
2023-08-17 13:29:18 +00:00
Ian Jackson 360c90a9d8 tor-hsservice errors: Distinguish operational errors by context
At the very least, I need FatalError to be distinct:
IptEstablisher::new ought not to fail unless everything is terrible.

Add a the Spawn variant to FatalError (that we'll need soon) and the
Bug variant (which it seems likely we might need).

This also gets rid of the crate-level Result alias.
2023-08-17 13:28:44 +01:00
Ian Jackson e1405cdb11 tor-hsservice errors: Return ReconfigureError from reconfigure
This is what we do elsewhere.
2023-08-17 13:28:44 +01:00
Ian Jackson 5e047da9cc tor-hsservice errors: Use Bug for methods that oughtn't to fail
If the service encouters operational errors, surfacing them here is
not helpful.  So these methods ought to work, if they weren't called
erroneously.
2023-08-17 13:19:21 +01:00
Nick Mathewson 2d2bf1c945 hsservice: new rend_handshake module
This code has most of what we need to go from an INTRODUCE2 message
we've just received to the point where we've connected to the
rendezvous point and we're waiting for a stream of BEGIN messages.
Unfinished pieces are marked with TODO HSS.

Most of #980.
2023-08-17 08:18:21 -04:00
Ian Jackson e3b9371ddf tor-hsservice errors: Make stop() infallible
The semantics of an Err return from this are unclear.  Was it stopped?
And what kind of error might we even return?
2023-08-17 13:16:50 +01:00
Ian Jackson c391ac2a90 tor-hsservice errors: Use `crate::Result` rather than imports
We want to change the error return types of many methods, so we need a
way to name `std::result::Result`.

We could use `StdResult`, but, actually, properly distinguishing the
kinds of errors that can occur in various contexts means we don't
actually want a single Error type for the whole crate, so
`crate::Result` is going to go away.
2023-08-17 13:12:23 +01:00
Ian Jackson 8e58ab54ba tor-hsservice: Have IptEstablisher::new() return the status watch (fmt) 2023-08-16 18:12:04 +01:00
Ian Jackson c161f41b57 tor-hsservice: Have IptEstablisher::new() return the status watch
The IPT manager is going to want to separate the IptEstablisher
struct (which contains the Drop signal) from the watch receiver.

We could add an accessor to clone the watch, but the copy in the
IptEstablisher would be redundant.

This makes new()'s signature a bit funky but it's an internal method
so I think that's fine.
2023-08-16 18:12:04 +01:00
Nick Mathewson 0ee63cb04b Wire up more of IptEstablisher.
It now supports running in a loop, trying to establish an
introduction point, and reporting status.
2023-08-16 08:22:53 -04:00
Nick Mathewson ff2d0cffab reformat establish_intro_once 2023-08-15 18:44:11 -04:00
Nick Mathewson 806b08fdbe Make establish_intro_once a method on a new IptEstablisherReactor.
This will help with making a keep_established method.
2023-08-15 18:42:31 -04:00