mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'ticket24963_042_02'
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
o Minor feature (onion service):
|
||||
- Disallow single hop clients to introduce directly at the introduction
|
||||
point. We've removed Tor2web a while back and rendezvous are blocked at
|
||||
the relays. This is to remove load off the network from spammy clients.
|
||||
Close ticket 24963.
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "app/config/config.h"
|
||||
#include "core/or/channel.h"
|
||||
#include "core/or/circuitlist.h"
|
||||
#include "core/or/circuituse.h"
|
||||
#include "core/or/relay.h"
|
||||
@@ -546,6 +547,14 @@ circuit_is_suitable_for_introduce1(const or_circuit_t *circ)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Disallow single hop client circuit. */
|
||||
if (circ->p_chan && channel_is_client(circ->p_chan)) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Single hop client was rejected while trying to introduce. "
|
||||
"Closing circuit.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "lib/crypt_ops/crypto_rand.h"
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "core/or/channel.h"
|
||||
#include "core/or/circuitlist.h"
|
||||
#include "core/or/circuituse.h"
|
||||
#include "ht.h"
|
||||
@@ -693,6 +694,17 @@ test_introduce1_suitable_circuit(void *arg)
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
}
|
||||
|
||||
/* Single hop circuit should not be allowed. */
|
||||
{
|
||||
circ = or_circuit_new(0, NULL);
|
||||
circ->p_chan = tor_malloc_zero(sizeof(channel_t));
|
||||
circ->p_chan->is_client = 1;
|
||||
ret = circuit_is_suitable_for_introduce1(circ);
|
||||
tor_free(circ->p_chan);
|
||||
circuit_free_(TO_CIRCUIT(circ));
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
}
|
||||
|
||||
done:
|
||||
;
|
||||
}
|
||||
@@ -927,4 +939,3 @@ struct testcase_t hs_intropoint_tests[] = {
|
||||
|
||||
END_OF_TESTCASES
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user