1. 16 Nov, 2017 2 commits
  2. 13 Nov, 2017 2 commits
  3. 11 Nov, 2017 1 commit
    • Tony's avatar
      Properly decode seed hosts argument in server.py · 9f238ebc
      Tony authored
      When I starting sshuttle with option `--seed-hosts example.com`, got the following error:
      
      ```
      hostwatch: Starting hostwatch with Python version 3.5.2
      hostwatch: Traceback (most recent call last):
      --->   File "sshuttle.server", line 144, in start_hostwatch
      --->   File "sshuttle.hostwatch", line 272, in hw_main
      --->   File "sshuttle.hostwatch", line 234, in check_host
      --->   File "sshuttle.hostwatch", line 32, in _is_ip
      --->   File "/usr/lib/python3.5/re.py", line 163, in match
      --->     return _compile(pattern, flags).match(string)
      ---> TypeError: cannot use a string pattern on a bytes-like object
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "assembler.py", line 37, in <module>
        File "sshuttle.server", line 393, in main
        File "sshuttle.ssnet", line 596, in runonce
        File "sshuttle.server", line 324, in hostwatch_ready
      sshuttle.helpers.Fatal: hostwatch process died
      ```
      
      It seems like the list of hosts is not properly decoded on the server side. This is an attempt to fix that.
      9f238ebc
  4. 09 Nov, 2017 2 commits
    • vieira's avatar
      Using exec in the assembler is okay · 9b315746
      vieira authored
      9b315746
    • vieira's avatar
      Initial configuration for Bandit and Prospector · 6a488b3d
      vieira authored
      With this configuration it should be feasible to achieve a perfect score
      without contortion.
      
      Rules skiped for Bandit:
      B101: assert_used
      B104: hardcoded_bind_all_interfaces
      B404: import_subprocess
      B603: subprocess_without_shell_equals_true
      B606: start_process_with_no_shell
      B607: start_process_with_partial_path
      
      Rules skiped for pylint:
      - too-many-statements
      - too-many-locals
      - too-many-function-args
      - too-many-arguments
      - too-many-branches
      - bare-except
      - protected-access
      - no-else-return
      6a488b3d
  5. 08 Nov, 2017 3 commits
  6. 07 Nov, 2017 4 commits
  7. 23 Oct, 2017 3 commits
    • vieira's avatar
      turn off debugging · 8add0086
      vieira authored
      8add0086
    • vieira's avatar
      nested if should be and · 94ea0a3b
      vieira authored
      94ea0a3b
    • vieira's avatar
      Use versions of python3 greater than 3.5 when available (e.g. 3.6) · 9b7ce281
      vieira authored
      Some Linux distros, like Alpine, Arch, etc and some BSDs, like FreeBSD, are
      now shipping with python3.6 as the default python3. Both the client and the
      server are failing to run in this distros, because we are specifically looking
      for python3.5.
      
      These changes make the run shell script use python3 if the version is greater
      than 3.5, otherwise falling back as usual.
      
      On the server any version of python3 will do, use it before falling back to
      python, as the server code can run with any version of python3.
      9b7ce281
  8. 21 Oct, 2017 2 commits
    • vieira's avatar
    • vieira's avatar
      Load pf kernel module when enabling pf · 3635cc17
      vieira authored
      When the pf module is not loaded our calls to pfctl will fail with
      unhelpful messages.
      This change spares the user the pain of decrypting those messages and manually
      enabling pf. It also keeps track if pf was loaded by sshuttle and unloads on
      exit if that was the case.
      
      Also fixed the case where both ipv4 and ipv6 anchors were added by sshuttle
      but the first call of disable would disable pf before the second call had the
      chance of cleaning it's anchor.
      3635cc17
  9. 19 Oct, 2017 2 commits
  10. 17 Oct, 2017 1 commit
    • vieira's avatar
      Make hostwatch find both fqdn and hostname · 29cd75b6
      vieira authored
      Currently hostwatch only adds hostnames even when FQDNs are available.
      This commit changes found_host so that when the name is a FQDN, both the FQDN
      and an hostname are added, e.g., given api.foo.com both api and api.foo.com
      will be added.
      
      Fixes #151 if merged.
      
      N.B.: I rarely use hostwatch, it would probably be a good idea to get feedback
      from people who actually use it before merging. Not too sure about this...
      29cd75b6
  11. 15 Oct, 2017 1 commit
    • vieira's avatar
      Use getaddrinfo to obtain a correct sockaddr · 4c50be0b
      vieira authored
      While with AF_INET sockaddr is a 2-tuple composed by (address, port),
      with AF_INET6 it is a 4-tuple with (address, port, flow info, scope id).
      
      We were always passing a 2-tuple to socket.connect which would fail whenever
      the address was, for instance, a link-local IPv6 address that needs a scope id.
      
      With this change we now use getaddrinfo to correctly compute the full tuple.
      
      Fixes #156.
      4c50be0b
  12. 17 Sep, 2017 1 commit
  13. 03 Aug, 2017 1 commit
  14. 29 Jul, 2017 1 commit
    • vieira's avatar
      Avoid port forwarding from loopback address · 4e8c2b9c
      vieira authored
      When doing port forwarding on lo0 avoid the special case where the
      traffic on lo0 did not came from sshuttle pass out rule but from the lo0
      address itself. Fixes #159.
      4e8c2b9c
  15. 18 Jul, 2017 3 commits
  16. 09 Jul, 2017 6 commits
  17. 08 May, 2017 1 commit
    • vieira's avatar
      Order first by port range and only then by swidth · f9361d70
      vieira authored
      This change makes the subnets with the most specific port ranges come
      before subnets with larger, least specific, port ranges. Before this
      change subnets with smaller swidth would always come first and only for
      subnets with the same width would the size of the port range be
      considered.
      
      Example:
      188.0.0.0/8 -x 0.0.0.0/0:443
      Before: 188.0.0.0/8 would come first meaning that all ports would be
      routed through the VPN for the subnet 188.0.0.0/8
      After: 0.0.0.0/0:443 comes first, meaning that port 443 will be
      excluded for all subnets, including 188.0.0.0/8. All other ports of
      188.0.0.0/8 will be routed.
      f9361d70
  18. 07 May, 2017 1 commit
    • João Vieira's avatar
      Adds support for tunneling specific port ranges (#144) · c4a41ada
      João Vieira authored
      * Adds support for tunneling specific port ranges
      
      This set of changes implements the ability of specifying a port or port
      range for an IP or subnet to only tunnel those ports for that subnet.
      Also supports excluding a port or port range for a given IP or subnet.
      
      When, for a given subnet, there are intercepting ranges being added and
      excluded, the most specific, i.e., smaller range, takes precedence. In
      case of a tie the exclusion wins.
      
      For different subnets, the most specific, i.e., largest swidth, takes
      precedence independent of any eventual port ranges.
      
      Examples:
      Tunnels all traffic to the 188.0.0.0/8 subnet except those to port 443.
      ```
      sshuttle -r <server> 188.0.0.0/8 -x 188.0.0.0/8:443
      ```
      
      Only tunnels traffic to port 80 of the 188.0.0.0/8 subnet.
      ```
      sshuttle -r <server> 188.0.0.0/8:80
      ```
      
      Tunnels traffic to the 188.0.0.0/8 subnet and the port range that goes
      from 80 to 89.
      ```
      sshuttle -r <server> 188.0.0.0/8:80-89 -x 188.0.0.0/8:80-90
      ```
      
      * Allow subnets to be specified with domain names
      
      Simplifies the implementation of address parsing by using
      socket.getaddrinfo(), which can handle domain resolution, IPv4 and IPv6
      addresses. This was proposed and mostly implemented by @DavidBuchanan314
      in #146.
      Signed-off-by: 's avatarDavid Buchanan <DavidBuchanan314@users.noreply.github.com>
      Signed-off-by: 's avatarJoão Vieira <vieira@yubo.be>
      
      * Also use getaddrinfo for parsing listen addr:port
      
      * Fixes tests for tunneling a port range
      
      * Updates documentation to include port/port range
      
      Adds some examples with subnet:port and subnet:port-port.
      Also clarifies the versions of Python supported on the server while
      maintaining the recommendation for Python 2.7, 3.5 or later.
      Mentions support for pfSense.
      
      * In Py2 only named arguments may follow *expression
      
      Fixes issue in Python 2.7 where *expression may only be followed by
      named arguments.
      
      * Use right regex to extract ip4/6, mask and ports
      
      * Tests for parse_subnetport
      c4a41ada
  19. 05 Apr, 2017 1 commit
    • vieira's avatar
      Work around non tabular headers in BSD netstat · ef83a5c5
      vieira authored
      netstat outputs some headers in BSD (that the Linux version does not)
      that are not tabular and were breaking our 'split line into columns
      and get nth column' logic. We now skip such headers.
      
      Should fix #141.
      ef83a5c5
  20. 21 Feb, 2017 1 commit
  21. 11 Feb, 2017 1 commit