|
1 | 1 | # Docker mod for openssh-server
|
2 | 2 |
|
3 |
| -This mod adds rsync to openssh-server, to be installed/updated during container start. |
| 3 | +This mod adds ssh tunnelling to openssh-server, by enabling tcp forwarding during container start. |
4 | 4 |
|
5 |
| -In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync` |
| 5 | +In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel` |
6 | 6 |
|
7 |
| -# Mod creation instructions |
| 7 | +If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel|linuxserver/mods:openssh-server-mod2` |
8 | 8 |
|
9 |
| -* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. |
10 |
| -* Fork the repo, checkout the template branch. |
11 |
| -* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. |
12 |
| -* Inspect the `root` folder contents. Edit, add and remove as necessary. |
13 |
| -* Edit this readme with pertinent info, delete thse instructions. |
14 |
| -* Finally edit the `travis.yml`. Customize the build branch,and the vars for `BASEIMAGE` and `MODNAME` |
15 |
| -* Submit PR against the branch created by the team |
| 9 | +Note: `GatewayPorts` is set to `clientspecified`, this moves the responsibility to define the gateway host of the port to the client that opens the tunnel, e.g. `*:8080` to forward 8080 to all connection, default is localhost only. |
| 10 | +In addition it is still necessary to expose the same port on the container level, using either the `--expose` (only to other containers) or the `--port` (expose on host level/internet) run options (or the counterparts in docker-compose). |
| 11 | + |
| 12 | +Example: |
| 13 | + |
| 14 | +When creating the container with the following setup: |
| 15 | +``` |
| 16 | +version: '2' |
| 17 | +services: |
| 18 | + openssh-server: |
| 19 | + image: linuxserver/openssh-server |
| 20 | + environment: |
| 21 | + - DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel |
| 22 | + volumes: |
| 23 | + - /path/to/appdata/config:/config |
| 24 | + expose: |
| 25 | + - 30000 |
| 26 | + ports: |
| 27 | + - 2222:2222 |
| 28 | +``` |
| 29 | + |
| 30 | +It's possible to expose the client's port 8080 through the container's port 30000 like this: |
| 31 | +``` |
| 32 | +ssh -R *:30000:localhost:8080 example.com -p 2222 |
| 33 | +``` |
| 34 | + |
| 35 | +Port 30000 will then only be available to other containers (e.g. a web server acting as a reverse proxy). When using `ports` instead of `expose` the port would be accessible from the host (and the network it resides in, e.g. the internet). The client command can be automated using autossh. |
0 commit comments