Bonjour,

j'essai d'ouvrir une connexion SSH à travers un proxytunnel, mais ceci en Perl, avec la library Net::SSH:erl.

En ligne de commande, j'ouvre mon proxytunnel, et j'arrive bien a attaqué mon poste distant via SSH.
Mais ca ne marche pas en Perl!!! Est-ce un problème de la library, ou est-ce moi qui ne sait pas faire (je pense plus pour le second choix )... ??

Voici mon code :

le proxytunnel :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
./proxytunnel -a 8888 -p ad_proxy:8080 -u user -s pass -d machinedistante:443
Code Perl :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
use strict;
use warnings;
use Net::SFTP;
use Net::SSH::Perl;
 
my $host = "127.0.0.1";
my $port = "8888";
my $user = "root";
my $password = "pass";
 
my $ssh = Net::SSH::Perl->new ($host, port => $port, debug => 1);
$ssh->login ($user, $password);
my ($stdout, $stderr, $exit) = $ssh->cmd ("ls");
 
print $stdout;
Et voici le resultat de mon debug :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
gandalf: Reading configuration data /root/.ssh/config
gandalf: Reading configuration data /etc/ssh_config
gandalf: Allocated local port 1023.
gandalf: Connecting to 127.0.0.1, port 8888.
gandalf: Remote version string: SSH-2.0-OpenSSH_4.3
 
gandalf: Remote protocol version 2.0, remote software version OpenSSH_4.3
gandalf: Net::SSH::Perl Version 1.30, protocol version 2.0.
gandalf: No compat match: OpenSSH_4.3.
gandalf: Connection established.
gandalf: Sent key-exchange init (KEXINIT), wait response.
gandalf: Algorithms, c->s: 3des-cbc hmac-sha1 none
gandalf: Algorithms, s->c: 3des-cbc hmac-sha1 none
gandalf: Entering Diffie-Hellman Group 1 key exchange.
gandalf: Sent DH public key, waiting for reply.
gandalf: Received host key, type 'ssh-dss'.
gandalf: Host '127.0.0.1' is known and matches the host key.
gandalf: Computing shared secret key.
gandalf: Verifying server signature.
gandalf: Waiting for NEWKEYS message.
gandalf: Enabling incoming encryption/MAC/compression.
gandalf: Send NEWKEYS, enable outgoing encryption/MAC/compression.
gandalf: Sending request for user-authentication service.
Broken pipe
Ca ne va pas plus loin. ou sinon je tombe sur un message d'erreur du genre permission denied sur la commande...

Merci pour votre aide.