檢視原始碼 ssh_agent (ssh v5.2.5)

使用 SSH agent 而非預設 ssh_file 回呼的模組。

此模組定義了與 SSH Agent 通訊的回呼處理程序,可以用來取代預設回呼。這允許向儲存 SSH 私鑰的 agent 發出簽署請求以執行身份驗證。

Ssh_agent 實作了 ssh_client_key_api,使其能透過在啟動客戶端時設定選項 key_cb 來使用 (例如使用 ssh:connect, ssh:shell)。

      {key_cb, {ssh_agent, []}}

agent 通訊是透過 UNIX 網域套接字建立的。預設情況下,套接字路徑將從 SSH_AUTH_SOCK 環境變數中取得,這是 OpenSSH 的 agent 實作中的預設套接字路徑。

為了設定不同的套接字路徑,可以設定 socket_path 選項。

      {key_cb, {ssh_agent, [{socket_path, SocketPath}]}}

注意

這些函式是 SSH 應用程式的回呼。它們不應該從使用者的程式碼中呼叫!

摘要

類型:選項

add_host_keyis_host_key 回呼委派到的模組。預設為 ssh_file 模組。

設定與 agent 通訊的套接字路徑

設定透過套接字與 agent 通訊時的逾時時間,以毫秒為單位。預設值為 1000

類型:選項

連結到此類型

call_ssh_file_option()

檢視原始碼 (自 OTP 23.0 起)
-type call_ssh_file_option() :: {call_ssh_file, atom()}.

add_host_keyis_host_key 回呼委派到的模組。預設為 ssh_file 模組。

連結到此類型

socket_path_option()

檢視原始碼 (自 OTP 23.0 起)
-type socket_path_option() :: {socket_path, string()}.

設定與 agent 通訊的套接字路徑

連結到此類型

timeout_option()

檢視原始碼 (自 OTP 23.0 起)
-type timeout_option() :: {timeout, integer()}.

設定透過套接字與 agent 通訊時的逾時時間,以毫秒為單位。預設值為 1000

函式

連結到此函式

add_host_key(Host, PublicKey, Options)

檢視原始碼 (自 OTP 23.0 起)
-spec add_host_key(string(), public_key:public_key(), Options) -> ok | {error, Error :: term()}
                      when Options :: ssh_client_key_api:client_key_cb_options(call_ssh_file_option()).

等同於 add_host_key/4

連結到此函式

add_host_key(Host, Port, PublicKey, Options)

檢視原始碼 (自 OTP 23.0 起)
-spec add_host_key(Host, inet:port_number(), public_key:public_key(), Options) -> Result
                      when
                          Host ::
                              inet:ip_address() |
                              inet:hostname() |
                              [inet:ip_address() | inet:hostname()],
                          Options :: ssh_client_key_api:client_key_cb_options(call_ssh_file_option()),
                          Result :: ok | {error, Error :: term()}.

此回呼會委派給 ssh_file 模組。

連結到此函式

is_host_key(Key, Host, Algorithm, Options)

檢視原始碼 (自 OTP 23.0 起)
-spec is_host_key(Key :: public_key:public_key(),
                  Host :: string(),
                  Algorithm :: ssh:pubkey_alg(),
                  Options) ->
                     boolean()
                     when Options :: ssh_client_key_api:client_key_cb_options(call_ssh_file_option()).

等同於 is_host_key/5

連結到此函式

is_host_key(Key, PeerName, Port, Algorithm, Opts)

檢視原始碼 (自 OTP 23.0 起)

此回呼會委派給 ssh_file 模組。

連結到此函式

user_key(Algorithm, Options)

檢視原始碼 (自 OTP 23.0 起)
-spec user_key(Algorithm :: ssh:pubkey_alg(), Options) -> Result
                  when
                      Result ::
                          {ok, public_key:private_key()} |
                          {ok, {ssh2_pubkey, PubKeyBlob :: binary()}} |
                          {error, string()},
                      Options ::
                          ssh_client_key_api:client_key_cb_options(socket_path_option() |
                                                                   timeout_option()).

類型和描述

請參閱 ssh_client_key_api, Module:user_key/2 中的 API 描述。