GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dockerfiles/ssh-forward at main · continuouspipe/dockerfiles

Expand file tree

/

ssh-forward

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

ssh-forward

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
etc/supervisor/conf.d
etc/supervisor/conf.d
 
 
usr/local/share/container
usr/local/share/container
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 

README.md

Outline

SSH forward

In a docker-compose.yml:

version: '3'
services:
  sshforward:
    image: quay.io/continuouspipe/ssh-forward:latest
    environment:
      SSH_FORWARD_PASSWORD: forward
      SSH_AUTHORIZED_KEYS: "ssh-rsa AAA..."

In a Dockerfile:

FROM quay.io/continuouspipe/ssh-forward:latest

How to build

docker-compose build ssh_forward
docker-compose push ssh_forward

About

This is a Docker image to use for ssh port forwarding. For instance in order to run Selenium Webdriver locally while running Behat on the docker container, or for PHP XDebug remote debugging

Note: it's not recommended to expose this container's ssh port to the public internet. Local docker development it's ok to expose it to the host's localhost. Kubernetes has local port forwarding that can expose the SSH port from a cluster to localhost.

How to use

Environment variables

The following variables are supported

Variable Description Expected values Default
SSH_FORWARD_PASSWORD Sets a password for the 'forward' user for use with SSH with password authentication password unset
SSH_AUTHORIZED_KEYS Sets the authorized ssh keys for the 'forward' user for use with SSH with public key authentication line-delimited ssh public keys unset

Examples

Remote port forwarding a local selenium Webdriver service on port 4444

If via CP, get access to the sshforward port locally

cp-remote forward -s sshforward 2222:22

If via local Docker, this assumes you've exposed port 22 to localhost:2222

Next:

Remote port forward localhost:4444

ssh -p 2222 forward@localhost -N -R 4444:localhost:4444

Add a behat profile extending default to behat.yml:

sshforward:
  extensions:
    Behat\MinkExtension:
      selenium2:
        wd_host: http://sshforward:4444/wd/hub

Run behat

SOCKS proxy into a K8S cluster or Docker for Mac/Windows

If via CP, get access to the sshforward port locally

cp-remote forward -s sshforward 2222:22

If via Docker for Mac/Windows, this assumes you've exposed port sshforward:22 to localhost:2222

Next:

Set up a SSH SOCKS proxy:

ssh -p 2222 forward@localhost -N -D 1080

Configure your browser to use localhost:1080 as a SOCKS proxy

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.