Skip to content

Conversation

@Kuroneer
Copy link
Contributor

@Kuroneer Kuroneer commented Oct 3, 2023

Commit msg:

Having --dst-type LOCAL rules before DNS ones forces the usage of a dnsmasq-like program to retrigger DNS requests 
directed locally because they are fast-tracked through the firewall and ignored by sshuttle.

As dns options documentation state that they capture the requests no matter the server, and other methods and older 
versions behave consistently, change the iptables rules to apply DNS ones first.

After a much required upgrade (from 0.78.5 to 1.1.1), I found that my setup was no longer working. I traced it to the DNS requests being ignored.

In order to solve the issue, I had to change from

  sshuttle \
    --method=tproxy \
    --listen 0.0.0.0:0 \
    --remote $REMOTE \
    --ns-hosts $(get_ip_local) \
    --disable-ipv6 \
    --exclude $(get_ip_local)/24 \
    $REMOTE_NETWORKS

to

  dnsmasq --no-resolv --server=1.1.1.1
  sshuttle \
    --method=tproxy \
    --listen 0.0.0.0:0 \
    --remote $REMOTE \
    --ns-hosts 1.1.1.1 \
    --disable-ipv6 \
    --exclude $(get_ip_local)/24 \
    $REMOTE_NETWORKS

My setup involves configuring the sshuttle box as the DNS for the remote search domains and the default gateway for the different clients.

I'm not sure this PR is worth it, seeing that it can be solved by adding a dnsmasq. But since it's a behaviour change (both in versions and methods (-nat works ok)), and the doc does not mention it, I figured I'd try a PR

@brianmay
Copy link
Member

brianmay commented Oct 3, 2023

The tests need updating... :-)

@Kuroneer
Copy link
Contributor Author

Kuroneer commented Oct 3, 2023

The tests need updating... :-)

Oh, I didn't expect them to fail, I'll get to it

Having --dst-type LOCAL rules before DNS ones forces the usage of a
dnsmasq-like program to retrigger DNS requests directed locally
because they are fast-tracked through the firewall and ignored by
sshuttle.

As dns options documentation state that they capture the requests no
matter the server, and other methods and older versions behave
consistently, change the iptables rules to apply DNS ones first.
@Kuroneer
Copy link
Contributor Author

Kuroneer commented Oct 3, 2023

The tests need updating... :-)

Done, tests running locally

@brianmay brianmay merged commit 794b14e into sshuttle:master Oct 3, 2023
@Kuroneer Kuroneer deleted the tproxy-dns-rules-first branch October 3, 2023 21:25
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.

2 participants