xref: /dflybsd-src/crypto/openssh/ssh-agent.1 (revision ba1276acd1c8c22d225b1bcf370a14c878644f44)
1*ba1276acSMatthew Dillon.\" $OpenBSD: ssh-agent.1,v 1.79 2023/08/10 14:37:32 naddy Exp $
218de8d7fSPeter Avalos.\"
318de8d7fSPeter Avalos.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
418de8d7fSPeter Avalos.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
518de8d7fSPeter Avalos.\"                    All rights reserved
618de8d7fSPeter Avalos.\"
718de8d7fSPeter Avalos.\" As far as I am concerned, the code I have written for this software
818de8d7fSPeter Avalos.\" can be used freely for any purpose.  Any derived versions of this
918de8d7fSPeter Avalos.\" software must be clearly marked as such, and if the derived work is
1018de8d7fSPeter Avalos.\" incompatible with the protocol description in the RFC file, it must be
1118de8d7fSPeter Avalos.\" called by a name other than "ssh" or "Secure Shell".
1218de8d7fSPeter Avalos.\"
1318de8d7fSPeter Avalos.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
1418de8d7fSPeter Avalos.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
1518de8d7fSPeter Avalos.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
1618de8d7fSPeter Avalos.\"
1718de8d7fSPeter Avalos.\" Redistribution and use in source and binary forms, with or without
1818de8d7fSPeter Avalos.\" modification, are permitted provided that the following conditions
1918de8d7fSPeter Avalos.\" are met:
2018de8d7fSPeter Avalos.\" 1. Redistributions of source code must retain the above copyright
2118de8d7fSPeter Avalos.\"    notice, this list of conditions and the following disclaimer.
2218de8d7fSPeter Avalos.\" 2. Redistributions in binary form must reproduce the above copyright
2318de8d7fSPeter Avalos.\"    notice, this list of conditions and the following disclaimer in the
2418de8d7fSPeter Avalos.\"    documentation and/or other materials provided with the distribution.
2518de8d7fSPeter Avalos.\"
2618de8d7fSPeter Avalos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2718de8d7fSPeter Avalos.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2818de8d7fSPeter Avalos.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2918de8d7fSPeter Avalos.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
3018de8d7fSPeter Avalos.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3118de8d7fSPeter Avalos.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3218de8d7fSPeter Avalos.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3318de8d7fSPeter Avalos.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3418de8d7fSPeter Avalos.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3518de8d7fSPeter Avalos.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3618de8d7fSPeter Avalos.\"
37*ba1276acSMatthew Dillon.Dd $Mdocdate: August 10 2023 $
3818de8d7fSPeter Avalos.Dt SSH-AGENT 1
3918de8d7fSPeter Avalos.Os
4018de8d7fSPeter Avalos.Sh NAME
4118de8d7fSPeter Avalos.Nm ssh-agent
420cbfa66cSDaniel Fojt.Nd OpenSSH authentication agent
4318de8d7fSPeter Avalos.Sh SYNOPSIS
4418de8d7fSPeter Avalos.Nm ssh-agent
459f304aafSPeter Avalos.Op Fl c | s
46e9778795SPeter Avalos.Op Fl \&Dd
4718de8d7fSPeter Avalos.Op Fl a Ar bind_address
48e9778795SPeter Avalos.Op Fl E Ar fingerprint_hash
49*ba1276acSMatthew Dillon.Op Fl O Ar option
5050a69bb5SSascha Wildner.Op Fl P Ar allowed_providers
5118de8d7fSPeter Avalos.Op Fl t Ar life
5250a69bb5SSascha Wildner.Nm ssh-agent
5350a69bb5SSascha Wildner.Op Fl a Ar bind_address
5450a69bb5SSascha Wildner.Op Fl E Ar fingerprint_hash
55*ba1276acSMatthew Dillon.Op Fl O Ar option
5650a69bb5SSascha Wildner.Op Fl P Ar allowed_providers
5750a69bb5SSascha Wildner.Op Fl t Ar life
5850a69bb5SSascha Wildner.Ar command Op Ar arg ...
5918de8d7fSPeter Avalos.Nm ssh-agent
609f304aafSPeter Avalos.Op Fl c | s
6118de8d7fSPeter Avalos.Fl k
6218de8d7fSPeter Avalos.Sh DESCRIPTION
6318de8d7fSPeter Avalos.Nm
640cbfa66cSDaniel Fojtis a program to hold private keys used for public key authentication.
6518de8d7fSPeter AvalosThrough use of environment variables the agent can be located
6618de8d7fSPeter Avalosand automatically used for authentication when logging in to other
6718de8d7fSPeter Avalosmachines using
6818de8d7fSPeter Avalos.Xr ssh 1 .
6918de8d7fSPeter Avalos.Pp
7018de8d7fSPeter AvalosThe options are as follows:
7118de8d7fSPeter Avalos.Bl -tag -width Ds
7218de8d7fSPeter Avalos.It Fl a Ar bind_address
73856ea928SPeter AvalosBind the agent to the
74856ea928SPeter Avalos.Ux Ns -domain
75856ea928SPeter Avalossocket
7618de8d7fSPeter Avalos.Ar bind_address .
7718de8d7fSPeter AvalosThe default is
789f304aafSPeter Avalos.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt .
7918de8d7fSPeter Avalos.It Fl c
8018de8d7fSPeter AvalosGenerate C-shell commands on
8118de8d7fSPeter Avalos.Dv stdout .
8218de8d7fSPeter AvalosThis is the default if
8318de8d7fSPeter Avalos.Ev SHELL
8418de8d7fSPeter Avaloslooks like it's a csh style of shell.
85e9778795SPeter Avalos.It Fl D
86e9778795SPeter AvalosForeground mode.
87ee116499SAntonio Huete JimenezWhen this option is specified,
88e9778795SPeter Avalos.Nm
89e9778795SPeter Avaloswill not fork.
9018de8d7fSPeter Avalos.It Fl d
9118de8d7fSPeter AvalosDebug mode.
92ee116499SAntonio Huete JimenezWhen this option is specified,
9318de8d7fSPeter Avalos.Nm
94e9778795SPeter Avaloswill not fork and will write debug information to standard error.
95e9778795SPeter Avalos.It Fl E Ar fingerprint_hash
96e9778795SPeter AvalosSpecifies the hash algorithm used when displaying key fingerprints.
97e9778795SPeter AvalosValid options are:
98e9778795SPeter Avalos.Dq md5
99e9778795SPeter Avalosand
100e9778795SPeter Avalos.Dq sha256 .
101e9778795SPeter AvalosThe default is
102e9778795SPeter Avalos.Dq sha256 .
10318de8d7fSPeter Avalos.It Fl k
10418de8d7fSPeter AvalosKill the current agent (given by the
10518de8d7fSPeter Avalos.Ev SSH_AGENT_PID
10618de8d7fSPeter Avalosenvironment variable).
107*ba1276acSMatthew Dillon.It Fl O Ar option
108*ba1276acSMatthew DillonSpecify an option when starting
109*ba1276acSMatthew Dillon.Nm .
110*ba1276acSMatthew DillonCurrently two options are supported:
111*ba1276acSMatthew Dillon.Cm allow-remote-pkcs11
112*ba1276acSMatthew Dillonand
113*ba1276acSMatthew Dillon.Cm no-restrict-websafe .
114*ba1276acSMatthew Dillon.Pp
115*ba1276acSMatthew DillonThe
116*ba1276acSMatthew Dillon.Cm allow-remote-pkcs11
117*ba1276acSMatthew Dillonoption allows clients of a forwarded
118*ba1276acSMatthew Dillon.Nm
119*ba1276acSMatthew Dillonto load PKCS#11 or FIDO provider libraries.
120*ba1276acSMatthew DillonBy default only local clients may perform this operation.
121*ba1276acSMatthew DillonNote that signalling that an
122*ba1276acSMatthew Dillon.Nm
123*ba1276acSMatthew Dillonclient is remote is performed by
124*ba1276acSMatthew Dillon.Xr ssh 1 ,
125*ba1276acSMatthew Dillonand use of other tools to forward access to the agent socket may circumvent
126*ba1276acSMatthew Dillonthis restriction.
127*ba1276acSMatthew Dillon.Pp
128*ba1276acSMatthew DillonThe
129*ba1276acSMatthew Dillon.Cm no-restrict-websafe
130*ba1276acSMatthew Dillonoption instructs
131*ba1276acSMatthew Dillon.Nm
132*ba1276acSMatthew Dillonto permit signatures using FIDO keys that might be web authentication
133*ba1276acSMatthew Dillonrequests.
134*ba1276acSMatthew DillonBy default,
135*ba1276acSMatthew Dillon.Nm
136*ba1276acSMatthew Dillonrefuses signature requests for FIDO keys where the key application string
137*ba1276acSMatthew Dillondoes not start with
138*ba1276acSMatthew Dillon.Dq ssh:
139*ba1276acSMatthew Dillonand when the data to be signed does not appear to be a
140*ba1276acSMatthew Dillon.Xr ssh 1
141*ba1276acSMatthew Dillonuser authentication request or a
142*ba1276acSMatthew Dillon.Xr ssh-keygen 1
143*ba1276acSMatthew Dillonsignature.
144*ba1276acSMatthew DillonThe default behaviour prevents forwarded access to a FIDO key from also
145*ba1276acSMatthew Dillonimplicitly forwarding the ability to authenticate to websites.
14650a69bb5SSascha Wildner.It Fl P Ar allowed_providers
14750a69bb5SSascha WildnerSpecify a pattern-list of acceptable paths for PKCS#11 provider and FIDO
14850a69bb5SSascha Wildnerauthenticator middleware shared libraries that may be used with the
1490cbfa66cSDaniel Fojt.Fl S
1500cbfa66cSDaniel Fojtor
151ce74bacaSMatthew Dillon.Fl s
1520cbfa66cSDaniel Fojtoptions to
153ce74bacaSMatthew Dillon.Xr ssh-add 1 .
15450a69bb5SSascha WildnerLibraries that do not match the pattern list will be refused.
155ce74bacaSMatthew DillonSee PATTERNS in
156ce74bacaSMatthew Dillon.Xr ssh_config 5
157ce74bacaSMatthew Dillonfor a description of pattern-list syntax.
15850a69bb5SSascha WildnerThe default list is
159*ba1276acSMatthew Dillon.Dq usr/lib*/*,/usr/local/lib*/* .
16018de8d7fSPeter Avalos.It Fl s
16118de8d7fSPeter AvalosGenerate Bourne shell commands on
16218de8d7fSPeter Avalos.Dv stdout .
16318de8d7fSPeter AvalosThis is the default if
16418de8d7fSPeter Avalos.Ev SHELL
16518de8d7fSPeter Avalosdoes not look like it's a csh style of shell.
16618de8d7fSPeter Avalos.It Fl t Ar life
16718de8d7fSPeter AvalosSet a default value for the maximum lifetime of identities added to the agent.
16818de8d7fSPeter AvalosThe lifetime may be specified in seconds or in a time format specified in
16918de8d7fSPeter Avalos.Xr sshd_config 5 .
17018de8d7fSPeter AvalosA lifetime specified for an identity with
17118de8d7fSPeter Avalos.Xr ssh-add 1
17218de8d7fSPeter Avalosoverrides this value.
17318de8d7fSPeter AvalosWithout this option the default maximum lifetime is forever.
1740cbfa66cSDaniel Fojt.It Ar command Op Ar arg ...
1750cbfa66cSDaniel FojtIf a command (and optional arguments) is given,
1760cbfa66cSDaniel Fojtthis is executed as a subprocess of the agent.
17718de8d7fSPeter AvalosThe agent exits automatically when the command given on the command
17818de8d7fSPeter Avalosline terminates.
1790cbfa66cSDaniel Fojt.El
1800cbfa66cSDaniel Fojt.Pp
1810cbfa66cSDaniel FojtThere are two main ways to get an agent set up.
1820cbfa66cSDaniel FojtThe first is at the start of an X session,
1830cbfa66cSDaniel Fojtwhere all other windows or programs are started as children of the
1840cbfa66cSDaniel Fojt.Nm
1850cbfa66cSDaniel Fojtprogram.
1860cbfa66cSDaniel FojtThe agent starts a command under which its environment
1870cbfa66cSDaniel Fojtvariables are exported, for example
1880cbfa66cSDaniel Fojt.Cm ssh-agent xterm & .
1890cbfa66cSDaniel FojtWhen the command terminates, so does the agent.
1900cbfa66cSDaniel Fojt.Pp
1910cbfa66cSDaniel FojtThe second method is used for a login session.
1920cbfa66cSDaniel FojtWhen
1930cbfa66cSDaniel Fojt.Nm
1940cbfa66cSDaniel Fojtis started,
1950cbfa66cSDaniel Fojtit prints the shell commands required to set its environment variables,
1960cbfa66cSDaniel Fojtwhich in turn can be evaluated in the calling shell, for example
1970cbfa66cSDaniel Fojt.Cm eval `ssh-agent -s` .
1980cbfa66cSDaniel Fojt.Pp
1990cbfa66cSDaniel FojtIn both cases,
2000cbfa66cSDaniel Fojt.Xr ssh 1
20150a69bb5SSascha Wildnerlooks at these environment variables
20250a69bb5SSascha Wildnerand uses them to establish a connection to the agent.
2030cbfa66cSDaniel Fojt.Pp
2040cbfa66cSDaniel FojtThe agent initially does not have any private keys.
2050cbfa66cSDaniel FojtKeys are added using
2060cbfa66cSDaniel Fojt.Xr ssh-add 1
2070cbfa66cSDaniel Fojtor by
2080cbfa66cSDaniel Fojt.Xr ssh 1
2090cbfa66cSDaniel Fojtwhen
2100cbfa66cSDaniel Fojt.Cm AddKeysToAgent
2110cbfa66cSDaniel Fojtis set in
2120cbfa66cSDaniel Fojt.Xr ssh_config 5 .
2130cbfa66cSDaniel FojtMultiple identities may be stored in
2140cbfa66cSDaniel Fojt.Nm
2150cbfa66cSDaniel Fojtconcurrently and
2160cbfa66cSDaniel Fojt.Xr ssh 1
2170cbfa66cSDaniel Fojtwill automatically use them if present.
2180cbfa66cSDaniel Fojt.Xr ssh-add 1
2190cbfa66cSDaniel Fojtis also used to remove keys from
2200cbfa66cSDaniel Fojt.Nm
2210cbfa66cSDaniel Fojtand to query the keys that are held in one.
2220cbfa66cSDaniel Fojt.Pp
2230cbfa66cSDaniel FojtConnections to
2240cbfa66cSDaniel Fojt.Nm
2250cbfa66cSDaniel Fojtmay be forwarded from further remote hosts using the
2260cbfa66cSDaniel Fojt.Fl A
2270cbfa66cSDaniel Fojtoption to
2280cbfa66cSDaniel Fojt.Xr ssh 1
2290cbfa66cSDaniel Fojt(but see the caveats documented therein),
2300cbfa66cSDaniel Fojtavoiding the need for authentication data to be stored on other machines.
2310cbfa66cSDaniel FojtAuthentication passphrases and private keys never go over the network:
2320cbfa66cSDaniel Fojtthe connection to the agent is forwarded over SSH remote connections
2330cbfa66cSDaniel Fojtand the result is returned to the requester,
2340cbfa66cSDaniel Fojtallowing the user access to their identities anywhere in the network
2350cbfa66cSDaniel Fojtin a secure fashion.
2360cbfa66cSDaniel Fojt.Sh ENVIRONMENT
2370cbfa66cSDaniel Fojt.Bl -tag -width "SSH_AGENT_PID"
2380cbfa66cSDaniel Fojt.It Ev SSH_AGENT_PID
2390cbfa66cSDaniel FojtWhen
2400cbfa66cSDaniel Fojt.Nm
2410cbfa66cSDaniel Fojtstarts, it stores the name of the agent's process ID (PID) in this variable.
2420cbfa66cSDaniel Fojt.It Ev SSH_AUTH_SOCK
2430cbfa66cSDaniel FojtWhen
2440cbfa66cSDaniel Fojt.Nm
2450cbfa66cSDaniel Fojtstarts, it creates a
2460cbfa66cSDaniel Fojt.Ux Ns -domain
2470cbfa66cSDaniel Fojtsocket and stores its pathname in this variable.
2480cbfa66cSDaniel FojtIt is accessible only to the current user,
2490cbfa66cSDaniel Fojtbut is easily abused by root or another instance of the same user.
2500cbfa66cSDaniel Fojt.El
25118de8d7fSPeter Avalos.Sh FILES
25218de8d7fSPeter Avalos.Bl -tag -width Ds
253ce74bacaSMatthew Dillon.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>
254856ea928SPeter Avalos.Ux Ns -domain
255856ea928SPeter Avalossockets used to contain the connection to the authentication agent.
25618de8d7fSPeter AvalosThese sockets should only be readable by the owner.
25718de8d7fSPeter AvalosThe sockets should get automatically removed when the agent exits.
25818de8d7fSPeter Avalos.El
25918de8d7fSPeter Avalos.Sh SEE ALSO
26018de8d7fSPeter Avalos.Xr ssh 1 ,
26118de8d7fSPeter Avalos.Xr ssh-add 1 ,
26218de8d7fSPeter Avalos.Xr ssh-keygen 1 ,
2630cbfa66cSDaniel Fojt.Xr ssh_config 5 ,
26418de8d7fSPeter Avalos.Xr sshd 8
26518de8d7fSPeter Avalos.Sh AUTHORS
266ce74bacaSMatthew Dillon.An -nosplit
267ce74bacaSMatthew DillonOpenSSH is a derivative of the original and free ssh 1.2.12 release by
268ce74bacaSMatthew Dillon.An Tatu Ylonen .
269ce74bacaSMatthew Dillon.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt
270ce74bacaSMatthew Dillonand
271ce74bacaSMatthew Dillon.An Dug Song
272ce74bacaSMatthew Dillonremoved many bugs, re-added newer features and created OpenSSH.
273ce74bacaSMatthew Dillon.An Markus Friedl
274ce74bacaSMatthew Dilloncontributed the support for SSH protocol versions 1.5 and 2.0.
275