[linux-leman] Tunnel ssh

Marc SCHAEFER schaefer at alphanet.ch
Wed Apr 16 11:02:04 CEST 2003


On Tue, Apr 15, 2003 at 09:06:41PM +0200, Jean-Bruno Luginbühl wrote:
> ssh -L 4001:ipdistant:5432 nomuser at ipdistant

Faisons-le aussi:

   schaefer at defian:~% ssh -L 4001:192.168.1.1:5432 schaefer at 192.168.1.1

ensuite testons en utilisant un outil simple:

   schaefer at defian:~% telnet localhost 4001
   Trying 127.0.0.1...
   Connected to localhost.
   Escape character is '^]'.
   abcd
   EFATAL 1:  invalid length of startup packet
   Connection closed by foreign host.

ça ressemble à quelque chose.

Alors testons avec l'outil plus complexe considéré:

   schaefer at defian:~% psql -h localhost -p 4001 template1
   psql: FATAL 1:  No pg_hba.conf entry for host 192.168.1.1, user
   schaefer, database template1

apparemment je dois configurer la sécurité, mais autrement ça a l'air
de jouer:

   schaefer at defian:~% psql -h localhost -p 4001 template1
   Password: 
   Welcome to psql, the PostgreSQL interactive terminal.
   
   Type:  \copyright for distribution terms
          \h for help with SQL commands
          \? for help on internal slash commands
          \g or terminate with semicolon to execute query
          \q to quit
   
   template1=> SELECT datname FROM pg_database;
     datname  
   -----------
    newsdb
    template1
    template0
    admindb
   (4 rows)

> channel 2: open failed: connect failed: Connection timed out

Si l'ordinateur distant fait une redirection à un autre ordinateur,
décomposer le test:

   1. vérifier que ssh utilisateur at ip-distante 'telnet serveur-postgresql 5432'
      fonctionne

   2. vérifier que telnet localhost 4001, puis taper n'importe quoi et
      RETURN fait quelque chose

   3. utiliser l'outil plus complexe.




More information about the gull mailing list