Giter Club home page Giter Club logo

Comments (1)

zack-vii avatar zack-vii commented on September 25, 2024

this would be possible but towards your issue it seems to be possible to forward port to a file instead (under linux-like os').

[source chatGPT]
Yes, it is possible to restrict a locally forwarded port to the current user on a Unix-like operating system (such as Linux or macOS) by utilizing the file system's permissions and network configuration. This can help prevent other users on the same machine from accessing a tunnel port set up by another user.

Here's a step-by-step guide on how to achieve this:

    Choose a Port: Decide on a port number that will be used for your local port forwarding. Let's assume you want to forward port 8080.

    Create a Specific Directory: Create a directory to store configuration files and sockets related to your port forwarding. For example:

    bash

mkdir ~/.local_forwarding

Set Permissions: Ensure that only your user has access to this directory. You can do this by changing the directory's permissions:

bash

chmod 700 ~/.local_forwarding

Forward the Port: When forwarding the port, specify a Unix socket in your specific directory:

bash

ssh -L ~/.local_forwarding/forwarded_socket:/localhost:8080 user@remote_host

This command forwards port 8080 on the remote host to the Unix socket ~/.local_forwarding/forwarded_socket on your local machine.

Restrict Access: To prevent other users from accessing the Unix socket, you should make sure that your user is the only one with read and write permissions to the socket file:

bash

    chmod 600 ~/.local_forwarding/forwarded_socket

    Inform the Application: If you are using an application that connects to the forwarded port (e.g., a web browser), configure it to use the Unix socket path instead of the traditional host and port. For example, in a web browser, you might enter unix:~/.local_forwarding/forwarded_socket as the proxy server.

By using Unix sockets and setting strict file permissions, you can restrict access to the locally forwarded port to your user only. Other users on the same machine should not have access to this socket, thereby preventing them from accessing the tunnel port set up by another user.

It should be possible to use the tunnel protocol to gain access to that port. we could provide a default tunnel for this kind of forwarding.

from mdsplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.