Hallo zusammen,
mich hat die Tage ein Problem beschäftigt, dessen Lösung ich hier kurz
ansprechen will (fürs Archiv):
ssh-Portforwarding auf "localhost" auf dem entfernten System schlägt
fehl für squid, funktioniert aber für sendmail. squid ist für localhost
freigeschaltet, dennoch kommt ein "Connection refused".
Warum geht
$ ssh -C -L 10025:localhost:25 -f -N -l remote.host.net
aber nicht
$ ssh -C -L 13128:localhost:3128 -f -N -l remote.host.net
squid läuft definitiv auf 3128 und nimmt connections von localhost an.
Lösung des Problems:
die Reihenfolge, in der "localhost" in /etc/hosts steht ist
entscheidend:
::1 localhost
127.0.0.1 localhost
localhost wird von sshd in diesem Fall mit ::1 aufgelöst, statt mit
127.0.0.1. Sendmail lauscht standardmäßig auf ::1, weswegen das mit :25
wohl geht. Squid lauscht (jedenfalls bei mir) nur auf IPv4, also
127.0.0.1.
$ ssh -C -L 13128:127.0.0.1:3128 -f -N -l remote.host.net
funktioniert definitiv.
$ ping localhost
PING localhost.local.net (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.054 ms
$ host localhost
localhost.local.net has address 127.0.0.1
$ ssh 127.0.0.1 'echo $SSH_CONNECTION'
Password:
127.0.0.1 64081 127.0.0.1 22
$ ssh localhost 'echo $SSH_CONNECTION'
Password:
::1 64205 ::1 22
Nach dem Vertauschen der Einträge in /etc/hosts:
$ ssh localhost 'echo $SSH_CONNECTION'
Password:
127.0.0.1 50043 127.0.0.1 22
/etc/host.conf läßt zuerst in /etc/hosts, dann per bind auflösen.
Nunja. Nächstes mal weiss ichs dann, localhost != localhost. Die
Fehlersuche war mehr verzweifeltes Stochern in den Optionen von sshd.
Wenn man erstmal drauf gekommen ist, ist es ganz einfach.
Gruß
--
Raphael Becker http://rabe.uugrn.org/
http://schnitzelmitkartoffelsalat.uugrn.org/
.........|.........|.........|.........|.........|.........|.........|..
- application/pgp-signature Anhang: stored
Received on Wed Feb 2 00:39:14 2005