hannsgmaulwurf
Goto Top

SSH Automatisierung ohne Sicherheitsabfrage mit KiTTY oder anderm Programm

Hallo,

ich möchte von ein paar DELL Switches mittels SSH die Konfigs automatisiert auf einen TFTP Server sichern.

Nach einigen Recherchen und Tests bin ich bei KiTTY gelandet, genauer bei der Portable Variante. Folgender Befehl klappt soweit auch ganz gut:

kitty_portable-0.70.0.8.exe 192.168.1.100 -ssh -l USER -pw PASSW0RD -cmd "enable \n \s05 copy running-config tftp://192.168.1.10/Configs/Switch100.config \ny \s20 \n logout"  

kitty_portable-0.70.0.8.exe 192.168.1.101 -ssh -l USER -pw PASSW0RD -cmd "enable \n \s05 copy running-config tftp://192.168.1.10/Configs/Switch101.config \ny \s20 \n logout"  

usw.

Jedoch kriege ich die Sicherheitsmeldung nicht weg:

2019-02-06_17h10_05

Man könnte zwar einmalig für alle Switches die Meldung mit Ja bestätigen, dass der Key auf dem ausführenden System gespeichert ist, aber mir wäre es lieber, die Meldung irgendwie ignorieren bzw. überspringen zu können. Dafür habe ich bei KiTTY leider keinen Schalter gefunden.

Im Netz schreiben einige, dass sie sich ein extra Skript gebaut haben, welches ein Aufploppen dieser Meldung prüft und dann auf Ja klickt. Ich fände es besser, das in den Befehl mit einbauen zu können. Es muss auch nicht KiTTY sein, falls jemand andere Programme kennt, bei denen das ginge?

Besten Dank.

Content-ID: 400626

Url: https://administrator.de/contentid/400626

Ausgedruckt am: 28.09.2024 um 13:09 Uhr

NetzwerkDude
NetzwerkDude 06.02.2019 aktualisiert um 17:25:25 Uhr
Goto Top
Aus der Putty FAQ:
A.2.9 Is there an option to turn off the annoying host key prompts?

No, there isn't. And there won't be. Even if you write it yourself and send us the patch, we won't accept it.

Those annoying host key prompts are the whole point of SSH. Without them, all the cryptographic technology SSH uses to secure your session is doing nothing more than making an attacker's job slightly harder; instead of sitting between you and the server with a packet sniffer, the attacker must actually subvert a router and start modifying the packets going back and forth. But that's not all that much harder than just sniffing; and without host key checking, it will go completely undetected by client or server.

Host key checking is your guarantee that the encryption you put on your data at the client end is the same encryption taken off the data at the server end; it's your guarantee that it hasn't been removed and replaced somewhere on the way. Host key checking makes the attacker's job astronomically hard, compared to packet sniffing, and even compared to subverting a router. Instead of applying a little intelligence and keeping an eye on Bugtraq, the attacker must now perform a brute-force attack against at least one military-strength cipher. That insignificant host key prompt really does make that much difference.

If you're having a specific problem with host key checking - perhaps you want an automated batch job to make use of PSCP or Plink, and the interactive host key prompt is hanging the batch process - then the right way to fix it is to add the correct host key to the Registry in advance, or if the Registry is not available, to use the -hostkey command-line option. That way, you retain the important feature of host key checking: the right key will be accepted and the wrong ones will not. Adding an option to turn host key checking off completely is the wrong solution and we will not do it.

If you have host keys available in the common known_hosts format, we have a script called kh2reg.py to convert them to a Windows .REG file, which can be installed ahead of time by double-clicking or using REGEDIT.

https://www.chiark.greenend.org.uk/~sgtatham/putty/faq.html#faq-hostkeys

Daher: Wenn dir sicherheit egal ist, aktiviert telnet auf den Switchen und mach es damit face-smile
hannsgmaulwurf
hannsgmaulwurf 06.02.2019 um 17:32:55 Uhr
Goto Top
Zitat von @NetzwerkDude:
Daher: Wenn dir sicherheit egal ist, aktiviert telnet auf den Switchen und mach es damit face-smile
Guter Hinweis, an Telnet hatte ich gar nicht gedacht. Danke!!
em-pie
em-pie 06.02.2019 um 17:53:14 Uhr
Goto Top
Moin,

Würde da nicht mit Telnet arbeiten, da unverschlüsselt....

Schaue lieber einmal, ob du die fingerprints nicht im Vorfeld sichern kannst:
https://www.techrepublic.com/article/how-to-easily-add-an-ssh-fingerprin ...

Gruß
em-pie
138721
138721 07.02.2019 aktualisiert um 09:42:07 Uhr
Goto Top
Würde da nicht mit Telnet arbeiten, da unverschlüsselt....
Full Ackn.

Jepp besser gleich den Key zur Liste der akzeptierten Keys hinzufügen, alternativ (unsicherer da potentielle MitM Attacken möglich werden) die SSH-Option beim Aufruf setzen mit
ssh -o StrictHostKeyChecking=no
NetzwerkDude
NetzwerkDude 07.02.2019 um 10:30:55 Uhr
Goto Top
Naja, ein paar paranoide gedanken zu:
unverschlüsselt VS "ich verschlüssle zu irgendwem"
Wirklich ein großer unterschied?

Batchsammlung von Fingerprints via ssh-keyscan ist interessant, aber in einer "sicheren" Laborumgebung.
In freier Wildbahn: wer sagt das ich nicht bereits den fingerprint von einem man in the middle mitaufnehme?

Ich finde man sollte cryptosysteme nicht gegen ihren willen verwenden - wenn, dann ganz lassen

xm9t2ql6mkwz
hannsgmaulwurf
hannsgmaulwurf 25.02.2019 um 07:30:24 Uhr
Goto Top
Zitat von @138721:
Jepp besser gleich den Key zur Liste der akzeptierten Keys hinzufügen, alternativ (unsicherer da potentielle MitM Attacken möglich werden) die SSH-Option beim Aufruf setzen mit
Hallo 138721, den Key hinzufügen könnte ich ja auch, aber wenn in der Netzwerkumgebung neue Geräte dazu kommen, müsste man ja immer den Key hinzufügen. Ich möchte aber, dass das Skript einfach nur läuft, ohne dass man da in einem halben Jahr dran denken muss, für ein neues Gerät noch den Key zu erlauben.
ssh -o StrictHostKeyChecking=no
Das klingt doch gut, nur gibts das auch für Putty oder was anderes unter Windows?