summaryrefslogtreecommitdiff
path: root/src/feature
AgeCommit message (Collapse)Author
2021-04-21hs: Fix memory leak in client cacheDavid Goulet
Fixes #40356 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-08guard: Don't check bridge transport name when selecting eligible guardsDavid Goulet
This is related to ticket #40360 which found this problem when a Bridge entry with a transport name (let say obfs4) is set without a fingerprint: Bridge obfs4 <IP>:<PORT> cert=<...> iat-mode=0 (Notice, no fingerprint between PORT and "cert=") Problem: commit 09c6d0324626ffa349c7eed66d9ede92ecd71583 added a check in get_sampled_guard_for_bridge() that would return NULL if the selected bridge did not have a valid transport name (that is the Bridge transport name that corresponds to a ClientTransportPlugin). Unfortuantely, this function is also used when selecting our eligible guards which is done *before* the transport list is populated and so the added check for the bridge<->transport name is querying an empty list of transports resulting in always returning NULL. For completion, the logic is: Pick eligible guards (use bridge(s) if need be) then for those, initiate a connection to the pluggable transport proxy and then populate the transport list once we've connected. Back to get_sampled_guard_for_bridge(). As said earlier, it is used when selecting our eligible guards in a way that prevents us from selecting duplicates. In other words, if that function returns non-NULL, the selection continues considering the bridge was sampled before. But if it returns NULL, the relay is added to the eligible list. This bug made it that our eligible guard list was populated with the *same* bridge 3 times like so (remember no fingerprint): [info] entry_guards_update_primary(): Primary entry guards have changed. New primary guard list is: [info] entry_guards_update_primary(): 1/3: [bridge] ($0000000000000000000000000000000000000000) [info] entry_guards_update_primary(): 2/3: [bridge] ($0000000000000000000000000000000000000000) [info] entry_guards_update_primary(): 3/3: [bridge] ($0000000000000000000000000000000000000000) When tor starts, it will find the bridge fingerprint by connecting to it and will then update the primary guard list by calling entry_guard_learned_bridge_identity() which then goes and update only 1 single entry resulting in this list: [debug] sampled_guards_update_consensus_presence(): Sampled guard [bridge] ($<FINGERPRINT>) is still listed. [debug] sampled_guards_update_consensus_presence(): Sampled guard [bridge] ($0000000000000000000000000000000000000000) is still listed. [debug] sampled_guards_update_consensus_presence(): Sampled guard [bridge] ($0000000000000000000000000000000000000000) is still listed. And here lies the problem, now tor is stuck attempting to wait for a valid descriptor for at least 2 guards where the second one is a bunch of zeroes and thus tor will never fully bootstraps: [info] I learned some more directory information, but not enough to build a circuit: We're missing descriptors for 1/2 of our primary entry guards (total microdescriptors: 6671/6703). That's ok. We will try to fetch missing descriptors soon. Now, why passing the fingerprint then works? This is because the list of guards contains 3 times the same bridge but they all have a fingerprint and so the descriptor can be found and tor can bootstraps. The solution here is to entirely remove the transport name check in get_sampled_guard_for_bridge() since the transport_list is empty at that point. That way, the eligible guard list only gets 1 entry, the bridge, and can then go on to bootstrap properly. It is OK to do so since when launching a bridge descriptor fetch, we validate that the bridge transport name is OK and thus avoid connecting to a bridge without a ClientTransportPlugin. If we wanted to keep the check in place, we would need to populate the transport_list much earlier and this would require a much bigger refactoring. Fixes #40360 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-17Merge remote-tracking branch 'tor-gitlab/mr/333' into maint-0.4.5George Kadianakis
2021-03-15Merge branch 'maint-0.4.4' into maint-0.4.5Nick Mathewson
2021-03-15Merge branch 'maint-0.3.5' into maint-0.4.4Nick Mathewson
2021-03-15Merge branch 'bug40316_035_v2' into maint-0.3.5Nick Mathewson
2021-03-15Fix detection of point to insert signatures on a pending consensus.Nick Mathewson
We were looking for the first instance of "directory-signature " when instead the correct behavior is to look for the first instance of "directory-signature " at the start of a line. Unfortunately, this can be exploited as to crash authorities while they're voting. Fixes #40316; bugfix on 0.2.2.4-alpha. This is TROVE-2021-002, also tracked as CVE-2021-28090.
2021-03-15Merge branch 'maint-0.4.4' into maint-0.4.5Nick Mathewson
2021-03-15Merge branch 'maint-0.3.5' into maint-0.4.4Nick Mathewson
2021-03-15Clarify new intended strategy with TROVE-2021-001Nick Mathewson
We're going to disable this feature in all versions for now.
2021-03-15Merge branch 'maint-0.4.4' into maint-0.4.5Nick Mathewson
2021-03-15Merge branch 'maint-0.3.5' into maint-0.4.4Nick Mathewson
2021-03-10hs: Remove hamrless BUG() that can happenDavid Goulet
When reloading a service, we can re-register a service and thus end up again in the metrics store initialization code path which is fine. No need to BUG() anymore. Fixes #40334 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-08Don't warn about missing guard state if controller picked first hopNick Mathewson
See comments about why this needs a new flag and we can't just use CIRCUIT_PURPOSE_CONTROLLER. Fixes #40285; bugfix on 0.3.2.1-alpha.
2021-02-23relay: Avoid a directory early fetchDavid Goulet
The directory_fetches_from_authorities() is used to know if a client or relay should fetch data from an authority early in the boot process. We had a condition in that function that made a relay trigger that fetch if it didn't know its address (so we can learn it). However, when this is called, the address discovery has not been done yet so it would always return true for a relay. Furthermore, it would always trigger a log notice that the IPv4 couldn't be found which was inevitable because the address discovery process has not been done yet (done when building our first descriptor). It is also important to point out that starting in 0.4.5.1-alpha, asking an authority for an address is done during address discovery time using a one-hop circuit thus independent from the relay deciding to fetch or not documents from an authority. Small fix also is to reverse the "IPv(4|6)Only" flag in the notice so that if we can't find IPv6 it would output to use IPv4Only. Fixes #40300 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22Merge remote-tracking branch 'tor-gitlab/mr/316' into maint-0.4.5Nick Mathewson
2021-02-22Merge remote-tracking branch 'tor-gitlab/mr/309' into maint-0.4.5Alexander Færøy
2021-02-22relay: Move log notice after suggested address lookupDavid Goulet
When trying to find our address to publish, we would log notice if we couldn't find it from the cache but then we would look at the suggested cache (which contains the address from the authorities) in which we might actually have the address. Thus that log notice was misplaced. Move it down after the suggested address cache lookup. Closes #40300 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-19Disable the dump_desc() function.Nick Mathewson
It can be called with strings that should have been length-delimited, but which in fact are not. This can cause a CPU-DoS bug or, in a worse case, a crash. Since this function isn't essential, the best solution for older Tors is to just turn it off. Fixes bug 40286; bugfix on 0.2.2.1-alpha when dump_desc() was introduced.
2021-02-17relay: No longer test dirport reachability for authoritiesRoger Dingledine
Now that exit relays don't allow exit connections to directory authority DirPorts, the follow-up step is to make directory authorities stop doing DirPort reachability checks. Fixes #40287 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-17metrics: Handle the connection finished flushing eventDavid Goulet
Turns out, we forgot to add the METRICS connection type fo the finished flushing handler. Fixes #40295 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-12Merge branch 'tor-gitlab/mr/304' into maint-0.4.5David Goulet
2021-02-12config: Do not compare for duplicate ORPorts with different addressesDavid Goulet
We were just looking at the family which is not correct because it is possible to have two explicit ORPort for the same family but different addresses. One example is: ORPort 127.0.0.1:9001 NoAdvertise ORPort 1.2.3.4:9001 NoListen Thus, this patch now ignores ports that have different addresses iff they are both explicits. That is, if we have this example, also two different addresses: ORPort 9001 ORPort 127.0.0.1:9001 NoAdvertise The first one is implicit and second one is explicit and thus we have to consider them for removal which in this case would remove the "ORPort 9001" in favor of the second port. Fixes #40289 Signe-off-by: David Goulet <dgoulet@torproject.org>
2021-02-12Merge branch 'tor-gitlab/mr/302' into maint-0.4.5David Goulet
2021-02-12Merge remote-tracking branch 'tor-gitlab/mr/293' into maint-0.4.5Alexander Færøy
2021-02-12Merge remote-tracking branch 'tor-gitlab/mr/295' into maint-0.4.5George Kadianakis
2021-02-10relay: Don't look at omit flag when building descriptorDavid Goulet
That comes from 685c4866acf8489c58aca41ec01aa5a53e39220a which added that check correctly except for when we build a descriptor. We already omit the IPv6 address, if we need to, when we encode the descriptor but we need to keep the actual discovered address in the descriptor so we can notice future IP changes and be able to assess that we are not publishable as long as we don't specifically set the omit flag. This lead to also having tor noticing that our IP changed from <nothing> (no IPv6 in the descriptor) to a discovered one which would trigger every minute. Fixes #40279, #40288 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08Merge remote-tracking branch 'tor-gitlab/mr/296' into maint-0.4.5Nick Mathewson
2021-02-08conn: Properly close MetricsPort socket on EOFDavid Goulet
Handle the EOF situation for a metrics connection. Furthermore, if we failed to fetch the data from the inbuf properly, mark the socket as closed because the caller, connection_process_inbuf(), assumes that we did so on error. Fixes #40257 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08Don't log supported-protover warnings if consensus is older than Tor.Nick Mathewson
Previously we would warn in this case... but there's really no justification for doing so, and it can only cause confusion. Fixes bug #40281; bugfix on 0.4.0.1-alpha.
2021-02-08relay: Look at the omit IPv6 flag when publishingDavid Goulet
In two instances we must look at this flag: 1. When we build the descriptor so the IPv6 is NOT added to the descriptor in case we judge that we need to omit the address but still publish. 2. When we are deciding if the descriptor is publishable. This flags tells us that the IPv6 was not found reachable but we should still publish. Fixes #40279 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08relay: Fix Coverity warning for unchecked returned valueDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03nodelist: Remove merge artefactDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03Merge branch 'maint-0.4.4' into maint-0.4.5David Goulet
2021-02-03Merge branch 'maint-0.4.3' into maint-0.4.4David Goulet
2021-02-03Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2021-02-03node: Move reentry set to use a digestmap_tDavid Goulet
Any lookup now will be certain and not probabilistic as the bloomfilter. Closes #40269 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03Merge branch 'maint-0.4.3' into maint-0.4.4David Goulet
2021-02-03Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2021-02-03relay: Double the size of the relay reentry setDavid Goulet
This is to minimize false positive and thus deny reentry to Exit connections that were in reality not re-entering. Helps with overall UX. Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01node: Move reentry set to use a digestmap_tDavid Goulet
Any lookup now will be certain and not probabilistic as the bloomfilter. Closes #40269 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01relay: Double the size of the relay reentry setDavid Goulet
This is to minimize false positive and thus deny reentry to Exit connections that were in reality not re-entering. Helps with overall UX. Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29Merge branch 'tor-gitlab/mr/285' into ticket2667_044_01David Goulet
2021-01-29Merge branch 'tor-gitlab/mr/284' into ticket2667_043_01David Goulet
2021-01-29relay: Add bloomfiter of relay address + {OR|Dir}PortDavid Goulet
In order to deny re-entry in the network, we now keep a bloomfilter of relay ORPort + address and authorities ORPort + address and DirPort + address combinations. So when an Exit stream is handled, we deny anything connecting back into the network on the ORPorts for relays and on the ORPort+DirPort for the authorities. Related to #2667 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29test: Add test for exits blocking reentry to the networkGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29relay: Add bloomfiter of relay address + {OR|Dir}PortDavid Goulet
In order to deny re-entry in the network, we now keep a bloomfilter of relay ORPort + address and authorities ORPort + address and DirPort + address combinations. So when an Exit stream is handled, we deny anything connecting back into the network on the ORPorts for relays and on the ORPort+DirPort for the authorities. Related to #2667 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-28Merge branch 'tor-gitlab/mr/256' into maint-0.4.4David Goulet
2021-01-28Merge branch 'tor-gitlab/mr/255' into maint-0.4.3David Goulet
2021-01-28Merge branch 'tor-gitlab/mr/254' into maint-0.3.5David Goulet