Mysql pres SSH problem

Ing. Martin Hankovec martin.hankovec na ceskearchivy.cz
Pátek Září 21 10:29:33 CEST 2007


Zdravim,
mam takovy problem: rozchazim na novem serveru pripojeni k mysql databazi ze vzdaleneho klienta na server pres SSH tunel. Vygeneroval jsem rsa klice, z klienta se na server muzu nalogovat (pres ssh), ale nejde mi vytvorit SSH tunel (respektive se vytvori, ale nechodi).
Tunel jsem vytvoril z klienta pomoci (adresa serveru byla nahrazena xxx):

ssh -v -fNg -L 3307:127.0.0.1:3306 replikace na xxx.xxx.xxx.xxx

coz by mi melo presmerovat port 3307 na klientu na port 3306 na serveru. Prikaz vypise:

OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/identity type 0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.6.1p2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST 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 'xxx.xxx.xxx.xxx' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:12
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: publickey,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: Connections to local port 3307 forwarded to remote address 127.0.0.1:3306
socket: Address family not supported by protocol
debug1: Local forwarding listening on 0.0.0.0 port 3307.
debug1: fd 4 setting O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Entering interactive session.

Pokud zkusim na klientu:
# mysql -h 127.0.0.1 -P 3307 -u ... -p
debug1: Connection to port 3307 forwarding to 127.0.0.1 port 3306 requested.
debug1: fd 5 setting O_NONBLOCK
debug1: channel 1: new [direct-tcpip]

A ceka dlouho, dlouho az spadne na timeout. Podle vypsanych zprav bych rekl, ze autentizace je OK, ale bude asi nejaky problem na serveru s MySQL. Kdyz se zkusim pripojit bez SSH klasicky na port 3306, tak vse chodi. Kdyz zkusim vytvorit tunel na port sendmailu (25) a pripojit se k nemu telnetem, tak to take chodi.
Kdyz zkusim to same na jinem serveru, tak vse chodi vcetne mysql pres SSH. Uz jsem prohledl snad vsechno a nenapada me, co jeste zkusit.

Nemate prosim nekdo nejaky napad, co jeste vyzkouset? V logu mysql ani jinde jsem nic nenasel.

Diky moc
Preji pekny den
Martin H.



Další informace o konferenci Linux