Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ssh und Host-Authentifizierung [solved]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Wolle
Apprentice
Apprentice


Joined: 07 May 2003
Posts: 256
Location: Hamburg (Germany)

PostPosted: Wed Feb 28, 2007 3:38 pm    Post subject: ssh und Host-Authentifizierung [solved] Reply with quote

Ich boote häufig auf irgendeiner Kiste mal ein Linux von CD, auf das ich mich dann im LAN über ssh einloggen will. Das sieht dann ungefähr so aus:
Code:
wolle:~ $ ssh root@192.168.1.108
The authenticity of host '192.168.1.108 (192.168.1.108)' can't be established.
RSA key fingerprint is f5:a5:f5:ea:64:32:9d:68:ec:af:2c:74:95:59:73:59.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.108' (RSA) to the list of known hosts.
Password:

Das nervige ist das "Permanently added ... to the list of known hosts", was einfach bedeutet, dass das nächste mal ein Rechner mit der selben IP-Adresse einen anderen Host-Key hat, und ssh die Mitarbeit verweigert.

Kann ich bei ssh einen IP-Bereich aus der Prüfung ausnehmen, oder gibt es eine andere Lösung? Was ich auf keinen Fall will, ist das Host-Checking generell ausschalten. Bei manchen Rechnern möchte ich auf diese Sicherheit zugunsten der Bequemlichkeit nicht verzichten.

Eigentlich würde mir ja telnet, rsh oder sowas reichen, aber das bietet eine moderne CD (Gentoo, Knoppix, ...) ja nicht mehr an - oder bin ich zu doof zum finden?
_________________
USE="gentoo" emerge linux


Last edited by Wolle on Sat Mar 03, 2007 8:25 am; edited 1 time in total
Back to top
View user's profile Send private message
tuam
l33t
l33t


Joined: 04 May 2004
Posts: 765
Location: CGN, Germany

PostPosted: Wed Feb 28, 2007 9:28 pm    Post subject: Reply with quote

Ist die Option "StrictHostKeyChecking" für Dich eine Lösung? Siehe man ssh_config, das kann im Einzelfall auch direkt an ssh übergeben werden.

FF,

Daniel
_________________
Logic clearly dictates that the needs of the many outweigh the needs of the few. - Spock
The needs of the one outweigh the needs of the many. - Kirk
I refuse to let arithmetic decide questions like that. - Picard
Back to top
View user's profile Send private message
Wolle
Apprentice
Apprentice


Joined: 07 May 2003
Posts: 256
Location: Hamburg (Germany)

PostPosted: Thu Mar 01, 2007 8:27 am    Post subject: Reply with quote

tuam wrote:
Ist die Option "StrictHostKeyChecking" für Dich eine Lösung? Siehe man ssh_config, das kann im Einzelfall auch direkt an ssh übergeben werden.

Leider nicht. Die Manpage von ssh_config sagt dazu:
Code:
StrictHostKeyChecking
             ...
             If this flag is set to ``no'', ssh will automatically add new host keys
             to the user known hosts files.
             ...
             The host keys of known hosts will be verified automatically in all cases.

Und so verhält sich ssh auch. Der erste Key wird ohne Rückfrage in die known_hosts geschrieben, beim nächsten Mal wird gecheckt und failed. Das war in früheren Versionen wohl mal anders, hilft mir so aber gerade nicht weiter.
_________________
USE="gentoo" emerge linux
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Thu Mar 01, 2007 8:09 pm    Post subject: Re: ssh und Host-Authentifizierung Reply with quote

Es ist wenig sinnvoll, einen IP-Bereich von der Hostprüfung auszuschließen, denn wenn ein Angreifer seine IP fälschen kann (nur dann ist ja die Hostprüfung sinnvoll), dann bräuchte er sich nur eine Nummer aus dem von der Prüfung ausgeschlossenen Bereich geben, um den Test vollständig zu unterlaufen.
Wolle wrote:
dass das nächste mal ein Rechner mit der selben IP-Adresse einen anderen Host-Key hat, und ssh die Mitarbeit verweigert.

Dann benutze den Namen statt der IP-Adresse zum Einloggen. Gib etwa in der ~/.ssh/config an:
Code:
Host knoppix
HostName 192.168.1.108
HostKeyAlias knoppix
Und dann
Code:
ssh root@knoppix
Auf diese Art wird die Hostkey unter "knoppix" statt unter "192.168.1.108" abgespeichert. Die IP-Adresse musst Du natürlich jeweils anpassen, aber ob Du das in der Kommandozeile machst oder in ~/.ssh/config (ggf. über ein Script) läuft ja fast auf das Gleiche heraus.
Back to top
View user's profile Send private message
tuam
l33t
l33t


Joined: 04 May 2004
Posts: 765
Location: CGN, Germany

PostPosted: Thu Mar 01, 2007 9:04 pm    Post subject: Reply with quote

Oder Du greppst nach dem Verwenden von ssh die Adresse raus
Code:
grep -v 192.168.1.108 ~/.ssh/known_hosts > ~/.ssh/known_hosts_neu
mv ~/.ssh/known_hosts_neu ~/.ssh/known_hosts

FF,

Daniel
_________________
Logic clearly dictates that the needs of the many outweigh the needs of the few. - Spock
The needs of the one outweigh the needs of the many. - Kirk
I refuse to let arithmetic decide questions like that. - Picard
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Thu Mar 01, 2007 9:46 pm    Post subject: Reply with quote

alternativ via sed
Code:
sed -iBAK '/192.168.1.108/d' ~/.ssh/known_hosts

für den Fall der Fälle gibt es danach ein Backup unter ~/.ssh/known_hosts.BAK
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
Wolle
Apprentice
Apprentice


Joined: 07 May 2003
Posts: 256
Location: Hamburg (Germany)

PostPosted: Sat Mar 03, 2007 8:25 am    Post subject: Reply with quote

Ich greppe jetzt die betroffenen Adressen aus der known_hosts per Script raus. Funktioniert prächtig :D

Danke für die Antworten.
_________________
USE="gentoo" emerge linux
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum