Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data KnownHosts
- data KnownHostResult
- data KnownHostType
- data KnownHost = KnownHost {
- khMagic :: CUInt
- khNode :: Ptr ()
- khName :: String
- khKey :: String
- khTypeMask :: [KnownHostType]
- initialize :: Bool -> IO ()
- exit :: IO ()
- initSession :: IO Session
- freeSession :: Session -> IO ()
- disconnectSession :: Session -> String -> IO ()
- keepaliveConfig :: Session -> Bool -> Int -> IO ()
- handshake :: Session -> Socket -> IO ()
- setBlocking :: Session -> Bool -> IO ()
- initKnownHosts :: Session -> IO KnownHosts
- freeKnownHosts :: KnownHosts -> IO ()
- knownHostsReadFile :: KnownHosts -> FilePath -> IO Int
- getHostKey :: Session -> IO (ByteString, HostKeyType)
- checkKnownHost :: KnownHosts -> String -> Int -> ByteString -> [KnownHostType] -> IO KnownHostResult
- publicKeyAuthFile :: Session -> String -> String -> String -> String -> IO ()
- usernamePasswordAuth :: Session -> String -> String -> IO ()
- openChannelSession :: Session -> IO Channel
- closeChannel :: Channel -> IO ()
- freeChannel :: Channel -> IO ()
- channelSendEOF :: Channel -> IO ()
- channelWaitEOF :: Channel -> IO ()
- channelIsEOF :: Channel -> IO Bool
- readChannel :: Channel -> Size -> IO ByteString
- readChannelStderr :: Channel -> Size -> IO ByteString
- writeChannel :: Channel -> ByteString -> IO ()
- writeChannelFromHandle :: Channel -> Handle -> IO Integer
- readChannelToHandle :: Channel -> Handle -> Offset -> IO Integer
- channelProcess :: Channel -> String -> String -> IO ()
- channelExecute :: Channel -> String -> IO ()
- channelShell :: Channel -> IO ()
- requestPTY :: Channel -> String -> IO ()
- requestPTYEx :: Channel -> String -> String -> Int -> Int -> Int -> Int -> IO Int
- directTcpIpEx :: Session -> String -> Int -> String -> Int -> IO Channel
- channelExitStatus :: Channel -> IO Int
- channelExitSignal :: Channel -> IO (Int, String, Maybe String, Maybe String)
- scpSendChannel :: Session -> String -> Int -> Int64 -> POSIXTime -> POSIXTime -> IO Channel
- scpReceiveChannel :: Session -> FilePath -> IO (Channel, Offset)
- pollChannelRead :: Channel -> IO Bool
- sftpInit :: Session -> IO Sftp
- sftpShutdown :: Sftp -> IO ()
- sftpOpenDir :: Sftp -> String -> IO SftpHandle
- sftpReadDir :: SftpHandle -> IO (Maybe (ByteString, SftpAttributes))
- sftpCloseHandle :: SftpHandle -> IO ()
- sftpOpenFile :: Sftp -> String -> Int -> [SftpFileTransferFlags] -> IO SftpHandle
- sftpRenameFile :: Sftp -> FilePath -> FilePath -> IO ()
- sftpRenameFileEx :: Sftp -> FilePath -> FilePath -> [RenameFlag] -> IO ()
- sftpWriteFileFromHandler :: SftpHandle -> Handle -> IO Integer
- sftpWriteFileFromBytes :: SftpHandle -> ByteString -> IO Integer
- sftpReadFileToHandler :: SftpHandle -> Handle -> Int -> IO Int
- sftpFstat :: SftpHandle -> IO SftpAttributes
- sftpDeleteFile :: Sftp -> FilePath -> IO ()
- data RenameFlag
- data SftpFileTransferFlags
- data SftpAttributes = SftpAttributes {}
- data Agent
- data AgentPublicKey
- agentInit :: Session -> IO Agent
- agentConnect :: Agent -> IO ()
- agentDisconnect :: Agent -> IO ()
- agentListIdentities :: Agent -> IO ()
- agentGetIdentity :: Agent -> Maybe AgentPublicKey -> IO (Maybe AgentPublicKey)
- agentGetIdentities :: Agent -> IO [AgentPublicKey]
- agentFree :: Agent -> IO ()
- agentPublicKeyComment :: AgentPublicKey -> IO ByteString
- agentPublicKeyBlob :: AgentPublicKey -> IO ByteString
- agentUserAuth :: Agent -> String -> AgentPublicKey -> IO ()
- agentAuthenticate :: String -> Agent -> IO ()
- data TraceFlag
- setTraceMode :: Session -> [TraceFlag] -> IO ()
Types
data KnownHosts Source #
Instances
Data KnownHosts Source # | |
Defined in Network.SSH.Client.LibSSH2.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> KnownHosts -> c KnownHosts # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c KnownHosts # toConstr :: KnownHosts -> Constr # dataTypeOf :: KnownHosts -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c KnownHosts) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c KnownHosts) # gmapT :: (forall b. Data b => b -> b) -> KnownHosts -> KnownHosts # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> KnownHosts -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> KnownHosts -> r # gmapQ :: (forall d. Data d => d -> u) -> KnownHosts -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> KnownHosts -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> KnownHosts -> m KnownHosts # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> KnownHosts -> m KnownHosts # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> KnownHosts -> m KnownHosts # | |
Show KnownHosts Source # | |
Defined in Network.SSH.Client.LibSSH2.Types showsPrec :: Int -> KnownHosts -> ShowS # show :: KnownHosts -> String # showList :: [KnownHosts] -> ShowS # | |
Eq KnownHosts Source # | |
Defined in Network.SSH.Client.LibSSH2.Types (==) :: KnownHosts -> KnownHosts -> Bool # (/=) :: KnownHosts -> KnownHosts -> Bool # | |
ToPointer KnownHosts Source # | |
Defined in Network.SSH.Client.LibSSH2.Types toPointer :: KnownHosts -> Ptr () Source # |
data KnownHostResult Source #
Instances
data KnownHostType Source #
TYPE_MASK | |
TYPE_PLAIN | |
TYPE_SHA1 | |
TYPE_CUSTOM | |
KEYENC_MASK | |
KEYENC_RAW | |
KEYENC_BASE64 | |
KEY_MASK | |
KEY_SHIFT | |
KEY_RSA1 | |
KEY_SSHRSA | |
KEY_SSHDSS | |
KEY_ECDSA_256 | |
KEY_ECDSA_384 | |
KEY_ECDSA_521 | |
KEY_ED25519 | |
KEY_UNKNOWN |
Instances
Show KnownHostType Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign showsPrec :: Int -> KnownHostType -> ShowS # show :: KnownHostType -> String # showList :: [KnownHostType] -> ShowS # | |
Eq KnownHostType Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign (==) :: KnownHostType -> KnownHostType -> Bool # (/=) :: KnownHostType -> KnownHostType -> Bool # |
KnownHost | |
|
Session functions
initialize :: Bool -> IO () Source #
Initialize libssh2. Pass True to enable encryption or False to disable it.
initSession :: IO Session Source #
Create Session object
freeSession :: Session -> IO () Source #
Free Session object's memory
Disconnect session (but do not free memory)
Known hosts functions
initKnownHosts :: Session -> IO KnownHosts Source #
Create KnownHosts object for given session.
freeKnownHosts :: KnownHosts -> IO () Source #
Free KnownHosts object's memory
:: KnownHosts | |
-> FilePath | Path to known_hosts file |
-> IO Int |
Read known hosts from file
getHostKey :: Session -> IO (ByteString, HostKeyType) Source #
Get remote host public key and its type
:: KnownHosts | |
-> String | Host name |
-> Int | Port number (usually 22) |
-> ByteString | Host public key |
-> [KnownHostType] | Host flags (see libssh2 documentation) |
-> IO KnownHostResult |
Check host data against known hosts.
Authentication
:: Session | Session |
-> String | Username |
-> String | Path to public key |
-> String | Path to private key |
-> String | Passphrase |
-> IO () |
Perform public key authentication.
Perform username/password authentication.
Channel functions
closeChannel :: Channel -> IO () Source #
Close channel (but do not free memory)
freeChannel :: Channel -> IO () Source #
Free channel object's memory
channelSendEOF :: Channel -> IO () Source #
channelWaitEOF :: Channel -> IO () Source #
:: Channel | |
-> Size | Amount of data to read |
-> IO ByteString |
Read data from channel.
:: Channel | |
-> Size | Amount of data to read |
-> IO ByteString |
Read data from channel.
writeChannel :: Channel -> ByteString -> IO () Source #
Write data to channel.
writeChannelFromHandle :: Channel -> Handle -> IO Integer Source #
Write all data to channel from handle. Returns amount of transferred data.
readChannelToHandle :: Channel -> Handle -> Offset -> IO Integer Source #
Read all data from channel to handle. Returns amount of transferred data.
channelShell :: Channel -> IO () Source #
Execute shell command
channelExitSignal :: Channel -> IO (Int, String, Maybe String, Maybe String) Source #
Get channel exit signal. Returns: (possibly error code, exit signal name, possibly error message, possibly language code).
scpSendChannel :: Session -> String -> Int -> Int64 -> POSIXTime -> POSIXTime -> IO Channel Source #
Create SCP file send channel.
scpReceiveChannel :: Session -> FilePath -> IO (Channel, Offset) Source #
Create SCP file receive channel. TODO: receive struct stat also.
SFTP functions
sftpShutdown :: Sftp -> IO () Source #
sftpOpenDir :: Sftp -> String -> IO SftpHandle Source #
Open directory file handler
sftpReadDir :: SftpHandle -> IO (Maybe (ByteString, SftpAttributes)) Source #
Read directory from file handler
sftpCloseHandle :: SftpHandle -> IO () Source #
Close file handle
sftpOpenFile :: Sftp -> String -> Int -> [SftpFileTransferFlags] -> IO SftpHandle Source #
Open regular file handler
Rename a file on the sftp server
:: Sftp | Opened sftp session |
-> FilePath | Old file name |
-> FilePath | New file name |
-> [RenameFlag] | Rename flags |
-> IO () |
Rename a file on the sftp server
sftpWriteFileFromHandler :: SftpHandle -> Handle -> IO Integer Source #
Upload file to the sftp server
sftpWriteFileFromBytes :: SftpHandle -> ByteString -> IO Integer Source #
Upload bytes to the sftp server Returns size of sent data.
sftpReadFileToHandler :: SftpHandle -> Handle -> Int -> IO Int Source #
Download file from the sftp server
sftpFstat :: SftpHandle -> IO SftpAttributes Source #
Get sftp attributes from the sftp handler
Delete file from SFTP server
data RenameFlag Source #
Instances
Show RenameFlag Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign showsPrec :: Int -> RenameFlag -> ShowS # show :: RenameFlag -> String # showList :: [RenameFlag] -> ShowS # | |
Eq RenameFlag Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign (==) :: RenameFlag -> RenameFlag -> Bool # (/=) :: RenameFlag -> RenameFlag -> Bool # |
data SftpFileTransferFlags Source #
Sftp support
Instances
Show SftpFileTransferFlags Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign showsPrec :: Int -> SftpFileTransferFlags -> ShowS # show :: SftpFileTransferFlags -> String # showList :: [SftpFileTransferFlags] -> ShowS # | |
Eq SftpFileTransferFlags Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign (==) :: SftpFileTransferFlags -> SftpFileTransferFlags -> Bool # (/=) :: SftpFileTransferFlags -> SftpFileTransferFlags -> Bool # |
data SftpAttributes Source #
Instances
Show SftpAttributes Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign showsPrec :: Int -> SftpAttributes -> ShowS # show :: SftpAttributes -> String # showList :: [SftpAttributes] -> ShowS # | |
Eq SftpAttributes Source # | |
Defined in Network.SSH.Client.LibSSH2.Foreign (==) :: SftpAttributes -> SftpAttributes -> Bool # (/=) :: SftpAttributes -> SftpAttributes -> Bool # |
SSH Agent functions
data AgentPublicKey Source #
Instances
agentConnect :: Agent -> IO () Source #
Attempt to establish a connection to an ssh agent process.
| The environment variable SSH_AUTH_SOCK
is used to determine where to connect on unix.
agentDisconnect :: Agent -> IO () Source #
Cleans up a connection to an ssh agent.
agentListIdentities :: Agent -> IO () Source #
Get or update the list of known identities. Must be called at least once.
:: Agent | Agent handle. |
-> Maybe AgentPublicKey | Previous key returned. |
-> IO (Maybe AgentPublicKey) |
Copies one identity from the agent to the local process.
agentGetIdentities :: Agent -> IO [AgentPublicKey] Source #
Copies all the keys from the agent to the local process.
agentPublicKeyComment :: AgentPublicKey -> IO ByteString Source #
Return the comment from the given agent public key.
agentPublicKeyBlob :: AgentPublicKey -> IO ByteString Source #
Return the bytes of the given agent public key.
:: Agent | Agent handle. |
-> String | Username to authenticate with. |
-> AgentPublicKey | Public key to use from the agent. |
-> IO () |
Perform agent based public key authentication. You almost certainly want @agentAuthenticate instead of this, since this only does one round of authentication with the agent.
Authenticate with an ssh agent. Takes a user and an agent and tries each key from the agent in succession. Throws AUTHENTICATION_FAILED if it's unable to authenticate. If you call this, you need to call @agentListIdentities at least once.