Problem pri pripojeni pres klice pres libssh php

Radek Krejča radek.krejca at starnet.cz
Tue Jun 12 16:20:28 CEST 2012


Ahoj, na prvni pohled je to OT jako blazen, ale zda se, ze problem je spise ve FBSD. Bohuzel jsem na google nenasel po pul dne hledani nic, co by mi melo pomoci me alespon nasmerovat. Mam problem s pripojenim se na ruzne servery pres dsa klice, konkretne z php. Zatim jediny rozdil, na ktery jsem prisel, je ve verzi bsd, tedy potazmo opensshd. Pritom z prikazoveho radku mi klic projde, ale z php na urcite servery ano, na urcite ne. Klic v authorized_keys je stejny.

V logu php se pak objevi toto:

[Tue Jun 12 12:15:37 2012] [error] [client ::1] PHP Warning:
ssh2_auth_pubkey_file(): Authentication failed for useruser using public
key: Username/PublicKey combination invalid in /usr/local/www/pokus.php
on line 119

Na remote masine se ve auth.log objevi pak

Jun 12 12:15:37 remote10 sshd[14012]: Did not receive identification
string from 92.62.224.xx

A jeste kus scriptu, ktery asi neni prilis zajimavy, ale opravdu nevim, co bych vlastne mel hledat, kdyz nekam to projde, nekam ne, konfigurace uzivatelu stejna a sshd je take v defaultu, pricemz klic mi z radky projde. 

#private $_METHODS		= Array('hostkey' => 'ssh-dss');
	private $_METHODS		= Array('kex' =>
'diffie-hellman-group1-sha1','hostkey' => 'ssh-dss','client_to_server'
=> Array('crypt' => '3des-cbc','mac' => 'hmac-md5','comp' =>
'none'),'server_to_client' => Array('crypt' => '3des-cbc','mac' =>
'hmac-md5','comp' => 'none'));

....
	private function Set_Connection()
	{
		$this->_connection = ssh2_Connect($this->_device_hostname,
$this->_device_port, $this->_METHODS);
		if(!$this->_connection)
		{
			$this->_connection = NULL;
			return false;
		}
		
		if(!ssh2_Auth_Pubkey_File($this->_connection, $this->_USER,
$this->_PUBLIC_KEY_PATH, $this->_PRIVATE_KEY_PATH))
		{
			$this->_connection = NULL;
			return false;
		}
		
		return true;
	}


Diky za pripadne nakopnuti, zatim si myslim, ze je to spise neco s verzi ssh nez s php, ale je to jen hadani.

Radek



More information about the Users-l mailing list