Automatically exposes the remote container's listening ports back to the local machine

Overview

Auto-portforward (apf)

A handy tool to automatically set up proxies that expose the remote container's listening ports back to the local machine. Just like kubectl portforward or docker run -p LOCAL:REMOTE, but automatically discover and update the ports to be forwarded on the fly.

Installation

You can either download the binary from the release artifacts or build it yourself.

To manually build it, clone the repo and run the build.sh script.

Comments
  • Not working with Docker per example

    Not working with Docker per example

    Running this per the documentation does not seem to work.

    $ apf redis          
    
    *  ==> : Forwarding local listening ports to (==>) remote ports
    *  <== : Forwarding to local ports from (<==) remote listening ports (use -r option)
    
    

    No ports are opened.

    I have tried builds from commit 38558a1 and b8059ea. I've tried the -d option, but the log file is empty

    Docker version 20.10.12, build e91ed5707e Linux archlinux 5.15.10-arch1-1 #1 SMP PREEMPT Fri, 17 Dec 2021 11:17:37 +0000 x86_64 GNU/Linux

    Let me know if you need any other information

    opened by codebling 11
  • proxy listener port changed to +5k instead of 10+ for ports under 1024

    proxy listener port changed to +5k instead of 10+ for ports under 1024

    Chrome and Safari seem to have problems with ports over 10.000 and block them by default. This changes the proxy listener to add only 5000 instead of 10000 to all port numbers under 1024.

    opened by MilanVives 3
  • Change default host port for webserver containers from 10080 to something under 10K

    Change default host port for webserver containers from 10080 to something under 10K

    For some reason most browsers seem to block webservers on ports higher than 10K. Apf now by default maps all server containers (80) to host port 10080. I tried Nginx and httpd.

    Maybe change the default port to something like 9080 or 8080 to avoid this problem.

    Docker ➤ docker ps
    CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
    c88969704c48   nginx     "/docker-entrypoint.…"   15 minutes ago   Up 15 minutes   80/tcp    nginx
    Docker ➤ apf nginx
    
    *  ==> : Forwarding local listening ports to (==>) remote ports
    *  <== : Forwarding to local ports from (<==) remote listening ports (use -r option)
    
    Forwarding: [10080 ==> 80]
    

    Get request from Netcat. Website root (Nginx default page) is loaded.

    Docker ➤ nc localhost 10080
    GET / HTTP/1.2
    Host: localhost
    
    HTTP/1.1 200 OK
    Server: nginx/1.21.4
    Date: Thu, 10 Feb 2022 09:28:03 GMT
    Content-Type: text/html
    Content-Length: 615
    Last-Modified: Tue, 02 Nov 2021 14:49:22 GMT
    Connection: keep-alive
    ETag: "61814ff2-267"
    Accept-Ranges: bytes
    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
    html { color-scheme: light dark; }
    body { width: 35em; margin: 0 auto;
    font-family: Tahoma, Verdana, Arial, sans-serif; }
    </style>
    </head>
    <body>
    <h1>Welcome to nginx!</h1>
    <p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>
    
    <p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>
    
    <p><em>Thank you for using nginx.</em></p>
    </body>
    </html>
    Docker ➤
    

    Browser Screenshot 2022-02-10 at 10 30 59

    opened by MilanVives 3
  • Invalid memory address or nil pointer dereference on M1

    Invalid memory address or nil pointer dereference on M1

    ~ ➤ docker run -d --name redis redis
    ae44475c8835158e4c1d36406de38048b3b797e49f5f86a80e23f3e330b89c9f
    ~ ➤ apf redis
    
    *  ==> : Forwarding local listening ports to (==>) remote ports
    *  <== : Forwarding to local ports from (<==) remote listening ports (use -r option)
    
    Forwarding: []panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x102cdff34]
    
    goroutine 8 [running]:
    io.ReadAtLeast({0x0, 0x0}, {0x140000ae00a, 0x3, 0x3}, 0x3)
    	/opt/hostedtoolcache/go/1.17.5/x64/src/io/io.go:328 +0x74
    io.ReadFull(...)
    	/opt/hostedtoolcache/go/1.17.5/x64/src/io/io.go:347
    github.com/ruoshan/autoportforward/manager.(*Manager).receivingLoop(0x14000066000)
    	/home/runner/work/autoportforward/autoportforward/manager/manager.go:86 +0xb8
    created by github.com/ruoshan/autoportforward/manager.(*Manager).Run
    	/home/runner/work/autoportforward/autoportforward/manager/manager.go:74 +0x54
    ~ ➤
    
    opened by MilanVives 3
  • add support for podman/containerd

    add support for podman/containerd

    Please add command line argument to extend your tool for other container runtimes.

    It is probably easy to add Podman support. It has compatible command line for cp/exec commands.

    Containerd doesn't have cp command, but it looks for k8s you do same as described here https://github.com/containerd/containerd/issues/2044.

    enhancement 
    opened by k2s 1
Releases(v0.0.10)
Owner
Ruoshan Huang
0x55AA
Ruoshan Huang
Small wrapper for containers/image which exposes a HTTP API to fetch

CLI to expose containers/image fetching via HTTP This is a small CLI program which vendors the containers/image Go library and exposes a HTTP API to f

Colin Walters 2 Nov 1, 2021
Podbit is a replacement for newsboat's standard podboat tool for listening to podcasts.

Podbit - Podboat Improved Podbit is a replacement for newsboat's standard podboat tool for listening to podcasts. It is minimal, performant and abides

Ethan Marshall 11 Dec 8, 2022
A memory-safe SSH server, focused on listening only on VPN networks such as Tailscale

Features Is tested to work with SCP Integrates well with systemd Quickstart Download binary for your architecture. We only support Linux. If you don't

function61.com 2 Jun 10, 2022
Lobby - A Nox game lobby which exposes a simple HTTP API for both listing and registering Nox game servers

Nox lobby server This project provides a Nox game lobby which exposes a simple H

NoX World 3 Mar 6, 2022
Local development against a remote Kubernetes or OpenShift cluster

Documentation - start here! ** Note: Telepresence 1 is being replaced by our even better Telepresence 2. Please try Telepresence 2 first and report an

Telepresence 5.5k Jan 8, 2023
Helps you to send ssh commands to target machine in your local network from outside via gRPC

rpc-ssh In case, you don't want to make your ssh port accessible from outside local network. This repository helps you to send ssh commands to target

Berkay Akyazı 2 Nov 16, 2022
netscanner - TCP/UDP scanner to find open or closed ports

netscanner netscanner - TCP/UDP scanner to find open or closed ports installation you have to run this command to install the program $ go get github.

R4yan 201 Dec 19, 2022
rconn is a multiplatform program for creating generic reverse connections. Lets you consume services that are behind firewall or NAT without opening ports or port-forwarding.

rconn (r[everse] conn[ection]) is a multiplatform program for creating reverse connections. It lets you consume services that are behind NAT and/or fi

Hikmat Jafarli 307 Jan 1, 2023
Information Gathering tool - DNS / Subdomains / Ports / Directories enumeration

Information Gathering tool - DNS / Subdomains / Ports / Directories enumeration

gilfoyle97 542 Jan 3, 2023
Access more HTTP ports over CDN with this application.

More-Ports More Ports is a proxy service to establish all web-based applications on different ports on the server-side over a well known TCP port. It

Ahmet ÖZER 4 May 8, 2022
port close check scanner. detects open ports, sends alert with slack.

aite9 (port close check scanner) サーバのポートが空いてないことを確認するポートスキャナー たくさんのサーバを管理していると設定ミスで内部利用ポートが外部に公開されてしまっている可能性があり、それに早く気付くためのチェックツールです。 サーバのリストを標準入力で渡すと

Yasushi Ichikawa (ichikaway) 8 Feb 3, 2022
Bee is a tool to scan ports by TCP and UDP protocols

Bee - Port scan tool ?? Bee is a tool to scan ports by TCP and UDP protocols Building from Source Code First, we compile the source code with the ligh

kraken 2 Oct 10, 2021
Transparent TLS and HTTP proxy serve and operate on all 65535 ports, with domain regex whitelist and rest api control

goshkan Transparent TLS and HTTP proxy serve & operating on all 65535 ports, with domain regex whitelist and rest api control tls and http on same por

Sina Ghaderi 11 Nov 5, 2022
P2P Forwarder - a tool for farwarding tcp/udp ports. Made using libp2p.

P2P Forwarder A tool for farwarding ports. Made using libp2p. How it works A: opens desired ports ports inside P2P Forwarder A: shares it's id from P2

null 31 Nov 14, 2022
Program to simultaneously listen and respond on multiple TCP/UDP ports

listen Program to simultaneously listen on multiple TCP/UDP ports and reply back to anything sent along with IP addresses and lengths of data received

Purplecarrot 1 Feb 20, 2022
Simple traceroute ports in Go

go-traceroute simple traceroute ports in Go. Installation $ go install github.co

Tomochika Hara 2 Dec 27, 2021
GoScan is a port-scanner made entirely in Go-lang. The purpose of the tool is to be fast, dynamic and simple so that a professional in the CyberSecurity area can make an optimized list of ports

?? GoScan GoScan is a port-scanner made entirely in Go-lang. The purpose of the tool is to be fast, dynamic and simple so that a professional in the C

Ottoni 4 Jul 19, 2022
A C/S Tool to Download Torrent Remotely and Retrieve Files Back Over HTTP at Full Speed without ISP Torrent Limitation.

remote-torrent Download Torrent Remotely and Retrieve Files Over HTTP at Full Speed without ISP Torrent Limitation. This repository is an extension to

Bruce Wang 59 Sep 30, 2022
Proxy that keeps clients active until the backend server is back online

HoneySmoke HoneySmoke is a prototype proxy for testing until it eventually becomes HoneyHive. HoneySmoke will eventually implement a limbo mode that k

Ethan 4 Nov 20, 2021