Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

skuhl
Copy link
Contributor

@skuhl skuhl commented Mar 10, 2021

This patch checks to see if the client and the server are running on
the same machine. The client creates a temporary file that the server
then looks for. If the server finds the file, it knows it is on the
same machine as the client and it deletes the file. Next, if the
client detects that the file has been deleted by the server, it
assumes that it is running on the same machine as the server.

This check is necessary since a user may specify a remote host with
"-r" that actually points back to the same machine the client is on.

This commit uses tempfile.mkstemp() which was added in Python 2.3.

Functionally, this commit does nothing except add a debug message
about if the client and server are on the same machine. It also sets a
variable which contains this information for potential future use.

Potential future uses include...

  1. If the TTL hack is removed, this can be used to print a error
    message since running the client and server on the same machine would
    no longer be supported.

  2. If the TTL hack is continued, we could disable the hack when the
    client and the server are on different machines.

This patch checks to see if the client and the server are running on
the same machine. The client creates a temporary file that the server
then looks for. If the server finds the file, it knows it is on the
same machine as the client and it deletes the file. Next, if the
client detects that the file has been deleted by the server, it
assumes that it is running on the same machine as the server.

This check is necessary since a user may specify a remote host with
"-r" that actually points back to the same machine the client is on.

This commit uses tempfile.mkstemp() which was added in Python 2.3.

Functionally, this commit does nothing except add a debug message
about if the client and server are on the same machine. It also sets a
variable which contains this information for potential future use.

Potential future uses include...

1) If the TTL hack is removed, this can be used to print a error
message since running the client and server on the same machine would
no longer be supported.

2) If the TTL hack is continued, we could disable the hack when the
client and the server are on different machines.
skuhl added a commit to skuhl/sshuttle that referenced this pull request Jul 12, 2021
Previously, it was possible to run sshuttle locally without using ssh
and connecting to a remote server. In this configuration, traffic was
redirected to the sshuttle server running on the localhost. However,
the firewall needed to distinguish between traffic leaving the
sshuttle server and traffic that originated from the machine that
still needed to be routed through the sshuttle server. The TTL of the
packets leaving the sshuttle server were manipulated to indicate to
the firewall what should happen. The TTL was adjusted for all packets
leaving the sshuttle server (even if it wasn't necessary because the
server and client were running on different machines).

Changing the TTL caused trouble and some machines, and
the --ttl option was added as a workaround to change how the TTL was
set for traffic leaving sshuttle. All of this added complexity to the
code for a feature (running the server on localhost) that is likely
only used for testing and rarely used by others.

This commit updates the associated documentation, but doesn't fully
fix the ipfw method since I am unable to test that.

This change will also make sshuttle fail to work if -r is used to
specify a localhost. Pull request sshuttle#610 partially addresses that issue.

For example, see: sshuttle#240, sshuttle#490, sshuttle#660, sshuttle#606.
skuhl added 3 commits July 16, 2021 13:37
Since sshuttle's TTL code was removed in a recent commit, this code
will cause sshuttle to exit when the host specified with -r is
actually the localhost.
@skuhl
Copy link
Contributor Author

skuhl commented Jul 20, 2021

Now that #661 is merged in, this can be merged in too (assuming we want a check like this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.