refraction-networking / conjure

Conjure Refraction Networking station code
https://refraction.network
Apache License 2.0
66 stars 19 forks source link

Port Randomization follow-up fixes #244

Closed jmwample closed 9 months ago

jmwample commented 9 months ago
  1. undo unnecessary change to the internal Transport interface and ensure all subnets not supporting port randomization use the default port

  2. Prefix transport selects the incorrect port for the chosen prefix id

In general I have been mentally conflating things that should generally be independent wrt. port randomization, the prefix transport, and the transport interface. For starters the prefix transport "port randomization" is not the same as the subnets "not supporting port randomization". The prefix transport (and really all of the transports that have their own "Randomize Destination Port" parameter) indicate user preferences indicated by the dialer. This was originally used for the min and obfs4 transports to enable port randomization. For the prefix transport using this parameter to "disable port randomization" means that the transport wont use a randomly generated port, but the original port specific to the prefix (i.e. 80 for HTTP, 443 for TLS, etc.). The only requirement for these types of parameters is that the station agrees / picks / generates the same port that the client is going to connect to.

This is different than the phantom subnets that do not support port randomization which indicate that a station is only able to tap traffic on the original port. This may change in the future, but this has nothing to do with the transport interface. This means that any packets sent to a port other than the default will not be seen on the station so adherence to this requirement is not optional and cannot be overridden by any transport.