
일반적인 홈 라우터 내부에 컴퓨터가 있다고 가정해 보겠습니다. 그러나 라우터에 대한 방화벽/포트 전달 액세스를 사용할 수 없다고 가정해 보겠습니다. 내부 IP는 192.168.1.81이 될 수 있습니다. 해당 LAN에는 192.168.1.81에서 일반적인 ARP 스푸핑 MITM 공격을 수행하려는 IP 192.168.1.85의 공격자 시스템이 있습니다(예: 방문한 웹 사이트를 스니핑하기 위해 urlsnarf와 같은 작업을 실행하려고 함). 192.168.1.81 시스템은 모든 형태의 MITM 공격을 방지하고 Chrome에서 인터넷을 탐색할 때 보안을 유지하려고 합니다. 그는 웹 검색을 암호화하여 공격자가 MITM 공격으로 이를 스니핑할 수 없도록 SSH 액세스가 가능한 서버를 보유하고 있습니다. 보안을 유지하기 위해 SSH 터널링을 사용하려는 사용자가 내 서버(공용 IP 162.xx.xxx.xx)에서 SSH 터널링을 사용하여 잠재적인 MITM 공격을 방지하려면 어떻게 해야 합니까? 이것은 과학 박람회 프로젝트를 위한 것입니다. 내 서버에서 어떤 설정을 해야 합니까(있는 경우)(전체 루트 액세스 권한이 있습니까)? 내 SSH 포트가 표준과 다르므로 SSH 포트 25512를 참조로 만드십시오. 서버용 방화벽에도 포트 4567을 열어두었으니 해당 포트도 참고용으로 이용해 주시기 바랍니다. 홈 네트워크의 공용 IP는 72.xxx.xx.xxx를 사용하세요. 필요한 명령을 포함해 주세요. 좀 더 명확하게 설명할 필요가 있으면 알려주세요. 도움을 주실 수 있는 분들께 진심으로 감사드립니다!
답변1
가장 쉬운 방법은 원격 서버에서 프록시(fe squid)를 실행하고 로컬 인터페이스에서만 수신하도록 하는 것입니다 127.0.0.1
(인터넷에 프록시를 열고 싶지 않기 때문입니다).
그런 다음 원격 서버에 SSH로 접속하고 원격 서버의 로컬 프록시 인터페이스로 전달되는 TCP를 만듭니다.
예를 들어 원격 서버의 프록시가 162.xx.xx.xx
tcp 를 수신하고 있다고 가정해 보겠습니다 127.0.0.1:3128
. 이제 다음 명령을 사용하여 ssh로 연결할 수 있습니다.
ssh -p 25512 -L 3128:127.0.0.1:3128 -C 162.xx.xx.xx
이렇게 하면 클라이언트에서 127.0.0.1:3128
원격 호스트로 의 터널이 열립니다 127.0.0.1:3128
. 그런 다음 클라이언트에서 브라우저를 설정하여 프록시를 사용하도록 설정하면 127.0.0.1:3128
SSH를 통해 원격 호스트로 터널링되어 그곳의 프록시로 전달됩니다.
매개 -C
변수를 사용하면 압축이 가능하며 전송되는 데이터가 적어지기 때문에 검색 속도가 좀 더 빨라질 것입니다.
다음은 관련 부분입니다 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.