Я пытаюсь установить локальную переадресацию портов, но я столкнулся с двумя трудностями:

При использовании ssh -vL 1083:127.0.0.1:22 akveton2@cms904usr -N

Команда, я получаю эту ошибку:

bind: невозможно назначить запрошенный адрес

Я немного погуглил и с тех пор обнаружил, что если эта строка включена в выходные данные отладки, она пытается подключиться с использованием IPv6:

debug1: прослушивание локальной переадресации на порт 1:: 1083.

С тех пор я добавил в команду аргумент -4, так что ошибка привязки больше не печатается, но теперь соединение зависает после ввода пароля. В чем может быть проблема? Вот журнал:

[akveton@lxplus070 ~]$ ssh -vL 1083:127.0.0.1:1083 akveton2@cms904usr -N
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to cms904usr [137.138.251.206] port 22.
debug1: Connection established.
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'cms904usr' is known and matches the RSA host key.
debug1: Found key in /afs/cern.ch/user/a/akveton/.ssh/known_hosts:13
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Server not found in Kerberos database

debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
akveton2@cms904usr's password: 
debug1: Authentication succeeded (password).
debug1: Local connections to LOCALHOST:1083 forwarded to remote address 127.0.0.1:1083
debug1: Local forwarding listening on 127.0.0.1 port 1083.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on ::1 port 1083.
bind: Cannot assign requested address
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
^Cdebug1: channel 0: free: port listener, nchannels 1
Killed by signal 2.
[akveton@lxplus070 ~]$ ssh -v4L 1083:127.0.0.1:22 akveton2@cms904usr -N^C
[akveton@lxplus070 ~]$ ssh -v4L 1083:127.0.0.1:1083 akveton2@cms904usr -N
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to cms904usr [137.138.251.206] port 22.
debug1: Connection established.
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'cms904usr' is known and matches the RSA host key.
debug1: Found key in /afs/cern.ch/user/a/akveton/.ssh/known_hosts:13
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Server not found in Kerberos database

debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
akveton2@cms904usr's password: 
debug1: Authentication succeeded (password).
debug1: Local connections to LOCALHOST:1083 forwarded to remote address 127.0.0.1:1083
debug1: Local forwarding listening on 127.0.0.1 port 1083.
debug1: channel 0: new [port listener]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

Еще несколько симптомов:

Если я открою два терминала, один, где я выполняю туннель, а другой с curl:

Я curl --socks5 localhost:1083 http://cms904usr во второй терминал и получаю:

curl: (7) Не удалось получить подтверждение соединения с SOCKS5.

В то же время, первый терминал распечатывает

канал 1: сбой открытия: сбой подключения: соединение отклонено

Если я curl --proxy localhost:1083 http://cms904usr во второй терминал, я получу

curl: (52) Пустой ответ с сервера

и ничего в первом терминале.

Если я пытаюсь подключиться с помощью Firefox, я получаю

Прокси-сервер отказывается от подключений

0