diff options
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r-- | lib/Kiki.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index f82d08a..58dfa20 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -355,7 +355,7 @@ installIpsecPeerCertificate fw p@Peer{kd} = IpsecPeerConfig <$> | |||
355 | flip (either warn') (pemFromPacket k :: Either String String) $ \pem -> do | 355 | flip (either warn') (pemFromPacket k :: Either String String) $ \pem -> do |
356 | case sshs of | 356 | case sshs of |
357 | (sshkey:_) -> do | 357 | (sshkey:_) -> do |
358 | theirHostname <- ResolvableHostname <$> sshKeyToHostname sshkey | 358 | let theirHostname = ResolvableHostname $ sshKeyToHostname sshkey |
359 | write fw (peerCertPath p) pem | 359 | write fw (peerCertPath p) pem |
360 | return $ strongswanPeerConfiguration p theirHostname | 360 | return $ strongswanPeerConfiguration p theirHostname |
361 | _ -> error "fuck." | 361 | _ -> error "fuck." |
@@ -584,14 +584,14 @@ writePublicKeyFiles rt fw grip myId = do | |||
584 | fileWriterCommit fw | 584 | fileWriterCommit fw |
585 | 585 | ||
586 | 586 | ||
587 | sshKeyToHostname :: Applicative m => Packet -> m Char8.ByteString | 587 | sshKeyToHostname :: Packet -> Char8.ByteString |
588 | sshKeyToHostname sshkey = do | 588 | sshKeyToHostname sshkey = do |
589 | case rsaKeyFromPacket sshkey of | 589 | case rsaKeyFromPacket sshkey of |
590 | Just (RSAKey (MPI n) (MPI e)) -> do | 590 | Just (RSAKey (MPI n) (MPI e)) -> do |
591 | let blob = SSH.sshrsa e n | 591 | let blob = SSH.sshrsa e n |
592 | sha1 = C.hashlazy blob :: C.Digest C.SHA1 | 592 | sha1 = C.hashlazy blob :: C.Digest C.SHA1 |
593 | pure $ Char8.fromStrict (convertToBase Base16 sha1) <> ".ssh.cryptonomic.net" | 593 | Char8.fromStrict (convertToBase Base16 sha1) <> ".ssh.cryptonomic.net" |
594 | Nothing -> pure "" | 594 | Nothing -> "" |
595 | 595 | ||
596 | peerConnectionName :: Peer -> Char8.ByteString | 596 | peerConnectionName :: Peer -> Char8.ByteString |
597 | peerConnectionName = coerce . peerAddress | 597 | peerConnectionName = coerce . peerAddress |
@@ -660,7 +660,7 @@ show_sshfp keyspec wkgrip db = do | |||
660 | let s = parseSpec wkgrip keyspec | 660 | let s = parseSpec wkgrip keyspec |
661 | case selectPublicKey s db of | 661 | case selectPublicKey s db of |
662 | Nothing -> hPutStrLn stderr $ keyspec ++ ": not found" | 662 | Nothing -> hPutStrLn stderr $ keyspec ++ ": not found" |
663 | Just k -> Char8.putStrLn =<< sshKeyToHostname k | 663 | Just k -> Char8.putStrLn $ sshKeyToHostname k |
664 | 664 | ||
665 | show_ssh :: String -> String -> KeyDB -> IO () | 665 | show_ssh :: String -> String -> KeyDB -> IO () |
666 | show_ssh keyspec wkgrip db = either warn putStrLn $ show_ssh' keyspec wkgrip db | 666 | show_ssh keyspec wkgrip db = either warn putStrLn $ show_ssh' keyspec wkgrip db |