]> thyrsus.com Git - ssh-installkeys.git/commitdiff
Deal with ssh spoofing messages.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 26 Mar 2012 11:59:00 +0000 (07:59 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 26 Mar 2012 11:59:05 +0000 (07:59 -0400)
ssh-installkeys

index 4ef8f27b2ce8f145c4dde51657007c871c801ea1..900b1da5927eecbcfbebd583c6c707ccef08193e 100755 (executable)
@@ -609,7 +609,12 @@ class ssh_session:
             elif seen == 5:
                 sys.stderr.write("FAILURE: check hostname\n")
                 raise RuntimeError
- 
+        # Remote execution will fail noisily if the host key hes changed.
+        # Pass this message through to the user so there will be a chance
+        # to recover.
+        if '@@@' in child.before:
+            sys.stdout.write(child.before)
+            raise SystemExit, 2
         return child.before
     def ssh(self, command):
         "Execute a command on the remote host, returning its output."