3.5 KiB
Vendored
id, sidebar_class_name, keywords
| id | sidebar_class_name | keywords | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SSH | SSH |
|
<img src={require('../../static/img/APIs/SSH.png').default} width='64px' />
SSH
This section is dedicated to the library for working with SSH. On this page, all the steps necessary to start working are described
<img src={require('../../static/img/addin.png').default} class="tipimage" />
Please review the ["About external components"](/docs/Start/Component-requirements) section before getting started
<img src={require('../../static/img/lock.png').default} class="tipimage" />
Learn more: "Using OpenSSL in External Components"
Getting Started
This library provides various methods for working with SSH on the client side. Each method accepts a Connection as its first parameter, which can be initialized in one of two ways:
- Using the
OpenConnectionfunction. In this case, a component object is returned that supports a single connection for multiple requests. - Using the
GetConnectionConfigurationfunction. In this case, only a connection description structure is returned. Each function receiving this structure as theConnectionparameter will internally create a new connection and close it upon completion
When performing multiple sequential requests to an SSH server, it is recommended to use a full connection obtained via the OpenConnection function
After establishing a connection, sh commands can be executed using the ExecuteCommand function.
:::important
Commands are run in execute mode. This means that execution context, such as changing the current working directory or setting environment variables, is not preserved between calls. To execute multiple sequential commands, they must be included in a single call to the ExecuteCommand function.
:::
Proxy Usage
The client supports establishing connections through a proxy server. Proxy settings can be obtained using the GetProxySettings function. The resulting structure must then be passed to either OpenConnection or GetConnectionConfiguration when initiating work
...
ProxyType = "http"; // http, socks5, socks4
ProxyAddress = FunctionParameters["Proxy_IP"];
ProxyPort = FunctionParameters["Proxy_Port"];
ProxyLogin = FunctionParameters["Proxy_User"];
ProxyPassword = FunctionParameters["Proxy_Password"];
ProxySettings = OPI_SSH.GetProxySettings(ProxyAddress, ProxyPort, ProxyType, ProxyLogin, ProxyPassword);
Connection = OPI_SSH.CreateConnection(SSHSettings, ProxySettings);
Support is provided for socks4, socks5, and http proxy servers
:::warning Operation via http-proxy is experimental and may be unstable depending on the proxy server’s implementation, configuration, and capabilities. It is recommended to use socks-proxy whenever possible for stable traffic transmission :::