
Digamos que tengo una computadora dentro de un enrutador doméstico típico (pero digamos que el acceso al firewall/reenvío de puertos al enrutador no está disponible). Su IP interna puede ser 192.168.1.81. Hay una máquina atacante en esa LAN con la IP 192.168.1.85 que quiere realizar un típico ataque MITM de suplantación de ARP en 192.168.1.81 (digamos que quiere ejecutar algo como urlsnarf para detectar sitios web visitados). La máquina 192.168.1.81 quiere evitar cualquier forma de ataque MITM y mantenerse seguro al navegar por Internet en Chrome. Tiene un servidor con acceso SSH que quiere utilizar para cifrar su navegación web para que el atacante no pueda detectarlo con un ataque MITM. ¿Cómo puedo yo (el usuario que desea utilizar el túnel SSH para mantenerse seguro) utilizar el túnel SSH en mi servidor (en la IP pública 162.xx.xxx.xx) para evitar el posible ataque MITM? Esto es para un proyecto de feria de ciencias. ¿Qué configuración (si la hay) tendría que realizar en mi servidor (tengo acceso completo a la raíz)? Mi puerto SSH es diferente a la norma, así que tome el puerto SSH 25512 como referencia. También abrí el puerto 4567 en el firewall del servidor, así que use ese puerto también como referencia. Utilice 72.xxx.xx.xxx como IP pública para la red doméstica. Incluya los comandos necesarios. Déjame saber si necesito ser más claro. ¡Muchas gracias a cualquiera que pueda ayudar!
Respuesta1
La forma más sencilla es ejecutar un proxy (fe squid) en su servidor remoto y hacer que escuche solo en la interfaz local 127.0.0.1
(porque no desea abrir un proxy a Internet).
Luego ingresa por ssh al servidor remoto y crea un reenvío tcp a la interfaz de proxy local en el servidor remoto.
Por ejemplo, digamos que su proxy en el servidor remoto 162.xx.xx.xx
está escuchando en tcp 127.0.0.1:3128
. Ahora puedes conectarte con ssh con este comando:
ssh -p 25512 -L 3128:127.0.0.1:3128 -C 162.xx.xx.xx
Esto abre un túnel desde el cliente 127.0.0.1:3128
hasta los hosts remotos 127.0.0.1:3128
. Luego, simplemente puede configurar su navegador en el cliente para usar el proxy 127.0.0.1:3128
que luego se canaliza a través de ssh al host remoto y se pasa al proxy allí.
El -C
parámetro habilita la compresión y, con suerte, debería hacer que su navegación sea un poco más rápida porque se deben transmitir menos datos.
Estas son las partes relevantes de man 1 ssh
:
-L [bind_address:]port:host:hostport
Specifies that the given port on the local (client) host is to be forwarded to
the given host and port on the remote side. This works by allocating a socket
to listen to port on the local side, optionally bound to the specified
bind_address. Whenever a connection is made to this port, the connection is
forwarded over the secure channel, and a connection is made to host port
hostport from the remote machine. Port forwardings can also be specified in
the configuration file. IPv6 addresses can be specified by enclosing the
address in square brackets. Only the superuser can forward privileged ports.
By default, the local port is bound in accordance with the GatewayPorts
setting. However, an explicit bind_address may be used to bind the connection
to a specific address. The bind_address of “localhost” indicates that the
listening port be bound for local use only, while an empty address or ‘*’
indicates that the port should be available from all interfaces.
-C Requests compression of all data (including stdin, stdout, stderr, and data for
forwarded X11 and TCP connections). The compression algorithm is the same used
by gzip(1), and the “level” can be controlled by the CompressionLevel option
for protocol version 1. Compression is desirable on modem lines and other slow
connections, but will only slow down things on fast networks. The default
value can be set on a host-by-host basis in the configuration files; see the
Compression option.
-p port
Port to connect to on the remote host. This can be specified on a per-host
basis in the configuration file.