webapp: Avoid crashing when ssh-keygen -F chokes on an invalid known_hosts file.
This commit is contained in:
parent
6d7c8338f9
commit
7f78bc92b6
2 changed files with 7 additions and 1 deletions
|
@ -223,6 +223,10 @@ knownHost :: Text -> IO Bool
|
|||
knownHost hostname = do
|
||||
sshdir <- sshDir
|
||||
ifM (doesFileExist $ sshdir </> "known_hosts")
|
||||
( not . null <$> readProcess "ssh-keygen" ["-F", T.unpack hostname]
|
||||
( not . null <$> checkhost
|
||||
, return False
|
||||
)
|
||||
where
|
||||
{- ssh-keygen -F can crash on some old known_hosts file -}
|
||||
checkhost = catchDefaultIO "" $
|
||||
readProcess "ssh-keygen" ["-F", T.unpack hostname]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue