-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A pure-Haskell SSH server library. -- -- This a library for implementing your own servers that handle SSH -- requests and authorization, etc. Similar to Python's Twisted Conch -- library. It's used eg by darcsden to provide basic SSH access. @package ssh @version 0.3.2 module SSH.Packet type Packet a = Writer ByteString a byte :: Word8 -> Packet () long :: Word32 -> Packet () integer :: Integer -> Packet () byteString :: ByteString -> Packet () string :: String -> Packet () raw :: ByteString -> Packet () rawString :: String -> Packet () packetLength :: Packet () -> Int doPacket :: Packet a -> ByteString netString :: String -> ByteString netLBS :: ByteString -> ByteString io :: MonadIO m => IO a -> m a unmpint :: ByteString -> Integer mpint :: Integer -> ByteString makeKey :: Integer -> ByteString -> Char -> ByteString module SSH.NetReader type NetReader = State ByteString readByte :: NetReader Word8 readLong :: NetReader Int32 readULong :: NetReader Word32 readInteger :: NetReader Integer readBytes :: Int -> NetReader ByteString readLBS :: NetReader ByteString readString :: NetReader String readBool :: NetReader Bool module SSH.Crypto data Cipher Cipher :: CipherType -> CipherMode -> Int -> Int -> Cipher [cType] :: Cipher -> CipherType [cMode] :: Cipher -> CipherMode [cBlockSize] :: Cipher -> Int [cKeySize] :: Cipher -> Int data CipherType AES :: CipherType data CipherMode CBC :: CipherMode data HMAC HMAC :: Int -> (ByteString -> ByteString) -> HMAC [hDigestSize] :: HMAC -> Int [hFunction] :: HMAC -> ByteString -> ByteString data PublicKey RSAPublicKey :: Integer -> Integer -> PublicKey [rpubE] :: PublicKey -> Integer [rpubN] :: PublicKey -> Integer DSAPublicKey :: Integer -> Integer -> Integer -> Integer -> PublicKey [dpubP] :: PublicKey -> Integer [dpubQ] :: PublicKey -> Integer [dpubG] :: PublicKey -> Integer [dpubY] :: PublicKey -> Integer data KeyPair RSAKeyPair :: PublicKey -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> KeyPair [rprivPub] :: KeyPair -> PublicKey [rprivD] :: KeyPair -> Integer [rprivPrime1] :: KeyPair -> Integer [rprivPrime2] :: KeyPair -> Integer [rprivExponent1] :: KeyPair -> Integer [rprivExponent2] :: KeyPair -> Integer [rprivCoefficient] :: KeyPair -> Integer DSAKeyPair :: PublicKey -> Integer -> KeyPair [dprivPub] :: KeyPair -> PublicKey [dprivX] :: KeyPair -> Integer rsaKeyPairFromFile :: FilePath -> IO KeyPair keyPairFromFile :: FilePath -> IO KeyPair removeKeyPairHeaderFooter :: [String] -> (String, [String]) addKeyPairHeaderFooter :: String -> [String] -> [String] -- | Parse an key pair from OpenSSH private key file format. parseKeyPair :: String -> KeyPair -- | Turn an key pair into OpenSSH private key file format. printKeyPair :: KeyPair -> String generator :: Integer safePrime :: Integer toBlocks :: (Integral a) => a -> ByteString -> [ByteString] fromBlocks :: [ByteString] -> ByteString rsaKeyLen :: PublicKey -> Int blob :: PublicKey -> ByteString blobToKey :: ByteString -> PublicKey sign :: KeyPair -> ByteString -> IO ByteString -- | The length of the actual signature for a given key The actual -- signature data is always found at the end of a complete signature, so -- can be extracted by just grabbing this many bytes at the end. actualSignatureLength :: PublicKey -> Int verify :: PublicKey -> ByteString -> ByteString -> IO Bool instance GHC.Show.Show SSH.Crypto.KeyPair instance GHC.Classes.Eq SSH.Crypto.KeyPair instance GHC.Show.Show SSH.Crypto.PublicKey instance GHC.Classes.Eq SSH.Crypto.PublicKey module SSH.Sender data SenderState NoKeys :: Handle -> Word32 -> SenderState [senderThem] :: SenderState -> Handle [senderOutSeq] :: SenderState -> Word32 GotKeys :: Handle -> Word32 -> Bool -> Cipher -> ByteString -> ByteString -> HMAC -> SenderState [senderThem] :: SenderState -> Handle [senderOutSeq] :: SenderState -> Word32 [senderEncrypting] :: SenderState -> Bool [senderCipher] :: SenderState -> Cipher [senderKey] :: SenderState -> ByteString [senderVector] :: SenderState -> ByteString [senderHMAC] :: SenderState -> HMAC data SenderMessage Prepare :: Cipher -> ByteString -> ByteString -> HMAC -> SenderMessage StartEncrypting :: SenderMessage Send :: ByteString -> SenderMessage Stop :: SenderMessage class Sender a where sendPacket = send . Send . doPacket send :: Sender a => SenderMessage -> a () sendPacket :: Sender a => Packet () -> a () sender :: Chan SenderMessage -> SenderState -> IO () encrypt :: Cipher -> ByteString -> ByteString -> ByteString -> (ByteString, ByteString) module SSH.Channel type Channel = StateT ChannelState IO data ChannelState ChannelState :: ChannelConfig -> Word32 -> Word32 -> (SenderMessage -> IO ()) -> Word32 -> Word32 -> Word32 -> Word32 -> String -> Maybe Process -> Maybe ThreadId -> ChannelState [csConfig] :: ChannelState -> ChannelConfig [csID] :: ChannelState -> Word32 [csTheirID] :: ChannelState -> Word32 [csSend] :: ChannelState -> SenderMessage -> IO () [csDataReceived] :: ChannelState -> Word32 [csMaxPacket] :: ChannelState -> Word32 [csWindowSize] :: ChannelState -> Word32 [csTheirWindowSize] :: ChannelState -> Word32 [csUser] :: ChannelState -> String [csProcess] :: ChannelState -> Maybe Process [csRedirector] :: ChannelState -> Maybe ThreadId data ChannelMessage Request :: Bool -> ChannelRequest -> ChannelMessage Data :: ByteString -> ChannelMessage EOF :: ChannelMessage Interrupt :: ChannelMessage data ChannelConfig ChannelConfig :: (Bool -> ChannelRequest -> Channel ()) -> ChannelConfig [ccRequestHandler] :: ChannelConfig -> Bool -> ChannelRequest -> Channel () data ChannelRequest Shell :: ChannelRequest Execute :: String -> ChannelRequest Subsystem :: String -> ChannelRequest X11Forwarding :: ChannelRequest Environment :: String -> String -> ChannelRequest PseudoTerminal :: String -> Word32 -> Word32 -> Word32 -> Word32 -> String -> ChannelRequest WindowChange :: Word32 -> Word32 -> Word32 -> Word32 -> ChannelRequest Signal :: String -> ChannelRequest ExitStatus :: Word32 -> ChannelRequest ExitSignal :: String -> Bool -> String -> String -> ChannelRequest FlowControl :: Bool -> ChannelRequest Unknown :: String -> ChannelRequest data Process Process :: ProcessHandle -> Handle -> Handle -> Handle -> Process [pHandle] :: Process -> ProcessHandle [pIn] :: Process -> Handle [pOut] :: Process -> Handle [pError] :: Process -> Handle defaultChannelConfig :: ChannelConfig newChannel :: ChannelConfig -> (SenderMessage -> IO ()) -> Word32 -> Word32 -> Word32 -> Word32 -> String -> IO (Chan ChannelMessage) chanLoop :: Chan ChannelMessage -> Channel () channelError :: String -> Channel () channelMessage :: String -> Channel () channelFail :: Channel () channelSuccess :: Channel () channelDone :: Channel () sendChunks :: Integral a => a -> Packet () -> String -> Channel () redirectHandle :: Chan () -> Packet () -> Handle -> Channel () spawnProcess :: IO (Handle, Handle, Handle, ProcessHandle) -> Channel () instance GHC.Show.Show SSH.Channel.ChannelMessage instance GHC.Show.Show SSH.Channel.ChannelRequest instance SSH.Sender.Sender SSH.Channel.Channel module SSH.Session type Session = StateT SessionState IO data SessionState Initial :: SessionConfig -> ChannelConfig -> Handle -> (SenderMessage -> IO ()) -> ByteString -> String -> ByteString -> Word32 -> SessionState [ssConfig] :: SessionState -> SessionConfig [ssChannelConfig] :: SessionState -> ChannelConfig [ssThem] :: SessionState -> Handle [ssSend] :: SessionState -> SenderMessage -> IO () [ssPayload] :: SessionState -> ByteString [ssTheirVersion] :: SessionState -> String [ssOurKEXInit] :: SessionState -> ByteString [ssInSeq] :: SessionState -> Word32 GotKEXInit :: SessionConfig -> ChannelConfig -> Handle -> (SenderMessage -> IO ()) -> ByteString -> String -> ByteString -> Word32 -> ByteString -> Cipher -> Cipher -> (ByteString -> HMAC) -> (ByteString -> HMAC) -> SessionState [ssConfig] :: SessionState -> SessionConfig [ssChannelConfig] :: SessionState -> ChannelConfig [ssThem] :: SessionState -> Handle [ssSend] :: SessionState -> SenderMessage -> IO () [ssPayload] :: SessionState -> ByteString [ssTheirVersion] :: SessionState -> String [ssOurKEXInit] :: SessionState -> ByteString [ssInSeq] :: SessionState -> Word32 [ssTheirKEXInit] :: SessionState -> ByteString [ssOutCipher] :: SessionState -> Cipher [ssInCipher] :: SessionState -> Cipher [ssOutHMACPrep] :: SessionState -> ByteString -> HMAC [ssInHMACPrep] :: SessionState -> ByteString -> HMAC Final :: SessionConfig -> ChannelConfig -> Map Word32 (Chan ChannelMessage) -> ByteString -> Handle -> (SenderMessage -> IO ()) -> ByteString -> Bool -> Word32 -> Cipher -> HMAC -> ByteString -> ByteString -> Maybe String -> SessionState [ssConfig] :: SessionState -> SessionConfig [ssChannelConfig] :: SessionState -> ChannelConfig [ssChannels] :: SessionState -> Map Word32 (Chan ChannelMessage) [ssID] :: SessionState -> ByteString [ssThem] :: SessionState -> Handle [ssSend] :: SessionState -> SenderMessage -> IO () [ssPayload] :: SessionState -> ByteString [ssGotNEWKEYS] :: SessionState -> Bool [ssInSeq] :: SessionState -> Word32 [ssInCipher] :: SessionState -> Cipher [ssInHMAC] :: SessionState -> HMAC [ssInKey] :: SessionState -> ByteString [ssInVector] :: SessionState -> ByteString [ssUser] :: SessionState -> Maybe String data SessionConfig SessionConfig :: [String] -> (Authorize -> Session Bool) -> KeyPair -> SessionConfig [scAuthMethods] :: SessionConfig -> [String] [scAuthorize] :: SessionConfig -> Authorize -> Session Bool [scKeyPair] :: SessionConfig -> KeyPair data Authorize Password :: String -> String -> Authorize PublicKey :: String -> PublicKey -> Authorize defaultSessionConfig :: SessionConfig net :: NetReader a -> Session a newChannelID :: Session Word32 getChannel :: Word32 -> Session (Chan ChannelMessage) decrypt :: ByteString -> Session ByteString getPacket :: Session () instance SSH.Sender.Sender SSH.Session.Session module SSH version :: String supportedKeyExchanges :: [String] supportedKeyAlgorithms :: [String] supportedCiphers :: [(String, Cipher)] supportedMACs :: [(String, ByteString -> HMAC)] supportedCompression :: String supportedLanguages :: String data Config Config :: SessionConfig -> ChannelConfig -> PortNumber -> IO () -> Config [cSession] :: Config -> SessionConfig [cChannel] :: Config -> ChannelConfig [cPort] :: Config -> PortNumber [cReadyAction] :: Config -> IO () startedMessage :: PortNumber -> IO () start :: SessionConfig -> ChannelConfig -> PortNumber -> IO () startConfig :: Config -> IO () waitLoop :: SessionConfig -> ChannelConfig -> Socket -> IO () readLoop :: Session () kexInit :: Session () kexDHInit :: Session () newKeys :: Session () serviceRequest :: Session () userAuthRequest :: Session () channelOpen :: Session () channelRequest :: Session () dataReceived :: Session () eofReceived :: Session ()