Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:ssh [2022/04/11 13:48] alfred [Tunel reverso] |
wiki2:ssh [2022/05/25 07:38] (actual) |
||
|---|---|---|---|
| Línea 166: | Línea 166: | ||
| ssh -R "0.0.0.0:81:0.0.0.0:8000" webapps | ssh -R "0.0.0.0:81:0.0.0.0:8000" webapps | ||
| </code> | </code> | ||
| - | Este ejemplo sirve el puerto 81 de la interface 0.0.0.0 en webapps, redirigido a la interface local 0.0.0.0:8000. Es decir, cualquier petición que llegue por la 81 a webapps será mapeada al puerto local 8000 donde una app puede estar escuchando. | + | Este ejemplo sirve el puerto 81 de la interface 0.0.0.0 en webapps, redirigido a la interface local 0.0.0.0:8000. Es decir, cualquier petición que llegue por la 81 a webapps será mapeada al puerto local 8000 donde una app puede estar escuchando. Se puede escribir así también: ''ssh -R 81:0.0.0.0:8000 webapps'' (tengo dudas de si el 0.0.0.0 es necesario). |
| 📌 Para que pueda funcionar directamente necesitarás cambiar la configuración por defecto de ''/etc/sshd_config'', concretamente el valor: | 📌 Para que pueda funcionar directamente necesitarás cambiar la configuración por defecto de ''/etc/sshd_config'', concretamente el valor: | ||
| Línea 200: | Línea 200: | ||
| the same as myserver. To make that transparent you should add an entry to the hosts file. If you don't | the same as myserver. To make that transparent you should add an entry to the hosts file. If you don't | ||
| do that vhosts will not work. If you want a SOCKS-proxy connection you could also use | do that vhosts will not work. If you want a SOCKS-proxy connection you could also use | ||
| + | |||
| $ ssh -D 5000 user@myserver | $ ssh -D 5000 user@myserver | ||
| This will create a SOCKS-proxy on localhost port 5000 which routes all requests through myserver. | This will create a SOCKS-proxy on localhost port 5000 which routes all requests through myserver. | ||
| Línea 228: | Línea 229: | ||
| </code> | </code> | ||
| + | |||
| + | ==== Tunnels, port mapping table ==== | ||
| + | |||
| + | ^ Command ^ Meaning ^ | ||
| + | | ssh -L 8000:127.0.0.1:8000 dev | You are mapping the port 8000 from the ''dev'' host to localhost, port 8000. Now you can connect to ''localhost:8000'' and ''dev:8000'' will respond. | | ||
| + | | ssh -L 8000:127.0.0.1:8000 -L 5432:127.0.0.1:5432 dev | You are mapping the port 8000 and 5432 from the ''dev'' host to localhost, both on the same portport 8000. As previous but two. | | ||
| + | | ssh -R 8000:127.0.0.1:8000 shappsrv | You are mapping the port 8000 from ''localhost'' to the ''shappsrv'' host. When a request arrives to ''shappsrv:8000'' it will be redirected to ''localhost:8000''. | | ||
| + | | ssh -D 1337 -q -C -N webapps | You are creating a SOCKS5 proxy in local host to ''webapps'', port 1337. It will make any connection done to this port to outside as it was from webapps. | | ||
| + | |||
| + | Parameters: | ||
| + | |||
| + | * ''-q'' Quiet mode. No errors or warnings will be shown. | ||
| + | * ''-C'' Compress communication. | ||
| + | * ''-N'' Do not execute a command. | ||