ssh como servidor proxy não funciona

1
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.0 (stretch)
Release:    9.0
Codename:   stretch

Eu quero usar o ssh como um servidor socks através de um servidor ssh público gratuito através da porta 443.

Eu vou a um site que oferece esse serviço e recebo as seguintes informações: Informações da conta:

Host: server_ip (eu substitui o ip do servidor real por 'server_ip')

Porta Dropbear: 443, 80

Porta OpenSSH: 22

Porta Proxy: 8080

Porta OpenVPN:

Porta PPTP: 1723

Nome de usuário: user (substitui o nome de usuário real por 'user')

Senha: passar

mkdir .ssh/
chmod 700 .ssh 
ssh-keygen -t rsa -b 4096
cat .ssh/id_rsa.pub > .ssh/authorized_keys
chmod 600 .ssh/* 
check ~/ to 755 
check .ssh/ to 700

meu ssh_config:

Host *
#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
   IdentityFile ~/.ssh/id_rsa
   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
   Port 22
   Protocol 2
#   Cipher 3des
   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
   MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes

então,

    bozo@debian:~$ ssh-copy-id user@server_ip
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/bozo/.ssh/id_rsa.pub"
The authenticity of host 'server_ip (server_ip)' can't be established.
ECDSA key fingerprint is SHA256:mjMgh9dkJ94fpSX1Gii4rUR2iCyEM5RQ7ky5mE8Fj58.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
user@server_ip's password: 
Could not chdir to home directory /home/user: No such file or directory

----- > Embora a chave do pub não tenha sido instalada, eu tento usar meias:

nota: dropbear é compatível com ssh v2; ele deve então funcionar com o openssh-client (fonte: link - > "O Dropbear implementa o protocolo completo da versão 2 do SSH no cliente e no servidor." )

ssh -D 1080 -vvv -p 443 user@server_ip

aqui está a saída:

 OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "server_ip" port 443
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to server_ip [server_ip] port 443.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 9901 ms remain after connect
debug1: identity file /home/bozo/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory   ---------> cannot find the pub key I was trying to install before (?)
debug1: identity file /home/bozo/.ssh/id_rsa-cert type -1   
debug1: key_load_public: No such file or directory
debug1: identity file /home/bozo/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bozo/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u1
debug1: Remote protocol version 2.0, remote software version dropbear_2012.55
debug1: no match: dropbear_2012.55
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to server_ip:443 as 'user'
debug3: put_host_port: [server_ip]:443
debug3: hostkeys_foreach: reading file "/home/bozo/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
debug2: MACs ctos: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
debug2: MACs stoc: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,ssh-dss
debug2: ciphers ctos: aes128-ctr,3des-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes256-cbc,twofish256-cbc,twofish-cbc,twofish128-cbc
debug2: ciphers stoc: aes128-ctr,3des-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes256-cbc,twofish256-cbc,twofish-cbc,twofish128-cbc
debug2: MACs ctos: hmac-sha1-96,hmac-sha1,hmac-md5
debug2: MACs stoc: hmac-sha1-96,hmac-sha1,hmac-md5
debug2: compression ctos: zlib,[email protected],none
debug2: compression stoc: zlib,[email protected],none
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: diffie-hellman-group14-sha1
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-md5 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-md5 compression: none
debug1: sending SSH2_MSG_KEXDH_INIT
debug2: bits set: 1019/2048
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:aobu88T8GbpefuXobhVhnLZZwndtP8O08DDOAbIx37w
debug3: put_host_port: [server_ip]:443
debug3: put_host_port: [server_ip]:443
debug3: hostkeys_foreach: reading file "/home/bozo/.ssh/known_hosts"
debug3: hostkeys_foreach: reading file "/home/bozo/.ssh/known_hosts"
debug1: checking without port identifier
debug3: hostkeys_foreach: reading file "/home/bozo/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/bozo/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from server_ip
The authenticity of host '[server_ip]:443 ([server_ip]:443)' can't be established.
RSA key fingerprint is SHA256:aobu88T8GbpefuXobhVhnLZZwndtP8O08DDOAbIx37w.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[server_ip]:443' (RSA) to the list of known hosts.
debug2: bits set: 1008/2048
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /home/bozo/.ssh/id_rsa (0x8150ecb0)
debug2: key: /home/bozo/.ssh/id_dsa ((nil))
debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/bozo/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/bozo/.ssh/id_dsa
debug3: no such identity: /home/bozo/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
user@server_ip's password: 
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).   ---------> password auth works 
Authenticated to server_ip ([server_ip]:443).
debug1: Local connections to LOCALHOST:1080 forwarded to remote address socks:0  
debug3: channel_setup_fwd_listener_tcpip: type 2 wildcard 0 addr NULL
debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY   ---------> ??
debug1: Local forwarding listening on ::1 port 1080.
debug2: fd 4 setting O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 1080.
debug2: fd 5 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 1: new [port listener]
debug1: channel 2: new [client-session]
debug3: ssh_session2_open: channel_new: 2
debug2: channel 2: send open
debug3: send packet: type 90
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 91
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 2
debug2: channel 2: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env LS_COLORS
debug3: Ignored env XDG_MENU_PREFIX
debug1: Sending env LANG = en_US.utf8
debug2: channel 2: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env DISPLAY
debug3: Ignored env COLORTERM
debug3: Ignored env XDG_VTNR
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env GLADE_CATALOG_PATH
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env XDG_GREETER_DATA_DIR
debug3: Ignored env USER
debug3: Ignored env GLADE_MODULE_PATH
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env PWD
debug3: Ignored env HOME
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env QT_ACCESSIBILITY
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env GLADE_PIXMAP_PATH
debug3: Ignored env GTK_MODULES
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env VTE_VERSION
debug3: Ignored env XDG_SEAT_PATH
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env QT_LINUX_ACCESSIBILITY_ALWAYS_ON
debug3: Ignored env SHLVL
debug3: Ignored env XDG_SEAT
debug3: Ignored env WINDOWID
debug3: Ignored env GDMSESSION
debug3: Ignored env LOGNAME
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env XAUTHORITY
debug3: Ignored env XDG_SESSION_PATH
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env PATH
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug2: channel 2: request shell confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 2: open confirm rwindow 65536 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 2
debug2: PTY allocation request accepted on channel 2
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 2
debug2: shell request accepted on channel 2

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

debug3: receive packet: type 96
debug2: channel 2: rcvd eof
debug2: channel 2: output open -> drain
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 2 rtype exit-status reply 0
debug3: receive packet: type 97
debug2: channel 2: rcvd close
debug2: channel 2: close_read
debug2: channel 2: input open -> closed
debug3: channel 2: will not send data after close
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debug3: channel 2: will not send data after close
debug2: channel 2: obuf empty
debug2: channel 2: close_write
debug2: channel 2: output drain -> closed
debug2: channel 2: almost dead
debug2: channel 2: gc: notify user
debug2: channel 2: gc: user detached
debug2: channel 2: send close
debug3: send packet: type 97
debug2: channel 2: is dead
debug2: channel 2: garbage collecting
debug1: channel 2: free: client-session, nchannels 3
debug3: channel 2: status: The following connections are open:
  #2 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

debug3: send packet: type 1
debug1: channel 0: free: port listener, nchannels 2
debug3: channel 0: status: The following connections are open:

debug1: channel 1: free: port listener, nchannels 1
debug3: channel 1: status: The following connections are open:

Connection to server_ip closed.
Transferred: sent 2640, received 2240 bytes, in 0.3 seconds
Bytes per second: sent 8760.2, received 7432.9
debug1: Exit status 1

Eu tento a mesma coisa com a porta 8080 (porta proxy, veja as informações da conta acima) e tenho a seguinte saída:

ssh -D 1080 -vvv -p 443 [email protected]
 OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "server_ip" port 8080
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to server_ip[server_ip] port 8080.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address server_ip port 8080: Connection refused
ssh: connect to host server_ip port 8080: Connection refused

Alguma idéia sobre como se conectar a este servidor ssh remoto? Muitos thanx gente!

    
por achille 31.07.2017 / 17:41

1 resposta

1

-N foi a bandeira necessária. Meu túnel de meias funciona bem agora.

    
por 01.08.2017 / 11:25

Tags