Sign inSign up

servercontainers/sshtunnel

By servercontainers

•Updated 3 months ago

ssh tunnels with restricted users on debian:stretch container

Image
0

1.3K

servercontainers/sshtunnel repository overview

⁠SSH Tunnel Container on debian:stretch

it gives you a hardened ssh configuration where you only allow tcp forwarding to specific ports.

Look at the Docker Compose file.

Can have multiple users with thier own custom configurations

It is roughly based on this informations: https://askubuntu.com/questions/48129/how-to-create-a-restricted-ssh-user-for-port-forwarding⁠

⁠Environment Variables

  • USER_<username>

    • takes ssh public key as argument
    • add a new user and authorize public key
    • e.g. USER_bob: 'ssh-rsa AAAAB3...your.ssh.public.key.here... bob@macbook'
  • PERMIT_OPEN_<username>_<permissionname>

    • takes a sshd PermitOpen configuration option as value
    • e.g. PERMIT_OPEN_bob_bbchttp: 'www.bbc.com:80'

all values are able to use multiple values

⁠Establish Port Forwarding using SSH Client

ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -N -L 8080:www.bbc.com:80 [email protected] -p 2222

if you want the command to recover server disconnects/downtimes etc. just encapsulate it whithin while true; do command_from_above; sleep 1; done

Tag summary

Content type

Image

Digest

sha256:c93c9a34e…

Size

60.3 MB

Last updated

3 months ago

docker pull servercontainers/sshtunnel