1ssh_agent(3) Erlang Module Definition ssh_agent(3)
2
3
4
6 ssh_agent - Callback module for using an SSH agent instead of the de‐
7 fault ssh_file callback.
8
10 This module defines a callback handler for the communication with an
11 SSH Agent and can be used to replace the default callback. This allows
12 to issue signing requests to an agent that stores SSH private keys to
13 perform authentication.
14
15 Ssh_agent implements the ssh_client_key_api, to allow it to be used by
16 setting the option key_cb when starting a client (with for example
17 ssh:connect, ssh:shell ).
18
19 {key_cb, {ssh_agent, []}}
20
21
22 The agent communication is established through a UNIX domain socket. By
23 default, the socket path will be fetched from the SSH_AUTH_SOCK enviro‐
24 ment variable, which is the default socket path in the agent implemen‐
25 tation of OpenSSH.
26
27 In order to set a different socket path the socket_path option can be
28 set.
29
30 {key_cb, {ssh_agent, [{socket_path, SocketPath}]}}
31
32
33 Note:
34 The functions are Callbacks for the SSH app. They are not intended to
35 be called from the user's code!
36
37
39 Options for the ssh_agent callback module
40 socket_path_option() = {socket_path, string()}
41
42 Sets the socket path for the communication with the agent.
43
44 timeout_option() = {timeout, integer()}
45
46 Sets the time-out in milliseconds when communicating with the
47 agent via the socket. The default value is 1000.
48
49 call_ssh_file_option() = {call_ssh_file, atom()}
50
51 The module which the add_host_key and is_host_key callbacks are
52 delegated to. Defaults to the ssh_file module.
53
55 add_host_key(Host :: string(),
56 PublicKey :: public_key:public_key(),
57 Options) ->
58 ok | {error, Error :: term()}
59
60 add_host_key(Host,
61 Port :: inet:port_number(),
62 PublicKey :: public_key:public_key(),
63 Options) ->
64 Result
65
66 Types:
67
68 Host =
69 inet:ip_address() |
70 inet:hostname() |
71 [inet:ip_address() | inet:hostname()]
72 Options =
73 ssh_client_key_api:client_key_cb_op‐
74 tions(call_ssh_file_option())
75 Result = ok | {error, Error :: term()}
76
77 This callback is delegated to the ssh_file module.
78
79 is_host_key(Key :: public_key:public_key(),
80 Host :: string(),
81 Algorithm :: ssh:pubkey_alg(),
82 Options) ->
83 boolean()
84
85 is_host_key(Key :: public_key:public_key(),
86 Host,
87 Port :: inet:port_number(),
88 Algorithm :: ssh:pubkey_alg(),
89 Options) ->
90 boolean()
91
92 Types:
93
94 Host =
95 inet:ip_address() |
96 inet:hostname() |
97 [inet:ip_address() | inet:hostname()]
98 Options =
99 ssh_client_key_api:client_key_cb_op‐
100 tions(call_ssh_file_option())
101
102 This callback is delegated to the ssh_file module.
103
104 user_key(Algorithm :: ssh:pubkey_alg(), Options) -> Result
105
106 Types:
107
108 Result =
109 {ok, public_key:private_key()} |
110 {ok, {ssh2_pubkey, PubKeyBlob :: binary()}} |
111 {error, string()}
112 Options =
113 ssh_client_key_api:client_key_cb_options(socket_path_op‐
114 tion() |
115 timeout_op‐
116 tion())
117
118 Types and description
119
120 See the api description in ssh_client_key_api, Mod‐
121 ule:user_key/2.
122
123
124
125Ericsson AB ssh 4.13.2.1 ssh_agent(3)