Commit Graph

1136 Commits

Author SHA1 Message Date
Brian May
97076a9390 Adjust branches, remove temporary branches 2021-03-16 08:29:14 +11:00
Brian May
dd661e9728 Bump pyflakes from 2.2.0 to 2.3.0, flake8 from 3.8.4 to 3.9.0
Bumps [pyflakes](https://github.com/PyCQA/pyflakes) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/PyCQA/pyflakes/releases)
- [Changelog](https://github.com/PyCQA/pyflakes/blob/master/NEWS.rst)
- [Commits](https://github.com/PyCQA/pyflakes/compare/2.2.0...2.3.0)

Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.4 to 3.9.0.
- [Release notes](https://gitlab.com/pycqa/flake8/tags)
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.4...3.9.0)
2021-03-16 08:21:03 +11:00
Scott Kuhl
d6d11b24c8 Make exit code indicate a problem when pidfile is not writable.
Here, we try to open the pidfile for writing prior to forking so that
the exit code can properly indicate to the user that there was a
problem. No error messages are printed to the console in this case
because when --daemon implies --syslog. So, the syslog will contain
the message indicating that the pidfile wasn't writeable.

Fixes bug #598.
2021-03-10 07:54:55 +11:00
dependabot-preview[bot]
bb1363ec6b Bump setuptools-scm from 5.0.1 to 5.0.2
Bumps [setuptools-scm](https://github.com/pypa/setuptools_scm) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/pypa/setuptools_scm/releases)
- [Changelog](https://github.com/pypa/setuptools_scm/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pypa/setuptools_scm/compare/v5.0.1...v5.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-06 11:19:54 +11:00
Victor Kareh
167a57e739 firewall: Allow overriding the TTL
In instances where a cluster pod in a local VM needs to access a server
that is sshuttle'd from the host, since the packets arriving at the host
already made a hop, their TTL is 63 and so get ignored by sshuttle.
Allowing an override of the firewall TTL rule allows the packets to go
through.
2021-03-05 08:53:53 +11:00
Kees Hink
0e51da519f Allow comments in configuration file 2021-02-16 07:51:32 +11:00
Kees Hink
a22c453d5e Remove trailing whitespace 2021-02-16 07:51:32 +11:00
dependabot-preview[bot]
f928f94093 Bump pytest from 6.2.1 to 6.2.2
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.1...6.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-26 18:22:31 +11:00
Scott Kuhl
127cac37ef --latency-buffer-size now impacts server's buffer.
sshuttle has a --latency-buffer-size parameter, but it only changes
the buffer size on the client and not the server. Therefore,
increasing or decreasing the number doesn't make any change in
download performance (like the documentation indicates that it should).

You can test this change by setting up a sshuttle connection and
downloading a large file through sshuttle. With this patch, you should
find that increasing --latency-buffer-size increases the download
speed. Without the patch, the parameter should have little impact on
performance.
2021-01-23 10:01:42 +11:00
dependabot-preview[bot]
d68f57b534 Bump pytest-cov from 2.11.0 to 2.11.1
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.11.0 to 2.11.1.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.11.0...v2.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-22 08:45:52 +11:00
dependabot-preview[bot]
0933684d0f Bump pytest-cov from 2.10.1 to 2.11.0
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.10.1...v2.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-19 20:35:20 +11:00
masahitojp
bf7b4a6c34 chore: remove attrs from requirements-test.txt
It used to be necessary to fix the version of attrs when using pytest. This problem has been fixed now, so I removed it.
https://stackoverflow.com/a/58198754
2021-01-19 09:14:03 +11:00
masahitojp
65d437a9f8 feat: remove mock from test dependencies.
Because mock can be replace by unittest.mock
2021-01-17 15:42:55 +11:00
masahitojp
254b8e7987 remove py35 from tox.ini
Because the supported version is python3.6 and above.
2021-01-17 15:42:24 +11:00
Scott Kuhl
97c25e988e
tproxy: Skip firewall chains if packets have local destination. (#578)
If you use the tproxy method with a large subnet (such as 0/0), then
(1) you may not receive UDP packets that sshuttle/tproxy can handle
and (2) you are unable to connect to your machine using an IP that
your computer recognizes as its own.

To resolve those issues, any traffic to an IP that the host knows is
local, does not go through the sshuttle chains.
2021-01-04 09:05:32 +11:00
Scott Kuhl
b7730fc106
Improve error messages related to sshuttle server. (#580)
* Improve error messages related to sshuttle server.

There are many GitHub issues related to the cryptic message:
fatal: expected server init string 'SSHUTTLE0001'; got b''

The code that prints that message is after another check that is
intended to verify that the server is still running. This code was
faulty since the server is still running when rv==None (but exited
when rv==0).

I corrected this problem and then investigated ways to clarify the
error message. I added additional exit codes for the server: 97 (exec
in the shell returned), 98 (the python exec() function called
returned). The end result is that the cryptic error message above will
now print a more appropriate error message that should aid in
debugging.

I also changed the server so that it catches Fatal() and exits with
exit code 99 (like the client does). Previously, it was just an
unhandled exception on the server.

I suspect some of the error messages were caused by restricted shells.
I also investigated and added comments about how sshuttle might behave
if it is being run on a server that has a restricted shell.

This commit also replaces a couple of exit() calls in cmdline.py with
'return' since exit() is intended for interactive use. This change
doesn't impact the server.

* Remind user to exclude remote host when server exits with 255.
2021-01-04 08:35:10 +11:00
Scott Kuhl
7fc33c0020 Refactor debug, log and Fatal messages.
This commit rewrites the log() function so that it will append a
newline at the end of the message if none is present. It doesn't make
sense to print a log message without a newline since the next log
message (which will write a prefix) expects to be starting at the
beginning of a line.

Although it isn't strictly necessary, this commit also removes any
newlines at the ends of messages. If I missed any, including the
newline at the end of the message will continue to work as it did
before.

Previously, some calls were missing the newline at the end even though
including it was necessary for subsequent messages to appear
correctly.

This code also cleans up some redundant prefixes. The log() method
will prepend the prefix and the different processes should set their
prefix as soon as they start.

Multiline messages are still supported (although the prefix for the
additional lines was changed to match the length of the prefix used
for the first line).
2021-01-01 19:32:48 +11:00
Scott Kuhl
563f41478a Ignore quotes in config file passed to sshuttle with @
When users put parameters in a config file and pass them to sshuttle
using '@', they might copy the quotes from the command line into the
config file. This fix first ensures that we strip whitespace from the
beginning/end of each line in the config file. Then, if the line
begins and ends with a matching quote character, strip those too.

Fixes #573.
2020-12-31 10:20:22 +11:00
Herby Gillot
da848b6dba Readme: add instructions for installing via MacPorts 2020-12-29 19:12:06 +11:00
Brian May
bc72bb4811 Release version 1.0.5 2020-12-29 10:34:58 +11:00
Brian May
b8cd2fae40 Add Python 3.9 support 2020-12-28 11:01:07 +11:00
Brian May
8f0d3b0f8e Add release notes for new release 2020-12-28 10:56:01 +11:00
Scott Kuhl
6d4261e3f9 Refactor automatic method selection.
Add an "is_supported()" function to the different methods so that each
method can include whatever logic they wish to indicate if they are
supported on a particular machine. Previously, methods/__init__.py
contained all of the logic for selecting individual methods. Now, it
iterates through a list of possible options and stops on the first
method that it finds that is_supported().

Currently, the decision is made based on the presence of programs in
the PATH. In the future, things such as the platform sshuttle is
running on could be considered.
2020-12-28 10:21:56 +11:00
Samuel Bernardo
7c338866bf Set default tmark to pass coverage tests
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
Samuel Bernardo
6b87ad3fc7 Set default tmark to pass coverage tests
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
Samuel Bernardo
0efd23f3b8 Correct options typo for argument tmark
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
Samuel Bernardo
9bdd9fea5d Correct flake8 liting issues
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
Samuel Bernardo
d5cceb3e42 Add workflow_dispatch to github actions
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
Samuel Bernardo
65b139ff6e Add current branch to github workflow for testing
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
Samuel Bernardo
76b8b83e22 Add .gitignore .vscode/ path. Resolve the issue #374 adding tproxy mark option to allow different network mapping.
Signed-off-by: Samuel Bernardo <samuel@lip.pt>
2020-12-28 10:20:46 +11:00
dependabot-preview[bot]
a5214e0fd7 Bump mock from 2.0.0 to 4.0.3
Bumps [mock](https://github.com/testing-cabal/mock) from 2.0.0 to 4.0.3.
- [Release notes](https://github.com/testing-cabal/mock/releases)
- [Changelog](https://github.com/testing-cabal/mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/testing-cabal/mock/compare/2.0.0...4.0.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-16 20:15:42 +11:00
Brian May
3861d29de2
Merge pull request #571 from sshuttle/dependabot/pip/pytest-6.2.1
Bump pytest from 6.2.0 to 6.2.1
2020-12-16 20:15:16 +11:00
dependabot-preview[bot]
59a983f9a6
Bump pytest from 6.2.0 to 6.2.1
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.0 to 6.2.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.0...6.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-16 09:14:24 +00:00
Brian May
4a65f97c8b Drop testing of Python 3.5
Due to message from CI:

DEPRECATION: Python 3.5 reached the end of its life on September 13th,
2020. Please upgrade your Python as Python 3.5 is no longer maintained.
pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will
remove support for this functionality.
2020-12-16 20:11:13 +11:00
Brian May
461e676973
Merge pull request #570 from sshuttle/dependabot/pip/pytest-6.2.0
Bump pytest from 6.1.2 to 6.2.0
2020-12-14 19:12:11 +11:00
Brian May
70e3e017ab
Merge pull request #569 from sshuttle/dependabot/pip/setuptools-scm-5.0.1
Bump setuptools-scm from 4.1.2 to 5.0.1
2020-12-14 19:11:43 +11:00
dependabot-preview[bot]
26704cf742
Bump pytest from 6.1.2 to 6.2.0
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.1.2 to 6.2.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.1.2...6.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-14 06:47:57 +00:00
dependabot-preview[bot]
28a85928be
Bump setuptools-scm from 4.1.2 to 5.0.1
Bumps [setuptools-scm](https://github.com/pypa/setuptools_scm) from 4.1.2 to 5.0.1.
- [Release notes](https://github.com/pypa/setuptools_scm/releases)
- [Changelog](https://github.com/pypa/setuptools_scm/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pypa/setuptools_scm/compare/v4.1.2...v5.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-14 06:47:33 +00:00
Brian May
ff70f584d2
Merge pull request #561 from Krout0n/fix-handling-OSError
Fix handling OSError in FirewallClient#__init__
2020-11-16 17:00:29 +11:00
Krouton
5ff834bd32 Fix handling OSError in FirewallClient#__init__ 2020-11-16 10:36:39 +09:00
Brian May
6b75d62d68
Merge pull request #560 from sshuttle/dependabot/pip/attrs-20.3.0
Bump attrs from 20.2.0 to 20.3.0
2020-11-07 11:19:49 +11:00
dependabot-preview[bot]
6bbe8c0d34
Bump attrs from 20.2.0 to 20.3.0
Bumps [attrs](https://github.com/python-attrs/attrs) from 20.2.0 to 20.3.0.
- [Release notes](https://github.com/python-attrs/attrs/releases)
- [Changelog](https://github.com/python-attrs/attrs/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/python-attrs/attrs/compare/20.2.0...20.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-06 06:35:04 +00:00
Brian May
7e726bc235
Merge pull request #558 from skuhl/dns-to-none
Fix "DNS request from ... to None" messages.
2020-11-05 07:30:09 +11:00
Scott Kuhl
227412e218 Fix long line in previous commit 2020-11-04 11:40:07 -05:00
Brian May
9b036fc689
Merge pull request #552 from skuhl/systemd-resolved
Intercept DNS requests sent by systemd-resolved.
2020-11-04 16:55:09 +11:00
Brian May
34acdd0611
Merge pull request #557 from skuhl/nft-ipv6-improvements
Improve nft IPv6 support.
2020-11-04 16:52:49 +11:00
Scott Kuhl
8461e08bc3 Make server and client handle resolv.conf differently.
The server should just read from resolv.conf to find DNS servers to
use. This restores this behavior after the previous commit changed it.

The client now reads both /etc/resolv.conf and
/run/systemd/resolve/resolv.conf. The latter is required to more
reliably intercept regular DNS requests that systemd-resolved makes.
2020-11-03 20:27:57 -05:00
Scott Kuhl
d3700f09da Improve nft IPv6 support.
This commit makes two fixes:

1. If an IPv6 DNS server is used, an nft rule had "ip6 protocol" in it
which is invalid and caused sshuttle to exit.

2. I modified detection of udp vs tcp to follow the recommendation at
https://superuser.com/questions/1560376/match-ipv6-protocol-using-nftables

I also re-arranged the code slightly to reduce the number of
if-statements.
2020-11-03 20:14:56 -05:00
Brian May
92b99442c3
Merge pull request #551 from skuhl/which-fix
Improve consistency of PATH, environments, and which()
2020-11-04 08:00:53 +11:00
Scott Kuhl
709e5d1595 Improve error message when "ip" and "netstat" are missing and --auto-nets fails to work 2020-11-03 12:53:16 -05:00