For TB to be able to alert the user that they need to input their client auth credentials we need an appropriate control port event.
In particular:
When Tor fails to decrypt the second layer of desc encryption, we issue the CLIENT_AUTH_NEEDED <onion> <reason> event. Tor does not go to fetch more descs from the hsdir for this onion.
At the same time, we store the broken descriptor into the hs cache, with a special flag that says "missing client auth" and hence desc is NULL.
When TB intercepts the event it presents the user with a dialogue (#30237 (moved)) and adds any client auth creds with the commands from #30381 (moved).
As part of the #30381 (moved) commands the descriptor is decrypted.
TB issues another SOCKS request which uses the right descriptor and goes forward.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
I was thinking that the CLIENT_AUTH_NEEDED event would also need a reason field so that it can distinguish between client auth is wrong and client auth is missing, so that TB can give better error messages (see #30237 (moved)).
This all make sense to Kathy and me. One quick question — what will the timing be for:
tor generating a CLIENT_AUTH_NEEDED event
tor failing the SOCKS CONNECT
?
Specifically, I wonder if it will be safe for Tor Browser to assume the control port event will be sent before the browser receives a failure for the CONNECT, or at least to assume that will occur in most cases.
Specifically, I wonder if it will be safe for Tor Browser to assume the control port event will be sent before the browser receives a failure for the CONNECT, or at least to assume that will occur in most cases.
Hmmm... Control port events, when they occur, are queued in a list and then an tor main loop event will send the queued events on the socket.
So, if I'm not mistaken, you will get a connect failure before you get the control port event because tor will return the SOCKS failure before that control port "empty queue" event is triggered.
So, if I'm not mistaken, you will get a connect failure before you get the control port event because tor will return the SOCKS failure before that control port "empty queue" event is triggered.
That makes sense and is good to know. I asked because the technique used by Arthur's old v2 auth Torbutton patch from ticket:14389#comment:14 relies on receiving the control port event before the browser receives a connection failure indication via SOCKS. Unfortunately, it seems like we are back to adding a new error code to SOCKS5 or figuring out how to switch the browser to use HTTP CONNECT (which is a large and risky task due to the complexity of Firefox's networking stack and how HTTP CONNECT was implemented there).
While it seems like we are moving towards the SOCKS direction, I should mention that comment:52:ticket:14389 also asks for some enhancements to our SOCKS handshake. We should probably oen a new ticket for this. Also, wrt this ticket, we should consider how to use prop#229 for any additional SOCKS error codes.
I think there are too many codes there for what we need here but I wanted to at least get the basic errors implemented as well. The last two are the one TB needs for this. Going in needs_review, once we are happy with the spec, lets put it back in Assigned so we can do the code and post the proposal on tor-dev@.
Trac: Keywords: N/Adeleted, tor-spec added Status: accepted to needs_review
I think there are too many codes there for what we need here but I wanted to at least get the basic errors implemented as well. The last two are the one TB needs for this.
Kathy and I think the proposal looks good. Just a couple of comments:
I had trouble understanding the note near the beginning. Maybe reword to: "When Tor Browser supports HTTPCONNECT, we plan to stop using these SOCKS5 extensions."
Regarding compatibility, it seems like it would be safer for tor to not emit these new error codes unless enabled via a config option (maybe a SocksPort flag). Otherwise, non Tor Browser clients that use the SocksPort may be unhappy. Or maybe enable by default but provide an "escape hatch" that allows them to be disabled somehow.
I think there are too many codes there for what we need here but I wanted to at least get the basic errors implemented as well. The last two are the one TB needs for this.
Kathy and I think the proposal looks good. Just a couple of comments:
I had trouble understanding the note near the beginning. Maybe reword to: "When Tor Browser supports HTTPCONNECT, we plan to stop using these SOCKS5 extensions."
Was mostly a "future warning" for us to only extend SOCKS5 error code because it is a "bandaid" and ultimately HTTPCONNECT is the way forward. I'll rephrase.
Regarding compatibility, it seems like it would be safer for tor to not emit these new error codes unless enabled via a config option (maybe a SocksPort flag). Otherwise, non Tor Browser clients that use the SocksPort may be unhappy. Or maybe enable by default but provide an "escape hatch" that allows them to be disabled somehow.
Hmmm SocksPort flag could be an option. The other way is to create a new authentication method like prop229 does and thus the new error code are only returned if TB authenticated with this method. Former is simple, later is more involving but probably more portable for future compat?
Hmmm SocksPort flag could be an option. The other way is to create a new authentication method like prop229 does and thus the new error code are only returned if TB authenticated with this method. Former is simple, later is more involving but probably more portable for future compat?
I don't know what the right answer is, but on the browser side we could accommodate either solution. A new SOCKS5 auth method would be more work for us, but should be do-able. But maybe other SOCKS5 clients won't care if they receive new error codes? I don't know.
Apparently (feedback from mcs), the extended errors is sent out properly but only after SocksTimeout. Most likely, the connection is not properly closed when the extended error is set.
Apparently (feedback from mcs), the extended errors is sent out properly but only after SocksTimeout. Most likely, the connection is not properly closed when the extended error is set.
A little more info about this: when we use SocksTimeout 15, the correct SOCKS error is sent after 30 seconds the first time we try to load the v3 .onion, but it is sent after 15 seconds the second time we try to load it.
I will also create a new branch after I address everything from asn and fix things to follow the proposal on the tor-dev@ thread above ^. And will rebase to latest 043 in the process. Expect new things! :)
Trac: Summary: Provide control port event for when we are missing v3 client auth for an onion to prop304: Implement SOCKS new HS error code
X'F0' Onion Service Descriptor Can Not be FoundX'F1' Onion Service Descriptor Is InvalidX'F4' Onion Service Missing Client AuthorizationX'F5' Onion Service Wrong Client Authorization
The two missing ones are the intro failure and RP failure which are veryvery tricky to be honest.
For now, the SOCKS reply is not send back before the rendezvous has opened the stream so basically like if there is no optimistic data.