Tenho uma ótima resposta para meu anterior pergunta sobre a conexão da máquina A
à máquina C
via proxy Socks localizado na máquina B
.
Digamos que o IP da máquina B seja 218.62.97.105
e esteja escutando na porta 1080
O comando para isso:
ssh -o ProxyCommand='socat - socks:218.62.97.105:HOST_C:21,socksport=1080'
Gostaria de saber se é possível fazer uma cadeia a partir dos proxies de meias.
Considere o cenário: Máquina A ->
Máquina B (proxy de meias 1) ->
Máquina C (proxy de meias 2) ->
Máquina D (destino)
IP da máquina B: 218.62.97.105
PORT 1080
IP da máquina C: 11.11.11.11
PORT 3128
IP da máquina D: 55.55.55.55
PORT 8080
Espero que exista alguém experiente com socat ou qualquer outra ferramenta, pois parece bastante complicado para mim neste momento.
+100 para quem puder me dar a resposta de trabalho.
depuração do comando socat 1:
2012/10/02 20:45:00 socat[15641] D read -> 8
2012/10/02 20:45:00 socat[15641] D received socks4 reply data (offset 0): 00 5c 00 50 c1 6b 90 17
2012/10/02 20:45:00 socat[15641] D received all 8 bytes
2012/10/02 20:45:00 socat[15641] I received socks reply VN=0 CD=92 DSTPORT=80 DSTIP=193.107.144.23
2012/10/02 20:45:00 socat[15641] E socks: ident refused by client
2012/10/02 20:45:00 socat[15641] N exit(1)
2012/10/02 20:45:00 socat[15641] I shutdown(4, 2)
2012/10/02 20:45:00 socat[15641] D shutdown() -> 0
2012/10/02 20:45:00 socat[15641] I shutdown(3, 2)
2012/10/02 20:45:00 socat[15641] D shutdown() -> 0
2012/10/02 20:45:00 socat[15638] I childdied(signum=17)
2012/10/02 20:45:00 socat[15638] D waitpid(-1, 0xbfbea3fc, 1)
2012/10/02 20:45:00 socat[15638] D waitpid(, {256}, ) -> 15641
2012/10/02 20:45:00 socat[15638] I childdied(17): cannot identify child 15641
2012/10/02 20:45:00 socat[15638] D saving pid in diedunknown1
2012/10/02 20:45:00 socat[15638] W waitpid(): child 15641 exited with status 1
2012/10/02 20:45:00 socat[15638] D waitpid(-1, 0xbfbea3fc, 1)
2012/10/02 20:45:00 socat[15638] D waitpid(, {256}, ) -> -1
2012/10/02 20:45:00 socat[15638] I waitpid(-1, {}, WNOHANG): No child processes
2012/10/02 20:45:00 socat[15638] I childdied() finished
segundo comando socat:
2012/10/02 20:44:38 socat[15640] D socket(2, 1, 6)
2012/10/02 20:44:38 socat[15640] I socket(2, 1, 6) -> 3
2012/10/02 20:44:38 socat[15640] D fcntl(3, 2, 1)
2012/10/02 20:44:38 socat[15640] D fcntl() -> 0
2012/10/02 20:44:38 socat[15640] D connect(3, {2,AF=2 127.0.0.1:22222}, 16)
2012/10/02 20:44:38 socat[15640] D connect() -> 0
2012/10/02 20:44:38 socat[15640] D getsockname(3, 0xbf8111cc, 0xbf811058{112})
2012/10/02 20:44:38 socat[15640] D getsockname(, {AF=2 127.0.0.1:40843}, {16}) -> 0
2012/10/02 20:44:38 socat[15640] N successfully connected from local address AF=2 127.0.0.1:40843
2012/10/02 20:44:38 socat[15640] I sending socks4 request VN=4 DC=1 DSTPORT=21 DSTIP=xx.xxx.xxx.xxx USERID=mnmnc
2012/10/02 20:44:38 socat[15640] D malloc(42)
2012/10/02 20:44:38 socat[15640] D malloc() -> 0x8f1ec80
2012/10/02 20:44:38 socat[15640] D sending socks4(a) request data 04 01 00 15 3e f4 9f 9a 6d 6e 6d 6e 63 00
2012/10/02 20:44:38 socat[15640] D write(3, 0xbf811304, 14)
2012/10/02 20:44:38 socat[15640] D write -> 14
2012/10/02 20:44:38 socat[15640] I waiting for socks reply
2012/10/02 20:44:38 socat[15640] D read(3, 0xbf811234, 8)
2012/10/02 20:45:00 socat[15640] D read -> 0
2012/10/02 20:45:00 socat[15640] E read(): EOF during read of socks reply, peer might not be a socks4 server
2012/10/02 20:45:00 socat[15640] N exit(1)
2012/10/02 20:45:00 socat[15640] I shutdown(3, 2)
2012/10/02 20:45:00 socat[15640] D shutdown() -> 0
ssh_exchange_identification: Connection closed by remote host