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
7 default 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_options(call_ssh_file_option())
74 Result = ok | {error, Error :: term()}
75
76 This callback is delegated to the ssh_file module.
77
78 is_host_key(Key :: public_key:public_key(),
79 Host :: string(),
80 Algorithm :: ssh:pubkey_alg(),
81 Options) ->
82 boolean()
83
84 is_host_key(Key :: public_key:public_key(),
85 Host,
86 Port :: inet:port_number(),
87 Algorithm :: ssh:pubkey_alg(),
88 Options) ->
89 boolean()
90
91 Types:
92
93 Host =
94 inet:ip_address() |
95 inet:hostname() |
96 [inet:ip_address() | inet:hostname()]
97 Options =
98 ssh_client_key_api:client_key_cb_options(call_ssh_file_option())
99
100 This callback is delegated to the ssh_file module.
101
102 user_key(Algorithm :: ssh:pubkey_alg(), Options) -> Result
103
104 Types:
105
106 Result =
107 {ok, public_key:private_key()} |
108 {ok, {ssh2_pubkey, PubKeyBlob :: binary()}} |
109 {error, string()}
110 Options =
111 ssh_client_key_api:client_key_cb_options(socket_path_option()
112 |
113 time‐
114 out_option())
115
116 Types and description
117
118 See the api description in ssh_client_key_api, Mod‐
119 ule:user_key/2.
120
121
122
123Ericsson AB ssh 4.11.1 ssh_agent(3)