torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
257 stars 75 forks source link

Is it possible can_exit_to returns True for non exits, maybe cause missing the descriptor? #88

Closed juga0 closed 3 years ago

juga0 commented 3 years ago

In sbws we retrieve the full descriptors (with descriptor = controller.get_server_descriptor(fp) and configuration options) and check whether it can exit to a port for some IPs with descriptor.exit_policy.strip_private().can_exit_to(port=443).

Sometimes it happens that descriptor.exit_policy.strip_private().can_exit_to(port=443) returns True, then i check the flags in metrics and the relay is not an exit.

Is it possible that happens cause the descriptor is missing?

I run the experiment of logging getattr(descriptor, "exit_policy", None) for all descriptor as soon as the consensus is obtained and the descriptor of each relay is obtained via descriptor = controller.get_server_descriptor(fp), and they were all None. However getattr(descriptor, "exit_policy", None) doesn't return None for most relays some seconds after.

I can try to reproduce it in a script, if that helps.

atagar commented 3 years ago

then i check the flags in metrics and the relay is not an exit

Hi juga. Tor's 'Exit' flag means 'can exit to ports 80 and 443'. Feel free to reach out to the network team for more details on how the flag is granted, but it is not authoritative in indicating if a relay allows some form of exiting or not.