Skip to content

allow client-side port or port range to be specified #365

Open

Description

@ott2

It would be useful if mosh allowed the client port, or port range, to be specified. The envisaged scenario is something like:

  1. set up firewall to pass through UDP port 60001
  2. mosh -p 60001 -P 60001 server.example.com.

or with port ranges:

  1. set up firewall to pass through UDP ports 6[01]000
  2. mosh -p 60000:61000 -P 60000:61000

Mosh currently uses a system-assigned port number for mosh-client. It is therefore not possible to tunnel mosh through stateless firewalls, unless they are set up to allow essentially all UDP through.

(This scenario is common for DNS. For instance, a BIND name server can be configured to always use source port 53 when acting as a client, allowing a port 53-only UDP pass-through on the firewall.)

The code for server-side port ranges is already in place, via try_bind(), although this is not currently exposed to the user. What seems to be required is a modification to the client's Connect() to call try_bind() with a port or port range, if specified.

Activity

  1. yaniv-aknin commented on Mar 20, 2013

    @yaniv-aknin

    +1

  2. JustRamires commented on Mar 25, 2013

    @JustRamires

    I've tried to modify source code(https://github.com/JustRamires/mosh/commit/3d0381938573c0f7ced3a201e916c3946fc1300c). But when I try to start mosh-client I get the "MOSH_KEY environment variable not found" error. And I can't change mosh because I don't know Perl(The script doesn't pass the port range to mosh-client).
    How can I test my changes?

  3. sinkers commented on May 27, 2013

    @sinkers

    +1 Mosh looked cool but without a way to get through a firewall it makes it pretty much unusable in a corporate environment

  4. andersk commented on Jul 8, 2013

    @andersk
    Member

    Duplicate of #296 (now closed).

  5. cgull commented on May 31, 2016

    @cgull
    Member

    Actually, this is not a duplicate of #296; that's about specifying a server side port range, this is about specifying a client side port or port range.

  6. reopened this on May 31, 2016
  7. eminence commented on Aug 3, 2017

    @eminence
    Member

    #530 is one solution (though it doesn't expose a command line parameter like this issue suggests)

  8. added this to the mosh-1.5.0 milestone on Jan 20, 2023
  9. achernya commented on Jan 20, 2023

    @achernya
    Collaborator

    Adding a --client-bind= would be a reasonable spelling.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions