summaryrefslogtreecommitdiff
path: root/lib/Kiki.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r--lib/Kiki.hs10
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
587sshKeyToHostname :: Applicative m => Packet -> m Char8.ByteString 587sshKeyToHostname :: Packet -> Char8.ByteString
588sshKeyToHostname sshkey = do 588sshKeyToHostname 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
596peerConnectionName :: Peer -> Char8.ByteString 596peerConnectionName :: Peer -> Char8.ByteString
597peerConnectionName = coerce . peerAddress 597peerConnectionName = 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
665show_ssh :: String -> String -> KeyDB -> IO () 665show_ssh :: String -> String -> KeyDB -> IO ()
666show_ssh keyspec wkgrip db = either warn putStrLn $ show_ssh' keyspec wkgrip db 666show_ssh keyspec wkgrip db = either warn putStrLn $ show_ssh' keyspec wkgrip db