檢視原始碼 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 應用程式的回呼。它們不應該從使用者的程式碼中呼叫!
摘要
類型:選項
函式
-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
。
-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 模組。
-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
。
-spec is_host_key(public_key:public_key(), Host, inet:port_number(), ssh:pubkey_alg(), Options) -> boolean() 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()).
此回呼會委派給 ssh_file 模組。
-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 描述。