xref: /freebsd/crypto/openssh/ssh-keygen.1 (revision 38a52bd3b5cac3da6f7f6eef3dd050e6aa08ebb3)
1*38a52bd3SEd Maste.\"	$OpenBSD: ssh-keygen.1,v 1.226 2022/09/10 08:50:53 jsg Exp $
21e8db6e2SBrian Feldman.\"
3511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5511b41d2SMark Murray.\"                    All rights reserved
6511b41d2SMark Murray.\"
7b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software
8b66f2d16SKris Kennaway.\" can be used freely for any purpose.  Any derived versions of this
9b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is
10b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be
11b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell".
12511b41d2SMark Murray.\"
13b66f2d16SKris Kennaway.\"
14b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
15b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
16b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
17b66f2d16SKris Kennaway.\"
18b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without
19b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions
20b66f2d16SKris Kennaway.\" are met:
21b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright
22b66f2d16SKris Kennaway.\"    notice, this list of conditions and the following disclaimer.
23b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright
24b66f2d16SKris Kennaway.\"    notice, this list of conditions and the following disclaimer in the
25b66f2d16SKris Kennaway.\"    documentation and/or other materials provided with the distribution.
26b66f2d16SKris Kennaway.\"
27b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37511b41d2SMark Murray.\"
38*38a52bd3SEd Maste.Dd $Mdocdate: September 10 2022 $
39511b41d2SMark Murray.Dt SSH-KEYGEN 1
40511b41d2SMark Murray.Os
41511b41d2SMark Murray.Sh NAME
42511b41d2SMark Murray.Nm ssh-keygen
4319261079SEd Maste.Nd OpenSSH authentication key utility
44511b41d2SMark Murray.Sh SYNOPSIS
45e2f6069cSDag-Erling Smørgrav.Nm ssh-keygen
461e8db6e2SBrian Feldman.Op Fl q
4719261079SEd Maste.Op Fl a Ar rounds
48511b41d2SMark Murray.Op Fl b Ar bits
49511b41d2SMark Murray.Op Fl C Ar comment
50b66f2d16SKris Kennaway.Op Fl f Ar output_keyfile
5119261079SEd Maste.Op Fl m Ar format
5219261079SEd Maste.Op Fl N Ar new_passphrase
5319261079SEd Maste.Op Fl O Ar option
5419261079SEd Maste.Op Fl t Cm dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
5519261079SEd Maste.Op Fl w Ar provider
5619261079SEd Maste.Op Fl Z Ar cipher
57511b41d2SMark Murray.Nm ssh-keygen
58511b41d2SMark Murray.Fl p
5919261079SEd Maste.Op Fl a Ar rounds
60511b41d2SMark Murray.Op Fl f Ar keyfile
6119261079SEd Maste.Op Fl m Ar format
6219261079SEd Maste.Op Fl N Ar new_passphrase
6319261079SEd Maste.Op Fl P Ar old_passphrase
6419261079SEd Maste.Op Fl Z Ar cipher
65511b41d2SMark Murray.Nm ssh-keygen
661e8db6e2SBrian Feldman.Fl i
67b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
6819261079SEd Maste.Op Fl m Ar key_format
69a04a10f8SKris Kennaway.Nm ssh-keygen
701e8db6e2SBrian Feldman.Fl e
71b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
7219261079SEd Maste.Op Fl m Ar key_format
73a04a10f8SKris Kennaway.Nm ssh-keygen
74a04a10f8SKris Kennaway.Fl y
75b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
76a04a10f8SKris Kennaway.Nm ssh-keygen
77511b41d2SMark Murray.Fl c
7819261079SEd Maste.Op Fl a Ar rounds
79511b41d2SMark Murray.Op Fl C Ar comment
80511b41d2SMark Murray.Op Fl f Ar keyfile
8119261079SEd Maste.Op Fl P Ar passphrase
82511b41d2SMark Murray.Nm ssh-keygen
83511b41d2SMark Murray.Fl l
84bc5531deSDag-Erling Smørgrav.Op Fl v
85bc5531deSDag-Erling Smørgrav.Op Fl E Ar fingerprint_hash
86b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
87a04a10f8SKris Kennaway.Nm ssh-keygen
881e8db6e2SBrian Feldman.Fl B
891e8db6e2SBrian Feldman.Op Fl f Ar input_keyfile
90ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen
91b15c8340SDag-Erling Smørgrav.Fl D Ar pkcs11
92ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen
935e8dbd04SDag-Erling Smørgrav.Fl F Ar hostname
9419261079SEd Maste.Op Fl lv
955e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file
965e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen
975e8dbd04SDag-Erling Smørgrav.Fl H
985e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file
995e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen
10019261079SEd Maste.Fl K
10119261079SEd Maste.Op Fl a Ar rounds
10219261079SEd Maste.Op Fl w Ar provider
10319261079SEd Maste.Nm ssh-keygen
1045e8dbd04SDag-Erling Smørgrav.Fl R Ar hostname
1055e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file
1065e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen
107d95e11bfSDag-Erling Smørgrav.Fl r Ar hostname
108d95e11bfSDag-Erling Smørgrav.Op Fl g
10919261079SEd Maste.Op Fl f Ar input_keyfile
110d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen
11119261079SEd Maste.Fl M Cm generate
11219261079SEd Maste.Op Fl O Ar option
11319261079SEd Maste.Ar output_file
114d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen
11519261079SEd Maste.Fl M Cm screen
11619261079SEd Maste.Op Fl f Ar input_file
11719261079SEd Maste.Op Fl O Ar option
11819261079SEd Maste.Ar output_file
119b15c8340SDag-Erling Smørgrav.Nm ssh-keygen
120b15c8340SDag-Erling Smørgrav.Fl I Ar certificate_identity
12119261079SEd Maste.Fl s Ar ca_key
12219261079SEd Maste.Op Fl hU
1234f52dfbbSDag-Erling Smørgrav.Op Fl D Ar pkcs11_provider
124b15c8340SDag-Erling Smørgrav.Op Fl n Ar principals
125e2f6069cSDag-Erling Smørgrav.Op Fl O Ar option
126b15c8340SDag-Erling Smørgrav.Op Fl V Ar validity_interval
127e2f6069cSDag-Erling Smørgrav.Op Fl z Ar serial_number
128b15c8340SDag-Erling Smørgrav.Ar
129b15c8340SDag-Erling Smørgrav.Nm ssh-keygen
130b15c8340SDag-Erling Smørgrav.Fl L
131b15c8340SDag-Erling Smørgrav.Op Fl f Ar input_keyfile
132e146993eSDag-Erling Smørgrav.Nm ssh-keygen
133e146993eSDag-Erling Smørgrav.Fl A
13419261079SEd Maste.Op Fl a Ar rounds
1354f52dfbbSDag-Erling Smørgrav.Op Fl f Ar prefix_path
1366888a9beSDag-Erling Smørgrav.Nm ssh-keygen
1376888a9beSDag-Erling Smørgrav.Fl k
1386888a9beSDag-Erling Smørgrav.Fl f Ar krl_file
1396888a9beSDag-Erling Smørgrav.Op Fl u
1406888a9beSDag-Erling Smørgrav.Op Fl s Ar ca_public
1416888a9beSDag-Erling Smørgrav.Op Fl z Ar version_number
1426888a9beSDag-Erling Smørgrav.Ar
1436888a9beSDag-Erling Smørgrav.Nm ssh-keygen
1446888a9beSDag-Erling Smørgrav.Fl Q
14519261079SEd Maste.Op Fl l
1466888a9beSDag-Erling Smørgrav.Fl f Ar krl_file
1476888a9beSDag-Erling Smørgrav.Ar
14819261079SEd Maste.Nm ssh-keygen
14919261079SEd Maste.Fl Y Cm find-principals
15019261079SEd Maste.Op Fl O Ar option
15119261079SEd Maste.Fl s Ar signature_file
15219261079SEd Maste.Fl f Ar allowed_signers_file
15319261079SEd Maste.Nm ssh-keygen
1541323ec57SEd Maste.Fl Y Cm match-principals
1551323ec57SEd Maste.Fl I Ar signer_identity
1561323ec57SEd Maste.Fl f Ar allowed_signers_file
1571323ec57SEd Maste.Nm ssh-keygen
15819261079SEd Maste.Fl Y Cm check-novalidate
15919261079SEd Maste.Op Fl O Ar option
16019261079SEd Maste.Fl n Ar namespace
16119261079SEd Maste.Fl s Ar signature_file
16219261079SEd Maste.Nm ssh-keygen
16319261079SEd Maste.Fl Y Cm sign
1641323ec57SEd Maste.Op Fl O Ar option
16519261079SEd Maste.Fl f Ar key_file
16619261079SEd Maste.Fl n Ar namespace
16719261079SEd Maste.Ar
16819261079SEd Maste.Nm ssh-keygen
16919261079SEd Maste.Fl Y Cm verify
17019261079SEd Maste.Op Fl O Ar option
17119261079SEd Maste.Fl f Ar allowed_signers_file
17219261079SEd Maste.Fl I Ar signer_identity
17319261079SEd Maste.Fl n Ar namespace
17419261079SEd Maste.Fl s Ar signature_file
17519261079SEd Maste.Op Fl r Ar revocation_file
176511b41d2SMark Murray.Sh DESCRIPTION
177511b41d2SMark Murray.Nm
1781e8db6e2SBrian Feldmangenerates, manages and converts authentication keys for
179511b41d2SMark Murray.Xr ssh 1 .
180a04a10f8SKris Kennaway.Nm
1814f52dfbbSDag-Erling Smørgravcan create keys for use by SSH protocol version 2.
182acc1a9efSDag-Erling Smørgrav.Pp
183d95e11bfSDag-Erling SmørgravThe type of key to be generated is specified with the
1841e8db6e2SBrian Feldman.Fl t
185ae1f160dSDag-Erling Smørgravoption.
186021d409fSDag-Erling SmørgravIf invoked without any arguments,
187021d409fSDag-Erling Smørgrav.Nm
1884f52dfbbSDag-Erling Smørgravwill generate an RSA key.
189a04a10f8SKris Kennaway.Pp
190d95e11bfSDag-Erling Smørgrav.Nm
191d95e11bfSDag-Erling Smørgravis also used to generate groups for use in Diffie-Hellman group
192d95e11bfSDag-Erling Smørgravexchange (DH-GEX).
193d95e11bfSDag-Erling SmørgravSee the
194d95e11bfSDag-Erling Smørgrav.Sx MODULI GENERATION
195d95e11bfSDag-Erling Smørgravsection for details.
196d95e11bfSDag-Erling Smørgrav.Pp
1976888a9beSDag-Erling SmørgravFinally,
1986888a9beSDag-Erling Smørgrav.Nm
1996888a9beSDag-Erling Smørgravcan be used to generate and update Key Revocation Lists, and to test whether
2006888a9beSDag-Erling Smørgravgiven keys have been revoked by one.
2016888a9beSDag-Erling SmørgravSee the
2026888a9beSDag-Erling Smørgrav.Sx KEY REVOCATION LISTS
2036888a9beSDag-Erling Smørgravsection for details.
2046888a9beSDag-Erling Smørgrav.Pp
205511b41d2SMark MurrayNormally each user wishing to use SSH
2064a421b63SDag-Erling Smørgravwith public key authentication runs this once to create the authentication
207511b41d2SMark Murraykey in
208f7167e0eSDag-Erling Smørgrav.Pa ~/.ssh/id_dsa ,
2094a421b63SDag-Erling Smørgrav.Pa ~/.ssh/id_ecdsa ,
21019261079SEd Maste.Pa ~/.ssh/id_ecdsa_sk ,
21119261079SEd Maste.Pa ~/.ssh/id_ed25519 ,
21219261079SEd Maste.Pa ~/.ssh/id_ed25519_sk
213a04a10f8SKris Kennawayor
214043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_rsa .
215a04a10f8SKris KennawayAdditionally, the system administrator may use this to generate host keys,
216a04a10f8SKris Kennawayas seen in
217a04a10f8SKris Kennaway.Pa /etc/rc .
218511b41d2SMark Murray.Pp
219511b41d2SMark MurrayNormally this program generates the key and asks for a file in which
220a8f6863aSKris Kennawayto store the private key.
221a8f6863aSKris KennawayThe public key is stored in a file with the same name but
222511b41d2SMark Murray.Dq .pub
223a8f6863aSKris Kennawayappended.
224a8f6863aSKris KennawayThe program also asks for a passphrase.
225a8f6863aSKris KennawayThe passphrase may be empty to indicate no passphrase
2261e8db6e2SBrian Feldman(host keys must have an empty passphrase), or it may be a string of
227a8f6863aSKris Kennawayarbitrary length.
228ae1f160dSDag-Erling SmørgravA passphrase is similar to a password, except it can be a phrase with a
229ae1f160dSDag-Erling Smørgravseries of words, punctuation, numbers, whitespace, or any string of
230ae1f160dSDag-Erling Smørgravcharacters you want.
231ae1f160dSDag-Erling SmørgravGood passphrases are 10-30 characters long, are
232511b41d2SMark Murraynot simple sentences or otherwise easily guessable (English
233ae1f160dSDag-Erling Smørgravprose has only 1-2 bits of entropy per character, and provides very bad
234ae1f160dSDag-Erling Smørgravpassphrases), and contain a mix of upper and lowercase letters,
235ae1f160dSDag-Erling Smørgravnumbers, and non-alphanumeric characters.
236a8f6863aSKris KennawayThe passphrase can be changed later by using the
237511b41d2SMark Murray.Fl p
238511b41d2SMark Murrayoption.
239511b41d2SMark Murray.Pp
240a8f6863aSKris KennawayThere is no way to recover a lost passphrase.
241e146993eSDag-Erling SmørgravIf the passphrase is lost or forgotten, a new key must be generated
242e146993eSDag-Erling Smørgravand the corresponding public key copied to other machines.
243511b41d2SMark Murray.Pp
24419261079SEd Maste.Nm
24519261079SEd Mastewill by default write keys in an OpenSSH-specific format.
24619261079SEd MasteThis format is preferred as it offers better protection for
24719261079SEd Mastekeys at rest as well as allowing storage of key comments within
24819261079SEd Mastethe private key file itself.
24919261079SEd MasteThe key comment may be useful to help identify the key.
250a8f6863aSKris KennawayThe comment is initialized to
251511b41d2SMark Murray.Dq user@host
252511b41d2SMark Murraywhen the key is created, but can be changed using the
253511b41d2SMark Murray.Fl c
254511b41d2SMark Murrayoption.
255511b41d2SMark Murray.Pp
25619261079SEd MasteIt is still possible for
25719261079SEd Maste.Nm
25819261079SEd Masteto write the previously-used PEM format private keys using the
25919261079SEd Maste.Fl m
26019261079SEd Masteflag.
26119261079SEd MasteThis may be used when generating new keys, and existing new-format
26219261079SEd Mastekeys may be converted using this option in conjunction with the
26319261079SEd Maste.Fl p
26419261079SEd Maste(change passphrase) flag.
26519261079SEd Maste.Pp
26619261079SEd MasteAfter a key is generated,
26719261079SEd Maste.Nm
26819261079SEd Mastewill ask where the keys
269a04a10f8SKris Kennawayshould be placed to be activated.
270a04a10f8SKris Kennaway.Pp
271511b41d2SMark MurrayThe options are as follows:
272511b41d2SMark Murray.Bl -tag -width Ds
273e146993eSDag-Erling Smørgrav.It Fl A
274*38a52bd3SEd MasteGenerate host keys of all default key types (rsa, ecdsa, and
275*38a52bd3SEd Masteed25519) if they do not already exist.
276*38a52bd3SEd MasteThe host keys are generated with the default key file path,
277e146993eSDag-Erling Smørgravan empty passphrase, default bits for the key type, and default comment.
2784f52dfbbSDag-Erling SmørgravIf
2794f52dfbbSDag-Erling Smørgrav.Fl f
2804f52dfbbSDag-Erling Smørgravhas also been specified, its argument is used as a prefix to the
2814f52dfbbSDag-Erling Smørgravdefault path for the resulting host key files.
282e146993eSDag-Erling SmørgravThis is used by
283e146993eSDag-Erling Smørgrav.Pa /etc/rc
284e146993eSDag-Erling Smørgravto generate new host keys.
285f7167e0eSDag-Erling Smørgrav.It Fl a Ar rounds
28619261079SEd MasteWhen saving a private key, this option specifies the number of KDF
28719261079SEd Maste(key derivation function, currently
28819261079SEd Maste.Xr bcrypt_pbkdf 3 )
28919261079SEd Masterounds used.
290f7167e0eSDag-Erling SmørgravHigher numbers result in slower passphrase verification and increased
291f7167e0eSDag-Erling Smørgravresistance to brute-force password cracking (should the keys be stolen).
29219261079SEd MasteThe default is 16 rounds.
2935e8dbd04SDag-Erling Smørgrav.It Fl B
2945e8dbd04SDag-Erling SmørgravShow the bubblebabble digest of specified private or public key file.
295511b41d2SMark Murray.It Fl b Ar bits
296a8f6863aSKris KennawaySpecifies the number of bits in the key to create.
29719261079SEd MasteFor RSA keys, the minimum size is 1024 bits and the default is 3072 bits.
29819261079SEd MasteGenerally, 3072 bits is considered sufficient.
299021d409fSDag-Erling SmørgravDSA keys must be exactly 1024 bits as specified by FIPS 186-2.
300e146993eSDag-Erling SmørgravFor ECDSA keys, the
301e146993eSDag-Erling Smørgrav.Fl b
302462c32cbSDag-Erling Smørgravflag determines the key length by selecting from one of three elliptic
303e146993eSDag-Erling Smørgravcurve sizes: 256, 384 or 521 bits.
304e146993eSDag-Erling SmørgravAttempting to use bit lengths other than these three values for ECDSA keys
305e146993eSDag-Erling Smørgravwill fail.
30619261079SEd MasteECDSA-SK, Ed25519 and Ed25519-SK keys have a fixed length and the
307f7167e0eSDag-Erling Smørgrav.Fl b
308f7167e0eSDag-Erling Smørgravflag will be ignored.
3095e8dbd04SDag-Erling Smørgrav.It Fl C Ar comment
3105e8dbd04SDag-Erling SmørgravProvides a new comment.
311511b41d2SMark Murray.It Fl c
312511b41d2SMark MurrayRequests changing the comment in the private and public key files.
313511b41d2SMark MurrayThe program will prompt for the file containing the private keys, for
314ae1f160dSDag-Erling Smørgravthe passphrase if the key has one, and for the new comment.
315b15c8340SDag-Erling Smørgrav.It Fl D Ar pkcs11
31619261079SEd MasteDownload the public keys provided by the PKCS#11 shared library
317b15c8340SDag-Erling Smørgrav.Ar pkcs11 .
318e2f6069cSDag-Erling SmørgravWhen used in combination with
319e2f6069cSDag-Erling Smørgrav.Fl s ,
320e2f6069cSDag-Erling Smørgravthis option indicates that a CA key resides in a PKCS#11 token (see the
321e2f6069cSDag-Erling Smørgrav.Sx CERTIFICATES
322e2f6069cSDag-Erling Smørgravsection for details).
323bc5531deSDag-Erling Smørgrav.It Fl E Ar fingerprint_hash
324bc5531deSDag-Erling SmørgravSpecifies the hash algorithm used when displaying key fingerprints.
325bc5531deSDag-Erling SmørgravValid options are:
326bc5531deSDag-Erling Smørgrav.Dq md5
327bc5531deSDag-Erling Smørgravand
328bc5531deSDag-Erling Smørgrav.Dq sha256 .
329bc5531deSDag-Erling SmørgravThe default is
330bc5531deSDag-Erling Smørgrav.Dq sha256 .
3311e8db6e2SBrian Feldman.It Fl e
3321e8db6e2SBrian FeldmanThis option will read a private or public OpenSSH key file and
33319261079SEd Masteprint to stdout a public key in one of the formats specified by the
334e2f6069cSDag-Erling Smørgrav.Fl m
335e2f6069cSDag-Erling Smørgravoption.
336e2f6069cSDag-Erling SmørgravThe default export format is
337e2f6069cSDag-Erling Smørgrav.Dq RFC4716 .
338e2f6069cSDag-Erling SmørgravThis option allows exporting OpenSSH keys for use by other programs, including
339e2f6069cSDag-Erling Smørgravseveral commercial SSH implementations.
34019261079SEd Maste.It Fl F Ar hostname | [hostname]:port
3415e8dbd04SDag-Erling SmørgravSearch for the specified
3425e8dbd04SDag-Erling Smørgrav.Ar hostname
34319261079SEd Maste(with optional port number)
3445e8dbd04SDag-Erling Smørgravin a
3455e8dbd04SDag-Erling Smørgrav.Pa known_hosts
3465e8dbd04SDag-Erling Smørgravfile, listing any occurrences found.
3475e8dbd04SDag-Erling SmørgravThis option is useful to find hashed host names or addresses and may also be
3485e8dbd04SDag-Erling Smørgravused in conjunction with the
3495e8dbd04SDag-Erling Smørgrav.Fl H
3505e8dbd04SDag-Erling Smørgravoption to print found keys in a hashed format.
3515e8dbd04SDag-Erling Smørgrav.It Fl f Ar filename
3525e8dbd04SDag-Erling SmørgravSpecifies the filename of the key file.
353d95e11bfSDag-Erling Smørgrav.It Fl g
354d74d50a8SDag-Erling SmørgravUse generic DNS format when printing fingerprint resource records using the
355d74d50a8SDag-Erling Smørgrav.Fl r
356d74d50a8SDag-Erling Smørgravcommand.
3575e8dbd04SDag-Erling Smørgrav.It Fl H
3585e8dbd04SDag-Erling SmørgravHash a
3595e8dbd04SDag-Erling Smørgrav.Pa known_hosts
3604518870cSDag-Erling Smørgravfile.
3614518870cSDag-Erling SmørgravThis replaces all hostnames and addresses with hashed representations
3624518870cSDag-Erling Smørgravwithin the specified file; the original content is moved to a file with
3634518870cSDag-Erling Smørgrava .old suffix.
3645e8dbd04SDag-Erling SmørgravThese hashes may be used normally by
3655e8dbd04SDag-Erling Smørgrav.Nm ssh
3665e8dbd04SDag-Erling Smørgravand
3675e8dbd04SDag-Erling Smørgrav.Nm sshd ,
3685e8dbd04SDag-Erling Smørgravbut they do not reveal identifying information should the file's contents
3695e8dbd04SDag-Erling Smørgravbe disclosed.
3705e8dbd04SDag-Erling SmørgravThis option will not modify existing hashed hostnames and is therefore safe
3715e8dbd04SDag-Erling Smørgravto use on files that mix hashed and non-hashed names.
372b15c8340SDag-Erling Smørgrav.It Fl h
373b15c8340SDag-Erling SmørgravWhen signing a key, create a host certificate instead of a user
374b15c8340SDag-Erling Smørgravcertificate.
3751323ec57SEd MasteSee the
376b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
377b15c8340SDag-Erling Smørgravsection for details.
378b15c8340SDag-Erling Smørgrav.It Fl I Ar certificate_identity
379b15c8340SDag-Erling SmørgravSpecify the key identity when signing a public key.
3801323ec57SEd MasteSee the
381b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
382b15c8340SDag-Erling Smørgravsection for details.
3831e8db6e2SBrian Feldman.It Fl i
3841e8db6e2SBrian FeldmanThis option will read an unencrypted private (or public) key file
385e2f6069cSDag-Erling Smørgravin the format specified by the
386e2f6069cSDag-Erling Smørgrav.Fl m
387e2f6069cSDag-Erling Smørgravoption and print an OpenSSH compatible private
3881e8db6e2SBrian Feldman(or public) key to stdout.
389a0ee8cc6SDag-Erling SmørgravThis option allows importing keys from other software, including several
390a0ee8cc6SDag-Erling Smørgravcommercial SSH implementations.
391a0ee8cc6SDag-Erling SmørgravThe default import format is
392a0ee8cc6SDag-Erling Smørgrav.Dq RFC4716 .
39319261079SEd Maste.It Fl K
39419261079SEd MasteDownload resident keys from a FIDO authenticator.
39519261079SEd MastePublic and private key files will be written to the current directory for
39619261079SEd Masteeach downloaded key.
39719261079SEd MasteIf multiple FIDO authenticators are attached, keys will be downloaded from
39819261079SEd Mastethe first touched authenticator.
399*38a52bd3SEd MasteSee the
400*38a52bd3SEd Maste.Sx FIDO AUTHENTICATOR
401*38a52bd3SEd Mastesection for more information.
4026888a9beSDag-Erling Smørgrav.It Fl k
4036888a9beSDag-Erling SmørgravGenerate a KRL file.
4046888a9beSDag-Erling SmørgravIn this mode,
4056888a9beSDag-Erling Smørgrav.Nm
4066888a9beSDag-Erling Smørgravwill generate a KRL file at the location specified via the
4076888a9beSDag-Erling Smørgrav.Fl f
4086888a9beSDag-Erling Smørgravflag that revokes every key or certificate presented on the command line.
4096888a9beSDag-Erling SmørgravKeys/certificates to be revoked may be specified by public key file or
4106888a9beSDag-Erling Smørgravusing the format described in the
4116888a9beSDag-Erling Smørgrav.Sx KEY REVOCATION LISTS
4126888a9beSDag-Erling Smørgravsection.
413b15c8340SDag-Erling Smørgrav.It Fl L
414acc1a9efSDag-Erling SmørgravPrints the contents of one or more certificates.
415511b41d2SMark Murray.It Fl l
416ae1f160dSDag-Erling SmørgravShow fingerprint of specified public key file.
417ae1f160dSDag-Erling SmørgravFor RSA and DSA keys
418ae1f160dSDag-Erling Smørgrav.Nm
419ae1f160dSDag-Erling Smørgravtries to find the matching public key file and prints its fingerprint.
420d4af9e69SDag-Erling SmørgravIf combined with
421d4af9e69SDag-Erling Smørgrav.Fl v ,
422076ad2f8SDag-Erling Smørgrava visual ASCII art representation of the key is supplied with the
423076ad2f8SDag-Erling Smørgravfingerprint.
42419261079SEd Maste.It Fl M Cm generate
42519261079SEd MasteGenerate candidate Diffie-Hellman Group Exchange (DH-GEX) parameters for
42619261079SEd Masteeventual use by the
42719261079SEd Maste.Sq diffie-hellman-group-exchange-*
42819261079SEd Mastekey exchange methods.
42919261079SEd MasteThe numbers generated by this operation must be further screened before
43019261079SEd Masteuse.
43119261079SEd MasteSee the
43219261079SEd Maste.Sx MODULI GENERATION
43319261079SEd Mastesection for more information.
43419261079SEd Maste.It Fl M Cm screen
43519261079SEd MasteScreen candidate parameters for Diffie-Hellman Group Exchange.
43619261079SEd MasteThis will accept a list of candidate numbers and test that they are
43719261079SEd Mastesafe (Sophie Germain) primes with acceptable group generators.
43819261079SEd MasteThe results of this operation may be added to the
43919261079SEd Maste.Pa /etc/moduli
44019261079SEd Mastefile.
44119261079SEd MasteSee the
44219261079SEd Maste.Sx MODULI GENERATION
44319261079SEd Mastesection for more information.
444e2f6069cSDag-Erling Smørgrav.It Fl m Ar key_format
44519261079SEd MasteSpecify a key format for key generation, the
446e2f6069cSDag-Erling Smørgrav.Fl i
44719261079SEd Maste(import),
448e2f6069cSDag-Erling Smørgrav.Fl e
44919261079SEd Maste(export) conversion options, and the
45019261079SEd Maste.Fl p
45119261079SEd Mastechange passphrase operation.
45219261079SEd MasteThe latter may be used to convert between OpenSSH private key and PEM
45319261079SEd Masteprivate key formats.
454e2f6069cSDag-Erling SmørgravThe supported key formats are:
455e2f6069cSDag-Erling Smørgrav.Dq RFC4716
456e2f6069cSDag-Erling Smørgrav(RFC 4716/SSH2 public or private key),
457e2f6069cSDag-Erling Smørgrav.Dq PKCS8
45819261079SEd Maste(PKCS8 public or private key)
459e2f6069cSDag-Erling Smørgravor
460e2f6069cSDag-Erling Smørgrav.Dq PEM
461e2f6069cSDag-Erling Smørgrav(PEM public key).
46219261079SEd MasteBy default OpenSSH will write newly-generated private keys in its own
46319261079SEd Masteformat, but when converting public keys for export the default format is
464e2f6069cSDag-Erling Smørgrav.Dq RFC4716 .
465190cef3dSDag-Erling SmørgravSetting a format of
466190cef3dSDag-Erling Smørgrav.Dq PEM
467190cef3dSDag-Erling Smørgravwhen generating or updating a supported private key type will cause the
468190cef3dSDag-Erling Smørgravkey to be stored in the legacy PEM private key format.
4695e8dbd04SDag-Erling Smørgrav.It Fl N Ar new_passphrase
4705e8dbd04SDag-Erling SmørgravProvides the new passphrase.
471b15c8340SDag-Erling Smørgrav.It Fl n Ar principals
472b15c8340SDag-Erling SmørgravSpecify one or more principals (user or host names) to be included in
473b15c8340SDag-Erling Smørgrava certificate when signing a key.
474b15c8340SDag-Erling SmørgravMultiple principals may be specified, separated by commas.
4751323ec57SEd MasteSee the
476b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
477b15c8340SDag-Erling Smørgravsection for details.
478e2f6069cSDag-Erling Smørgrav.It Fl O Ar option
47919261079SEd MasteSpecify a key/value option.
48019261079SEd MasteThese are specific to the operation that
48119261079SEd Maste.Nm
48219261079SEd Mastehas been requested to perform.
48347dd1d1bSDag-Erling Smørgrav.Pp
48419261079SEd MasteWhen signing certificates, one of the options listed in the
48519261079SEd Maste.Sx CERTIFICATES
48619261079SEd Mastesection may be specified here.
48719261079SEd Maste.Pp
48819261079SEd MasteWhen performing moduli generation or screening, one of the options
48919261079SEd Mastelisted in the
49019261079SEd Maste.Sx MODULI GENERATION
49119261079SEd Mastesection may be specified.
49219261079SEd Maste.Pp
493*38a52bd3SEd MasteWhen generating FIDO authenticator-backed keys, the options listed in the
494*38a52bd3SEd Maste.Sx FIDO AUTHENTICATOR
495*38a52bd3SEd Mastesection may be specified.
49619261079SEd Maste.Pp
49719261079SEd MasteWhen performing signature-related options using the
49819261079SEd Maste.Fl Y
49919261079SEd Masteflag, the following options are accepted:
50019261079SEd Maste.Bl -tag -width Ds
5011323ec57SEd Maste.It Cm hashalg Ns = Ns Ar algorithm
5021323ec57SEd MasteSelects the hash algorithm to use for hashing the message to be signed.
5031323ec57SEd MasteValid algorithms are
5041323ec57SEd Maste.Dq sha256
5051323ec57SEd Masteand
5061323ec57SEd Maste.Dq sha512.
5071323ec57SEd MasteThe default is
5081323ec57SEd Maste.Dq sha512.
50919261079SEd Maste.It Cm print-pubkey
51019261079SEd MastePrint the full public key to standard output after signature verification.
51119261079SEd Maste.It Cm verify-time Ns = Ns Ar timestamp
51219261079SEd MasteSpecifies a time to use when validating signatures instead of the current
51319261079SEd Mastetime.
514*38a52bd3SEd MasteThe time may be specified as a date or time in the YYYYMMDD[Z] or
515*38a52bd3SEd Mastein YYYYMMDDHHMM[SS][Z] formats.
516*38a52bd3SEd MasteDates and times will be interpreted in the current system time zone unless
517*38a52bd3SEd Mastesuffixed with a Z character, which causes them to be interpreted in the
518*38a52bd3SEd MasteUTC time zone.
51919261079SEd Maste.El
52019261079SEd Maste.Pp
52119261079SEd MasteThe
52219261079SEd Maste.Fl O
52319261079SEd Masteoption may be specified multiple times.
52419261079SEd Maste.It Fl P Ar passphrase
52519261079SEd MasteProvides the (old) passphrase.
52619261079SEd Maste.It Fl p
52719261079SEd MasteRequests changing the passphrase of a private key file instead of
52819261079SEd Mastecreating a new private key.
52919261079SEd MasteThe program will prompt for the file
53019261079SEd Mastecontaining the private key, for the old passphrase, and twice for the
53119261079SEd Mastenew passphrase.
53219261079SEd Maste.It Fl Q
53319261079SEd MasteTest whether keys have been revoked in a KRL.
53419261079SEd MasteIf the
53519261079SEd Maste.Fl l
53619261079SEd Masteoption is also specified then the contents of the KRL will be printed.
53719261079SEd Maste.It Fl q
53819261079SEd MasteSilence
53919261079SEd Maste.Nm ssh-keygen .
54019261079SEd Maste.It Fl R Ar hostname | [hostname]:port
54119261079SEd MasteRemoves all keys belonging to the specified
54219261079SEd Maste.Ar hostname
54319261079SEd Maste(with optional port number)
54419261079SEd Mastefrom a
54519261079SEd Maste.Pa known_hosts
54619261079SEd Mastefile.
54719261079SEd MasteThis option is useful to delete hashed hosts (see the
54819261079SEd Maste.Fl H
54919261079SEd Masteoption above).
55019261079SEd Maste.It Fl r Ar hostname
55119261079SEd MastePrint the SSHFP fingerprint resource record named
55219261079SEd Maste.Ar hostname
55319261079SEd Mastefor the specified public key file.
55419261079SEd Maste.It Fl s Ar ca_key
55519261079SEd MasteCertify (sign) a public key using the specified CA key.
5561323ec57SEd MasteSee the
55719261079SEd Maste.Sx CERTIFICATES
55819261079SEd Mastesection for details.
55919261079SEd Maste.Pp
56019261079SEd MasteWhen generating a KRL,
56119261079SEd Maste.Fl s
56219261079SEd Mastespecifies a path to a CA public key file used to revoke certificates directly
56319261079SEd Masteby key ID or serial number.
56419261079SEd MasteSee the
56519261079SEd Maste.Sx KEY REVOCATION LISTS
56619261079SEd Mastesection for details.
56719261079SEd Maste.It Fl t Cm dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
56819261079SEd MasteSpecifies the type of key to create.
56919261079SEd MasteThe possible values are
57019261079SEd Maste.Dq dsa ,
57119261079SEd Maste.Dq ecdsa ,
57219261079SEd Maste.Dq ecdsa-sk ,
57319261079SEd Maste.Dq ed25519 ,
57419261079SEd Maste.Dq ed25519-sk ,
57519261079SEd Masteor
57619261079SEd Maste.Dq rsa .
57719261079SEd Maste.Pp
57819261079SEd MasteThis flag may also be used to specify the desired signature type when
57919261079SEd Mastesigning certificates using an RSA CA key.
58019261079SEd MasteThe available RSA signature variants are
58119261079SEd Maste.Dq ssh-rsa
58219261079SEd Maste(SHA1 signatures, not recommended),
58319261079SEd Maste.Dq rsa-sha2-256 ,
58419261079SEd Masteand
58519261079SEd Maste.Dq rsa-sha2-512
58619261079SEd Maste(the default).
58719261079SEd Maste.It Fl U
58819261079SEd MasteWhen used in combination with
589*38a52bd3SEd Maste.Fl s
590*38a52bd3SEd Masteor
591*38a52bd3SEd Maste.Fl Y Cm sign ,
59219261079SEd Mastethis option indicates that a CA key resides in a
59319261079SEd Maste.Xr ssh-agent 1 .
59419261079SEd MasteSee the
59519261079SEd Maste.Sx CERTIFICATES
59619261079SEd Mastesection for more information.
59719261079SEd Maste.It Fl u
59819261079SEd MasteUpdate a KRL.
59919261079SEd MasteWhen specified with
60019261079SEd Maste.Fl k ,
60119261079SEd Mastekeys listed via the command line are added to the existing KRL rather than
60219261079SEd Mastea new KRL being created.
60319261079SEd Maste.It Fl V Ar validity_interval
60419261079SEd MasteSpecify a validity interval when signing a certificate.
60519261079SEd MasteA validity interval may consist of a single time, indicating that the
60619261079SEd Mastecertificate is valid beginning now and expiring at that time, or may consist
60719261079SEd Masteof two times separated by a colon to indicate an explicit time interval.
60819261079SEd Maste.Pp
609*38a52bd3SEd MasteThe start time may be specified as:
610*38a52bd3SEd Maste.Bl -bullet -compact
611*38a52bd3SEd Maste.It
612*38a52bd3SEd MasteThe string
61319261079SEd Maste.Dq always
614*38a52bd3SEd Masteto indicate the certificate has no specified start time.
615*38a52bd3SEd Maste.It
616*38a52bd3SEd MasteA date or time in the system time zone formatted as YYYYMMDD or
617*38a52bd3SEd MasteYYYYMMDDHHMM[SS].
618*38a52bd3SEd Maste.It
619*38a52bd3SEd MasteA date or time in the UTC time zone as YYYYMMDDZ or YYYYMMDDHHMM[SS]Z.
620*38a52bd3SEd Maste.It
621*38a52bd3SEd MasteA relative time before the current system time consisting of a minus sign
622*38a52bd3SEd Mastefollowed by an interval in the format described in the
62319261079SEd MasteTIME FORMATS section of
62419261079SEd Maste.Xr sshd_config 5 .
625*38a52bd3SEd Maste.It
626*38a52bd3SEd MasteA raw seconds since epoch (Jan 1 1970 00:00:00 UTC) as a hexadecimal
627*38a52bd3SEd Mastenumber beginning with
628*38a52bd3SEd Maste.Dq 0x .
629*38a52bd3SEd Maste.El
63019261079SEd Maste.Pp
631*38a52bd3SEd MasteThe end time may be specified similarly to the start time:
632*38a52bd3SEd Maste.Bl -bullet -compact
633*38a52bd3SEd Maste.It
634*38a52bd3SEd MasteThe string
63519261079SEd Maste.Dq forever
636*38a52bd3SEd Masteto indicate the certificate has no specified end time.
637*38a52bd3SEd Maste.It
638*38a52bd3SEd MasteA date or time in the system time zone formatted as YYYYMMDD or
639*38a52bd3SEd MasteYYYYMMDDHHMM[SS].
640*38a52bd3SEd Maste.It
641*38a52bd3SEd MasteA date or time in the UTC time zone as YYYYMMDDZ or YYYYMMDDHHMM[SS]Z.
642*38a52bd3SEd Maste.It
643*38a52bd3SEd MasteA relative time after the current system time consisting of a plus sign
644*38a52bd3SEd Mastefollowed by an interval in the format described in the
645*38a52bd3SEd MasteTIME FORMATS section of
646*38a52bd3SEd Maste.Xr sshd_config 5 .
647*38a52bd3SEd Maste.It
648*38a52bd3SEd MasteA raw seconds since epoch (Jan 1 1970 00:00:00 UTC) as a hexadecimal
649*38a52bd3SEd Mastenumber beginning with
650*38a52bd3SEd Maste.Dq 0x .
651*38a52bd3SEd Maste.El
65219261079SEd Maste.Pp
65319261079SEd MasteFor example:
654*38a52bd3SEd Maste.Bl -tag -width Ds
655*38a52bd3SEd Maste.It +52w1d
656*38a52bd3SEd MasteValid from now to 52 weeks and one day from now.
657*38a52bd3SEd Maste.It -4w:+4w
658*38a52bd3SEd MasteValid from four weeks ago to four weeks from now.
659*38a52bd3SEd Maste.It 20100101123000:20110101123000
660*38a52bd3SEd MasteValid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011.
661*38a52bd3SEd Maste.It 20100101123000Z:20110101123000Z
662*38a52bd3SEd MasteSimilar, but interpreted in the UTC time zone rather than the system time zone.
663*38a52bd3SEd Maste.It -1d:20110101
664*38a52bd3SEd MasteValid from yesterday to midnight, January 1st, 2011.
665*38a52bd3SEd Maste.It 0x1:0x2000000000
666*38a52bd3SEd MasteValid from roughly early 1970 to May 2033.
667*38a52bd3SEd Maste.It -1m:forever
668*38a52bd3SEd MasteValid from one minute ago and never expiring.
669*38a52bd3SEd Maste.El
67019261079SEd Maste.It Fl v
67119261079SEd MasteVerbose mode.
67219261079SEd MasteCauses
67319261079SEd Maste.Nm
67419261079SEd Masteto print debugging messages about its progress.
67519261079SEd MasteThis is helpful for debugging moduli generation.
67619261079SEd MasteMultiple
67719261079SEd Maste.Fl v
67819261079SEd Masteoptions increase the verbosity.
67919261079SEd MasteThe maximum is 3.
68019261079SEd Maste.It Fl w Ar provider
68119261079SEd MasteSpecifies a path to a library that will be used when creating
68219261079SEd MasteFIDO authenticator-hosted keys, overriding the default of using
68319261079SEd Mastethe internal USB HID support.
68419261079SEd Maste.It Fl Y Cm find-principals
68519261079SEd MasteFind the principal(s) associated with the public key of a signature,
68619261079SEd Masteprovided using the
68719261079SEd Maste.Fl s
68819261079SEd Masteflag in an authorized signers file provided using the
68919261079SEd Maste.Fl f
69019261079SEd Masteflag.
69119261079SEd MasteThe format of the allowed signers file is documented in the
69219261079SEd Maste.Sx ALLOWED SIGNERS
69319261079SEd Mastesection below.
69419261079SEd MasteIf one or more matching principals are found, they are returned on
69519261079SEd Mastestandard output.
6961323ec57SEd Maste.It Fl Y Cm match-principals
6971323ec57SEd MasteFind principal matching the principal name provided using the
6981323ec57SEd Maste.Fl I
6991323ec57SEd Masteflag in the authorized signers file specified using the
7001323ec57SEd Maste.Fl f
7011323ec57SEd Masteflag.
7021323ec57SEd MasteIf one or more matching principals are found, they are returned on
7031323ec57SEd Mastestandard output.
70419261079SEd Maste.It Fl Y Cm check-novalidate
70519261079SEd MasteChecks that a signature generated using
70619261079SEd Maste.Nm
70719261079SEd Maste.Fl Y Cm sign
70819261079SEd Mastehas a valid structure.
70919261079SEd MasteThis does not validate if a signature comes from an authorized signer.
71019261079SEd MasteWhen testing a signature,
71119261079SEd Maste.Nm
71219261079SEd Masteaccepts a message on standard input and a signature namespace using
71319261079SEd Maste.Fl n .
71419261079SEd MasteA file containing the corresponding signature must also be supplied using the
71519261079SEd Maste.Fl s
71619261079SEd Masteflag.
71719261079SEd MasteSuccessful testing of the signature is signalled by
71819261079SEd Maste.Nm
71919261079SEd Mastereturning a zero exit status.
72019261079SEd Maste.It Fl Y Cm sign
72119261079SEd MasteCryptographically sign a file or some data using a SSH key.
72219261079SEd MasteWhen signing,
72319261079SEd Maste.Nm
72419261079SEd Masteaccepts zero or more files to sign on the command-line - if no files
72519261079SEd Masteare specified then
72619261079SEd Maste.Nm
72719261079SEd Mastewill sign data presented on standard input.
72819261079SEd MasteSignatures are written to the path of the input file with
72919261079SEd Maste.Dq .sig
73019261079SEd Masteappended, or to standard output if the message to be signed was read from
73119261079SEd Mastestandard input.
73219261079SEd Maste.Pp
73319261079SEd MasteThe key used for signing is specified using the
73419261079SEd Maste.Fl f
73519261079SEd Masteoption and may refer to either a private key, or a public key with the private
73619261079SEd Mastehalf available via
73719261079SEd Maste.Xr ssh-agent 1 .
73819261079SEd MasteAn additional signature namespace, used to prevent signature confusion across
73919261079SEd Mastedifferent domains of use (e.g. file signing vs email signing) must be provided
74019261079SEd Mastevia the
74119261079SEd Maste.Fl n
74219261079SEd Masteflag.
74319261079SEd MasteNamespaces are arbitrary strings, and may include:
74419261079SEd Maste.Dq file
74519261079SEd Mastefor file signing,
74619261079SEd Maste.Dq email
74719261079SEd Mastefor email signing.
74819261079SEd MasteFor custom uses, it is recommended to use names following a
74919261079SEd MasteNAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces.
75019261079SEd Maste.It Fl Y Cm verify
75119261079SEd MasteRequest to verify a signature generated using
75219261079SEd Maste.Nm
75319261079SEd Maste.Fl Y Cm sign
75419261079SEd Masteas described above.
75519261079SEd MasteWhen verifying a signature,
75619261079SEd Maste.Nm
75719261079SEd Masteaccepts a message on standard input and a signature namespace using
75819261079SEd Maste.Fl n .
75919261079SEd MasteA file containing the corresponding signature must also be supplied using the
76019261079SEd Maste.Fl s
76119261079SEd Masteflag, along with the identity of the signer using
76219261079SEd Maste.Fl I
76319261079SEd Masteand a list of allowed signers via the
76419261079SEd Maste.Fl f
76519261079SEd Masteflag.
76619261079SEd MasteThe format of the allowed signers file is documented in the
76719261079SEd Maste.Sx ALLOWED SIGNERS
76819261079SEd Mastesection below.
76919261079SEd MasteA file containing revoked keys can be passed using the
77019261079SEd Maste.Fl r
77119261079SEd Masteflag.
77219261079SEd MasteThe revocation file may be a KRL or a one-per-line list of public keys.
77319261079SEd MasteSuccessful verification by an authorized signer is signalled by
77419261079SEd Maste.Nm
77519261079SEd Mastereturning a zero exit status.
77619261079SEd Maste.It Fl y
77719261079SEd MasteThis option will read a private
77819261079SEd MasteOpenSSH format file and print an OpenSSH public key to stdout.
77919261079SEd Maste.It Fl Z Ar cipher
78019261079SEd MasteSpecifies the cipher to use for encryption when writing an OpenSSH-format
78119261079SEd Masteprivate key file.
78219261079SEd MasteThe list of available ciphers may be obtained using
78319261079SEd Maste.Qq ssh -Q cipher .
78419261079SEd MasteThe default is
78519261079SEd Maste.Dq aes256-ctr .
78619261079SEd Maste.It Fl z Ar serial_number
78719261079SEd MasteSpecifies a serial number to be embedded in the certificate to distinguish
78819261079SEd Mastethis certificate from others from the same CA.
78919261079SEd MasteIf the
79019261079SEd Maste.Ar serial_number
79119261079SEd Masteis prefixed with a
79219261079SEd Maste.Sq +
79319261079SEd Mastecharacter, then the serial number will be incremented for each certificate
79419261079SEd Mastesigned on a single command-line.
79519261079SEd MasteThe default serial number is zero.
79619261079SEd Maste.Pp
79719261079SEd MasteWhen generating a KRL, the
79819261079SEd Maste.Fl z
79919261079SEd Masteflag is used to specify a KRL version number.
80019261079SEd Maste.El
80119261079SEd Maste.Sh MODULI GENERATION
80219261079SEd Maste.Nm
80319261079SEd Mastemay be used to generate groups for the Diffie-Hellman Group Exchange
80419261079SEd Maste(DH-GEX) protocol.
80519261079SEd MasteGenerating these groups is a two-step process: first, candidate
80619261079SEd Masteprimes are generated using a fast, but memory intensive process.
80719261079SEd MasteThese candidate primes are then tested for suitability (a CPU-intensive
80819261079SEd Masteprocess).
80919261079SEd Maste.Pp
81019261079SEd MasteGeneration of primes is performed using the
81119261079SEd Maste.Fl M Cm generate
81219261079SEd Masteoption.
81319261079SEd MasteThe desired length of the primes may be specified by the
81419261079SEd Maste.Fl O Cm bits
81519261079SEd Masteoption.
81619261079SEd MasteFor example:
81719261079SEd Maste.Pp
81819261079SEd Maste.Dl # ssh-keygen -M generate -O bits=2048 moduli-2048.candidates
81919261079SEd Maste.Pp
82019261079SEd MasteBy default, the search for primes begins at a random point in the
82119261079SEd Mastedesired length range.
82219261079SEd MasteThis may be overridden using the
82319261079SEd Maste.Fl O Cm start
82419261079SEd Masteoption, which specifies a different start point (in hex).
82519261079SEd Maste.Pp
82619261079SEd MasteOnce a set of candidates have been generated, they must be screened for
82719261079SEd Mastesuitability.
82819261079SEd MasteThis may be performed using the
82919261079SEd Maste.Fl M Cm screen
83019261079SEd Masteoption.
83119261079SEd MasteIn this mode
83219261079SEd Maste.Nm
83319261079SEd Mastewill read candidates from standard input (or a file specified using the
83419261079SEd Maste.Fl f
83519261079SEd Masteoption).
83619261079SEd MasteFor example:
83719261079SEd Maste.Pp
83819261079SEd Maste.Dl # ssh-keygen -M screen -f moduli-2048.candidates moduli-2048
83919261079SEd Maste.Pp
84019261079SEd MasteBy default, each candidate will be subjected to 100 primality tests.
84119261079SEd MasteThis may be overridden using the
84219261079SEd Maste.Fl O Cm prime-tests
84319261079SEd Masteoption.
84419261079SEd MasteThe DH generator value will be chosen automatically for the
84519261079SEd Masteprime under consideration.
84619261079SEd MasteIf a specific generator is desired, it may be requested using the
84719261079SEd Maste.Fl O Cm generator
84819261079SEd Masteoption.
84919261079SEd MasteValid generator values are 2, 3, and 5.
85019261079SEd Maste.Pp
85119261079SEd MasteScreened DH groups may be installed in
85219261079SEd Maste.Pa /etc/moduli .
85319261079SEd MasteIt is important that this file contains moduli of a range of bit lengths.
85419261079SEd Maste.Pp
85519261079SEd MasteA number of options are available for moduli generation and screening via the
85619261079SEd Maste.Fl O
85719261079SEd Masteflag:
85819261079SEd Maste.Bl -tag -width Ds
85919261079SEd Maste.It Ic lines Ns = Ns Ar number
86019261079SEd MasteExit after screening the specified number of lines while performing DH
86119261079SEd Mastecandidate screening.
86219261079SEd Maste.It Ic start-line Ns = Ns Ar line-number
86319261079SEd MasteStart screening at the specified line number while performing DH candidate
86419261079SEd Mastescreening.
86519261079SEd Maste.It Ic checkpoint Ns = Ns Ar filename
86619261079SEd MasteWrite the last line processed to the specified file while performing DH
86719261079SEd Mastecandidate screening.
86819261079SEd MasteThis will be used to skip lines in the input file that have already been
86919261079SEd Masteprocessed if the job is restarted.
87019261079SEd Maste.It Ic memory Ns = Ns Ar mbytes
87119261079SEd MasteSpecify the amount of memory to use (in megabytes) when generating
87219261079SEd Mastecandidate moduli for DH-GEX.
87319261079SEd Maste.It Ic start Ns = Ns Ar hex-value
87419261079SEd MasteSpecify start point (in hex) when generating candidate moduli for DH-GEX.
87519261079SEd Maste.It Ic generator Ns = Ns Ar value
87619261079SEd MasteSpecify desired generator (in decimal) when testing candidate moduli for DH-GEX.
87719261079SEd Maste.El
87819261079SEd Maste.Sh CERTIFICATES
87919261079SEd Maste.Nm
88019261079SEd Mastesupports signing of keys to produce certificates that may be used for
88119261079SEd Masteuser or host authentication.
88219261079SEd MasteCertificates consist of a public key, some identity information, zero or
88319261079SEd Mastemore principal (user or host) names and a set of options that
88419261079SEd Masteare signed by a Certification Authority (CA) key.
88519261079SEd MasteClients or servers may then trust only the CA key and verify its signature
88619261079SEd Masteon a certificate rather than trusting many user/host keys.
88719261079SEd MasteNote that OpenSSH certificates are a different, and much simpler, format to
88819261079SEd Mastethe X.509 certificates used in
88919261079SEd Maste.Xr ssl 8 .
89019261079SEd Maste.Pp
89119261079SEd Maste.Nm
89219261079SEd Mastesupports two types of certificates: user and host.
89319261079SEd MasteUser certificates authenticate users to servers, whereas host certificates
89419261079SEd Masteauthenticate server hosts to users.
89519261079SEd MasteTo generate a user certificate:
89619261079SEd Maste.Pp
89719261079SEd Maste.Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
89819261079SEd Maste.Pp
89919261079SEd MasteThe resultant certificate will be placed in
90019261079SEd Maste.Pa /path/to/user_key-cert.pub .
90119261079SEd MasteA host certificate requires the
90219261079SEd Maste.Fl h
90319261079SEd Masteoption:
90419261079SEd Maste.Pp
90519261079SEd Maste.Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub
90619261079SEd Maste.Pp
90719261079SEd MasteThe host certificate will be output to
90819261079SEd Maste.Pa /path/to/host_key-cert.pub .
90919261079SEd Maste.Pp
91019261079SEd MasteIt is possible to sign using a CA key stored in a PKCS#11 token by
91119261079SEd Masteproviding the token library using
91219261079SEd Maste.Fl D
91319261079SEd Masteand identifying the CA key by providing its public half as an argument
91419261079SEd Masteto
91519261079SEd Maste.Fl s :
91619261079SEd Maste.Pp
91719261079SEd Maste.Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub
91819261079SEd Maste.Pp
91919261079SEd MasteSimilarly, it is possible for the CA key to be hosted in a
92019261079SEd Maste.Xr ssh-agent 1 .
92119261079SEd MasteThis is indicated by the
92219261079SEd Maste.Fl U
92319261079SEd Masteflag and, again, the CA key must be identified by its public half.
92419261079SEd Maste.Pp
92519261079SEd Maste.Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub
92619261079SEd Maste.Pp
92719261079SEd MasteIn all cases,
92819261079SEd Maste.Ar key_id
92919261079SEd Masteis a "key identifier" that is logged by the server when the certificate
93019261079SEd Masteis used for authentication.
93119261079SEd Maste.Pp
93219261079SEd MasteCertificates may be limited to be valid for a set of principal (user/host)
93319261079SEd Mastenames.
93419261079SEd MasteBy default, generated certificates are valid for all users or hosts.
93519261079SEd MasteTo generate a certificate for a specified set of principals:
93619261079SEd Maste.Pp
93719261079SEd Maste.Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
93819261079SEd Maste.Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub"
93919261079SEd Maste.Pp
94019261079SEd MasteAdditional limitations on the validity and use of user certificates may
94119261079SEd Mastebe specified through certificate options.
94219261079SEd MasteA certificate option may disable features of the SSH session, may be
94319261079SEd Mastevalid only when presented from particular source addresses or may
94419261079SEd Masteforce the use of a specific command.
94519261079SEd Maste.Pp
946e2f6069cSDag-Erling SmørgravThe options that are valid for user certificates are:
9474f52dfbbSDag-Erling Smørgrav.Pp
9484f52dfbbSDag-Erling Smørgrav.Bl -tag -width Ds -compact
9498ad9b54aSDag-Erling Smørgrav.It Ic clear
9508ad9b54aSDag-Erling SmørgravClear all enabled permissions.
9518ad9b54aSDag-Erling SmørgravThis is useful for clearing the default set of permissions so permissions may
9528ad9b54aSDag-Erling Smørgravbe added individually.
9534f52dfbbSDag-Erling Smørgrav.Pp
9544f52dfbbSDag-Erling Smørgrav.It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents
9554f52dfbbSDag-Erling Smørgrav.It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents
9564f52dfbbSDag-Erling SmørgravIncludes an arbitrary certificate critical option or extension.
9574f52dfbbSDag-Erling SmørgravThe specified
9584f52dfbbSDag-Erling Smørgrav.Ar name
9594f52dfbbSDag-Erling Smørgravshould include a domain suffix, e.g.\&
9604f52dfbbSDag-Erling Smørgrav.Dq name@example.com .
9614f52dfbbSDag-Erling SmørgravIf
9624f52dfbbSDag-Erling Smørgrav.Ar contents
9634f52dfbbSDag-Erling Smørgravis specified then it is included as the contents of the extension/option
9644f52dfbbSDag-Erling Smørgravencoded as a string, otherwise the extension/option is created with no
9654f52dfbbSDag-Erling Smørgravcontents (usually indicating a flag).
9664f52dfbbSDag-Erling SmørgravExtensions may be ignored by a client or server that does not recognise them,
9674f52dfbbSDag-Erling Smørgravwhereas unknown critical options will cause the certificate to be refused.
9684f52dfbbSDag-Erling Smørgrav.Pp
9698ad9b54aSDag-Erling Smørgrav.It Ic force-command Ns = Ns Ar command
9708ad9b54aSDag-Erling SmørgravForces the execution of
9718ad9b54aSDag-Erling Smørgrav.Ar command
9728ad9b54aSDag-Erling Smørgravinstead of any shell or command specified by the user when
9738ad9b54aSDag-Erling Smørgravthe certificate is used for authentication.
9744f52dfbbSDag-Erling Smørgrav.Pp
975b15c8340SDag-Erling Smørgrav.It Ic no-agent-forwarding
976b15c8340SDag-Erling SmørgravDisable
977b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1
978b15c8340SDag-Erling Smørgravforwarding (permitted by default).
9794f52dfbbSDag-Erling Smørgrav.Pp
980b15c8340SDag-Erling Smørgrav.It Ic no-port-forwarding
981b15c8340SDag-Erling SmørgravDisable port forwarding (permitted by default).
9824f52dfbbSDag-Erling Smørgrav.Pp
983b15c8340SDag-Erling Smørgrav.It Ic no-pty
984b15c8340SDag-Erling SmørgravDisable PTY allocation (permitted by default).
9854f52dfbbSDag-Erling Smørgrav.Pp
986b15c8340SDag-Erling Smørgrav.It Ic no-user-rc
987b15c8340SDag-Erling SmørgravDisable execution of
988b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc
989b15c8340SDag-Erling Smørgravby
990b15c8340SDag-Erling Smørgrav.Xr sshd 8
991b15c8340SDag-Erling Smørgrav(permitted by default).
9924f52dfbbSDag-Erling Smørgrav.Pp
9938ad9b54aSDag-Erling Smørgrav.It Ic no-x11-forwarding
9948ad9b54aSDag-Erling SmørgravDisable X11 forwarding (permitted by default).
9954f52dfbbSDag-Erling Smørgrav.Pp
996b15c8340SDag-Erling Smørgrav.It Ic permit-agent-forwarding
997b15c8340SDag-Erling SmørgravAllows
998b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1
999b15c8340SDag-Erling Smørgravforwarding.
10004f52dfbbSDag-Erling Smørgrav.Pp
1001b15c8340SDag-Erling Smørgrav.It Ic permit-port-forwarding
1002b15c8340SDag-Erling SmørgravAllows port forwarding.
10034f52dfbbSDag-Erling Smørgrav.Pp
1004b15c8340SDag-Erling Smørgrav.It Ic permit-pty
1005b15c8340SDag-Erling SmørgravAllows PTY allocation.
10064f52dfbbSDag-Erling Smørgrav.Pp
1007b15c8340SDag-Erling Smørgrav.It Ic permit-user-rc
1008b15c8340SDag-Erling SmørgravAllows execution of
1009b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc
1010b15c8340SDag-Erling Smørgravby
1011b15c8340SDag-Erling Smørgrav.Xr sshd 8 .
10124f52dfbbSDag-Erling Smørgrav.Pp
101347dd1d1bSDag-Erling Smørgrav.It Ic permit-X11-forwarding
10148ad9b54aSDag-Erling SmørgravAllows X11 forwarding.
10154f52dfbbSDag-Erling Smørgrav.Pp
101619261079SEd Maste.It Ic no-touch-required
101719261079SEd MasteDo not require signatures made using this key include demonstration
101819261079SEd Masteof user presence (e.g. by having the user touch the authenticator).
101919261079SEd MasteThis option only makes sense for the FIDO authenticator algorithms
102019261079SEd Maste.Cm ecdsa-sk
102119261079SEd Masteand
102219261079SEd Maste.Cm ed25519-sk .
102319261079SEd Maste.Pp
10248ad9b54aSDag-Erling Smørgrav.It Ic source-address Ns = Ns Ar address_list
10258ad9b54aSDag-Erling SmørgravRestrict the source addresses from which the certificate is considered valid.
1026b15c8340SDag-Erling SmørgravThe
1027b15c8340SDag-Erling Smørgrav.Ar address_list
1028b15c8340SDag-Erling Smørgravis a comma-separated list of one or more address/netmask pairs in CIDR
1029b15c8340SDag-Erling Smørgravformat.
103019261079SEd Maste.Pp
103119261079SEd Maste.It Ic verify-required
103219261079SEd MasteRequire signatures made using this key indicate that the user was first
103319261079SEd Masteverified.
103419261079SEd MasteThis option only makes sense for the FIDO authenticator algorithms
103519261079SEd Maste.Cm ecdsa-sk
103619261079SEd Masteand
103719261079SEd Maste.Cm ed25519-sk .
103819261079SEd MasteCurrently PIN authentication is the only supported verification method,
103919261079SEd Mastebut other methods may be supported in the future.
1040b15c8340SDag-Erling Smørgrav.El
10416888a9beSDag-Erling Smørgrav.Pp
104219261079SEd MasteAt present, no standard options are valid for host keys.
1043b15c8340SDag-Erling Smørgrav.Pp
1044b15c8340SDag-Erling SmørgravFinally, certificates may be defined with a validity lifetime.
1045b15c8340SDag-Erling SmørgravThe
1046b15c8340SDag-Erling Smørgrav.Fl V
1047b15c8340SDag-Erling Smørgravoption allows specification of certificate start and end times.
1048b15c8340SDag-Erling SmørgravA certificate that is presented at a time outside this range will not be
1049b15c8340SDag-Erling Smørgravconsidered valid.
105019261079SEd MasteBy default, certificates are valid from the
10516888a9beSDag-Erling Smørgrav.Ux
10526888a9beSDag-Erling SmørgravEpoch to the distant future.
1053b15c8340SDag-Erling Smørgrav.Pp
1054b15c8340SDag-Erling SmørgravFor certificates to be used for user or host authentication, the CA
1055b15c8340SDag-Erling Smørgravpublic key must be trusted by
1056b15c8340SDag-Erling Smørgrav.Xr sshd 8
1057b15c8340SDag-Erling Smørgravor
1058b15c8340SDag-Erling Smørgrav.Xr ssh 1 .
10591323ec57SEd MasteRefer to those manual pages for details.
1060*38a52bd3SEd Maste.Sh FIDO AUTHENTICATOR
1061*38a52bd3SEd Maste.Nm
1062*38a52bd3SEd Masteis able to generate FIDO authenticator-backed keys, after which
1063*38a52bd3SEd Mastethey may be used much like any other key type supported by OpenSSH, so
1064*38a52bd3SEd Mastelong as the hardware authenticator is attached when the keys are used.
1065*38a52bd3SEd MasteFIDO authenticators generally require the user to explicitly authorise
1066*38a52bd3SEd Masteoperations by touching or tapping them.
1067*38a52bd3SEd MasteFIDO keys consist of two parts: a key handle part stored in the
1068*38a52bd3SEd Masteprivate key file on disk, and a per-device private key that is unique
1069*38a52bd3SEd Masteto each FIDO authenticator and that cannot be exported from the
1070*38a52bd3SEd Masteauthenticator hardware.
1071*38a52bd3SEd MasteThese are combined by the hardware at authentication time to derive
1072*38a52bd3SEd Mastethe real key that is used to sign authentication challenges.
1073*38a52bd3SEd MasteSupported key types are
1074*38a52bd3SEd Maste.Cm ecdsa-sk
1075*38a52bd3SEd Masteand
1076*38a52bd3SEd Maste.Cm ed25519-sk .
1077*38a52bd3SEd Maste.Pp
1078*38a52bd3SEd MasteThe options that are valid for FIDO keys are:
1079*38a52bd3SEd Maste.Bl -tag -width Ds
1080*38a52bd3SEd Maste.It Cm application
1081*38a52bd3SEd MasteOverride the default FIDO application/origin string of
1082*38a52bd3SEd Maste.Dq ssh: .
1083*38a52bd3SEd MasteThis may be useful when generating host or domain-specific resident keys.
1084*38a52bd3SEd MasteThe specified application string must begin with
1085*38a52bd3SEd Maste.Dq ssh: .
1086*38a52bd3SEd Maste.It Cm challenge Ns = Ns Ar path
1087*38a52bd3SEd MasteSpecifies a path to a challenge string that will be passed to the
1088*38a52bd3SEd MasteFIDO authenticator during key generation.
1089*38a52bd3SEd MasteThe challenge string may be used as part of an out-of-band
1090*38a52bd3SEd Masteprotocol for key enrollment
1091*38a52bd3SEd Maste(a random challenge is used by default).
1092*38a52bd3SEd Maste.It Cm device
1093*38a52bd3SEd MasteExplicitly specify a
1094*38a52bd3SEd Maste.Xr fido 4
1095*38a52bd3SEd Mastedevice to use, rather than letting the authenticator middleware select one.
1096*38a52bd3SEd Maste.It Cm no-touch-required
1097*38a52bd3SEd MasteIndicate that the generated private key should not require touch
1098*38a52bd3SEd Masteevents (user presence) when making signatures.
1099*38a52bd3SEd MasteNote that
1100*38a52bd3SEd Maste.Xr sshd 8
1101*38a52bd3SEd Mastewill refuse such signatures by default, unless overridden via
1102*38a52bd3SEd Mastean authorized_keys option.
1103*38a52bd3SEd Maste.It Cm resident
1104*38a52bd3SEd MasteIndicate that the key handle should be stored on the FIDO
1105*38a52bd3SEd Masteauthenticator itself.
1106*38a52bd3SEd MasteThis makes it easier to use the authenticator on multiple computers.
1107*38a52bd3SEd MasteResident keys may be supported on FIDO2 authenticators and typically
1108*38a52bd3SEd Masterequire that a PIN be set on the authenticator prior to generation.
1109*38a52bd3SEd MasteResident keys may be loaded off the authenticator using
1110*38a52bd3SEd Maste.Xr ssh-add 1 .
1111*38a52bd3SEd MasteStoring both parts of a key on a FIDO authenticator increases the likelihood
1112*38a52bd3SEd Masteof an attacker being able to use a stolen authenticator device.
1113*38a52bd3SEd Maste.It Cm user
1114*38a52bd3SEd MasteA username to be associated with a resident key,
1115*38a52bd3SEd Masteoverriding the empty default username.
1116*38a52bd3SEd MasteSpecifying a username may be useful when generating multiple resident keys
1117*38a52bd3SEd Mastefor the same application name.
1118*38a52bd3SEd Maste.It Cm verify-required
1119*38a52bd3SEd MasteIndicate that this private key should require user verification for
1120*38a52bd3SEd Masteeach signature.
1121*38a52bd3SEd MasteNot all FIDO authenticators support this option.
1122*38a52bd3SEd MasteCurrently PIN authentication is the only supported verification method,
1123*38a52bd3SEd Mastebut other methods may be supported in the future.
1124*38a52bd3SEd Maste.It Cm write-attestation Ns = Ns Ar path
1125*38a52bd3SEd MasteMay be used at key generation time to record the attestation data
1126*38a52bd3SEd Mastereturned from FIDO authenticators during key generation.
1127*38a52bd3SEd MasteThis information is potentially sensitive.
1128*38a52bd3SEd MasteBy default, this information is discarded.
1129*38a52bd3SEd Maste.El
11306888a9beSDag-Erling Smørgrav.Sh KEY REVOCATION LISTS
11316888a9beSDag-Erling Smørgrav.Nm
11326888a9beSDag-Erling Smørgravis able to manage OpenSSH format Key Revocation Lists (KRLs).
11336888a9beSDag-Erling SmørgravThese binary files specify keys or certificates to be revoked using a
1134f7167e0eSDag-Erling Smørgravcompact format, taking as little as one bit per certificate if they are being
11356888a9beSDag-Erling Smørgravrevoked by serial number.
11366888a9beSDag-Erling Smørgrav.Pp
11376888a9beSDag-Erling SmørgravKRLs may be generated using the
11386888a9beSDag-Erling Smørgrav.Fl k
11396888a9beSDag-Erling Smørgravflag.
11406888a9beSDag-Erling SmørgravThis option reads one or more files from the command line and generates a new
11416888a9beSDag-Erling SmørgravKRL.
11426888a9beSDag-Erling SmørgravThe files may either contain a KRL specification (see below) or public keys,
11436888a9beSDag-Erling Smørgravlisted one per line.
11446888a9beSDag-Erling SmørgravPlain public keys are revoked by listing their hash or contents in the KRL and
11456888a9beSDag-Erling Smørgravcertificates revoked by serial number or key ID (if the serial is zero or
11466888a9beSDag-Erling Smørgravnot available).
11476888a9beSDag-Erling Smørgrav.Pp
11486888a9beSDag-Erling SmørgravRevoking keys using a KRL specification offers explicit control over the
11496888a9beSDag-Erling Smørgravtypes of record used to revoke keys and may be used to directly revoke
11506888a9beSDag-Erling Smørgravcertificates by serial number or key ID without having the complete original
11516888a9beSDag-Erling Smørgravcertificate on hand.
11526888a9beSDag-Erling SmørgravA KRL specification consists of lines containing one of the following directives
11536888a9beSDag-Erling Smørgravfollowed by a colon and some directive-specific information.
11546888a9beSDag-Erling Smørgrav.Bl -tag -width Ds
11556888a9beSDag-Erling Smørgrav.It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number
11566888a9beSDag-Erling SmørgravRevokes a certificate with the specified serial number.
11576888a9beSDag-Erling SmørgravSerial numbers are 64-bit values, not including zero and may be expressed
11586888a9beSDag-Erling Smørgravin decimal, hex or octal.
11596888a9beSDag-Erling SmørgravIf two serial numbers are specified separated by a hyphen, then the range
11606888a9beSDag-Erling Smørgravof serial numbers including and between each is revoked.
11616888a9beSDag-Erling SmørgravThe CA key must have been specified on the
11626888a9beSDag-Erling Smørgrav.Nm
11636888a9beSDag-Erling Smørgravcommand line using the
11646888a9beSDag-Erling Smørgrav.Fl s
11656888a9beSDag-Erling Smørgravoption.
11666888a9beSDag-Erling Smørgrav.It Cm id : Ar key_id
11676888a9beSDag-Erling SmørgravRevokes a certificate with the specified key ID string.
11686888a9beSDag-Erling SmørgravThe CA key must have been specified on the
11696888a9beSDag-Erling Smørgrav.Nm
11706888a9beSDag-Erling Smørgravcommand line using the
11716888a9beSDag-Erling Smørgrav.Fl s
11726888a9beSDag-Erling Smørgravoption.
11736888a9beSDag-Erling Smørgrav.It Cm key : Ar public_key
11746888a9beSDag-Erling SmørgravRevokes the specified key.
11756888a9beSDag-Erling SmørgravIf a certificate is listed, then it is revoked as a plain public key.
11766888a9beSDag-Erling Smørgrav.It Cm sha1 : Ar public_key
11772f513db7SEd MasteRevokes the specified key by including its SHA1 hash in the KRL.
11782f513db7SEd Maste.It Cm sha256 : Ar public_key
11792f513db7SEd MasteRevokes the specified key by including its SHA256 hash in the KRL.
11802f513db7SEd MasteKRLs that revoke keys by SHA256 hash are not supported by OpenSSH versions
11812f513db7SEd Masteprior to 7.9.
11822f513db7SEd Maste.It Cm hash : Ar fingerprint
11832f513db7SEd MasteRevokes a key using a fingerprint hash, as obtained from a
11842f513db7SEd Maste.Xr sshd 8
11852f513db7SEd Masteauthentication log message or the
11862f513db7SEd Maste.Nm
11872f513db7SEd Maste.Fl l
11882f513db7SEd Masteflag.
11892f513db7SEd MasteOnly SHA256 fingerprints are supported here and resultant KRLs are
11902f513db7SEd Mastenot supported by OpenSSH versions prior to 7.9.
11916888a9beSDag-Erling Smørgrav.El
11926888a9beSDag-Erling Smørgrav.Pp
11936888a9beSDag-Erling SmørgravKRLs may be updated using the
11946888a9beSDag-Erling Smørgrav.Fl u
11956888a9beSDag-Erling Smørgravflag in addition to
11966888a9beSDag-Erling Smørgrav.Fl k .
11976888a9beSDag-Erling SmørgravWhen this option is specified, keys listed via the command line are merged into
11986888a9beSDag-Erling Smørgravthe KRL, adding to those already there.
11996888a9beSDag-Erling Smørgrav.Pp
12006888a9beSDag-Erling SmørgravIt is also possible, given a KRL, to test whether it revokes a particular key
12016888a9beSDag-Erling Smørgrav(or keys).
12026888a9beSDag-Erling SmørgravThe
12036888a9beSDag-Erling Smørgrav.Fl Q
12046888a9beSDag-Erling Smørgravflag will query an existing KRL, testing each key specified on the command line.
12056888a9beSDag-Erling SmørgravIf any key listed on the command line has been revoked (or an error encountered)
12066888a9beSDag-Erling Smørgravthen
12076888a9beSDag-Erling Smørgrav.Nm
12086888a9beSDag-Erling Smørgravwill exit with a non-zero exit status.
12096888a9beSDag-Erling SmørgravA zero exit status will only be returned if no key was revoked.
121019261079SEd Maste.Sh ALLOWED SIGNERS
121119261079SEd MasteWhen verifying signatures,
121219261079SEd Maste.Nm
121319261079SEd Masteuses a simple list of identities and keys to determine whether a signature
121419261079SEd Mastecomes from an authorized source.
121519261079SEd MasteThis "allowed signers" file uses a format patterned after the
121619261079SEd MasteAUTHORIZED_KEYS FILE FORMAT described in
121719261079SEd Maste.Xr sshd 8 .
121819261079SEd MasteEach line of the file contains the following space-separated fields:
121919261079SEd Masteprincipals, options, keytype, base64-encoded key.
122019261079SEd MasteEmpty lines and lines starting with a
122119261079SEd Maste.Ql #
122219261079SEd Masteare ignored as comments.
122319261079SEd Maste.Pp
122419261079SEd MasteThe principals field is a pattern-list (see PATTERNS in
122519261079SEd Maste.Xr ssh_config 5 )
122619261079SEd Masteconsisting of one or more comma-separated USER@DOMAIN identity patterns
122719261079SEd Mastethat are accepted for signing.
122819261079SEd MasteWhen verifying, the identity presented via the
122919261079SEd Maste.Fl I
123019261079SEd Masteoption must match a principals pattern in order for the corresponding key to be
123119261079SEd Masteconsidered acceptable for verification.
123219261079SEd Maste.Pp
123319261079SEd MasteThe options (if present) consist of comma-separated option specifications.
123419261079SEd MasteNo spaces are permitted, except within double quotes.
123519261079SEd MasteThe following option specifications are supported (note that option keywords
123619261079SEd Masteare case-insensitive):
123719261079SEd Maste.Bl -tag -width Ds
123819261079SEd Maste.It Cm cert-authority
123919261079SEd MasteIndicates that this key is accepted as a certificate authority (CA) and
124019261079SEd Mastethat certificates signed by this CA may be accepted for verification.
124119261079SEd Maste.It Cm namespaces Ns = Ns "namespace-list"
124219261079SEd MasteSpecifies a pattern-list of namespaces that are accepted for this key.
124319261079SEd MasteIf this option is present, the signature namespace embedded in the
124419261079SEd Mastesignature object and presented on the verification command-line must
124519261079SEd Mastematch the specified list before the key will be considered acceptable.
124619261079SEd Maste.It Cm valid-after Ns = Ns "timestamp"
124719261079SEd MasteIndicates that the key is valid for use at or after the specified timestamp,
1248*38a52bd3SEd Mastewhich may be a date or time in the YYYYMMDD[Z] or YYYYMMDDHHMM[SS][Z] formats.
1249*38a52bd3SEd MasteDates and times will be interpreted in the current system time zone unless
1250*38a52bd3SEd Mastesuffixed with a Z character, which causes them to be interpreted in the UTC
1251*38a52bd3SEd Mastetime zone.
125219261079SEd Maste.It Cm valid-before Ns = Ns "timestamp"
125319261079SEd MasteIndicates that the key is valid for use at or before the specified timestamp.
125419261079SEd Maste.El
125519261079SEd Maste.Pp
125619261079SEd MasteWhen verifying signatures made by certificates, the expected principal
125719261079SEd Mastename must match both the principals pattern in the allowed signers file and
125819261079SEd Mastethe principals embedded in the certificate itself.
125919261079SEd Maste.Pp
126019261079SEd MasteAn example allowed signers file:
126119261079SEd Maste.Bd -literal -offset 3n
126219261079SEd Maste# Comments allowed at start of line
126319261079SEd Masteuser1@example.com,user2@example.com ssh-rsa AAAAX1...
126419261079SEd Maste# A certificate authority, trusted for all principals in a domain.
126519261079SEd Maste*@example.com cert-authority ssh-ed25519 AAAB4...
126619261079SEd Maste# A key that is accepted only for file signing.
126719261079SEd Masteuser2@example.com namespaces="file" ssh-ed25519 AAA41...
126819261079SEd Maste.Ed
126919261079SEd Maste.Sh ENVIRONMENT
127019261079SEd Maste.Bl -tag -width Ds
127119261079SEd Maste.It Ev SSH_SK_PROVIDER
127219261079SEd MasteSpecifies a path to a library that will be used when loading any
127319261079SEd MasteFIDO authenticator-hosted keys, overriding the default of using
127419261079SEd Mastethe built-in USB HID support.
127519261079SEd Maste.El
1276511b41d2SMark Murray.Sh FILES
12774a421b63SDag-Erling Smørgrav.Bl -tag -width Ds -compact
1278043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa
12794a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa
128019261079SEd Maste.It Pa ~/.ssh/id_ecdsa_sk
1281f7167e0eSDag-Erling Smørgrav.It Pa ~/.ssh/id_ed25519
128219261079SEd Maste.It Pa ~/.ssh/id_ed25519_sk
1283043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa
128419261079SEd MasteContains the DSA, ECDSA, authenticator-hosted ECDSA, Ed25519,
128519261079SEd Masteauthenticator-hosted Ed25519 or RSA authentication identity of the user.
12861e8db6e2SBrian FeldmanThis file should not be readable by anyone but the user.
12871e8db6e2SBrian FeldmanIt is possible to
12881e8db6e2SBrian Feldmanspecify a passphrase when generating the key; that passphrase will be
1289b15c8340SDag-Erling Smørgravused to encrypt the private part of this file using 128-bit AES.
12901e8db6e2SBrian FeldmanThis file is not automatically accessed by
12911e8db6e2SBrian Feldman.Nm
12921e8db6e2SBrian Feldmanbut it is offered as the default file for the private key.
1293ae1f160dSDag-Erling Smørgrav.Xr ssh 1
12941e8db6e2SBrian Feldmanwill read this file when a login attempt is made.
12954a421b63SDag-Erling Smørgrav.Pp
12964a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa.pub
12974a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa.pub
129819261079SEd Maste.It Pa ~/.ssh/id_ecdsa_sk.pub
1299f7167e0eSDag-Erling Smørgrav.It Pa ~/.ssh/id_ed25519.pub
130019261079SEd Maste.It Pa ~/.ssh/id_ed25519_sk.pub
1301043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa.pub
130219261079SEd MasteContains the DSA, ECDSA, authenticator-hosted ECDSA, Ed25519,
130319261079SEd Masteauthenticator-hosted Ed25519 or RSA public key for authentication.
13041e8db6e2SBrian FeldmanThe contents of this file should be added to
1305043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys
13061e8db6e2SBrian Feldmanon all machines
1307ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication.
1308a04a10f8SKris KennawayThere is no need to keep the contents of this file secret.
13094a421b63SDag-Erling Smørgrav.Pp
1310d95e11bfSDag-Erling Smørgrav.It Pa /etc/moduli
1311d95e11bfSDag-Erling SmørgravContains Diffie-Hellman groups used for DH-GEX.
1312d95e11bfSDag-Erling SmørgravThe file format is described in
1313d95e11bfSDag-Erling Smørgrav.Xr moduli 5 .
1314b66f2d16SKris Kennaway.El
1315511b41d2SMark Murray.Sh SEE ALSO
1316511b41d2SMark Murray.Xr ssh 1 ,
1317511b41d2SMark Murray.Xr ssh-add 1 ,
1318511b41d2SMark Murray.Xr ssh-agent 1 ,
1319d95e11bfSDag-Erling Smørgrav.Xr moduli 5 ,
13201e8db6e2SBrian Feldman.Xr sshd 8
13211e8db6e2SBrian Feldman.Rs
1322d4af9e69SDag-Erling Smørgrav.%R RFC 4716
1323d4af9e69SDag-Erling Smørgrav.%T "The Secure Shell (SSH) Public Key File Format"
1324d4af9e69SDag-Erling Smørgrav.%D 2006
13251e8db6e2SBrian Feldman.Re
1326d95e11bfSDag-Erling Smørgrav.Sh AUTHORS
1327d95e11bfSDag-Erling SmørgravOpenSSH is a derivative of the original and free
1328d95e11bfSDag-Erling Smørgravssh 1.2.12 release by Tatu Ylonen.
1329d95e11bfSDag-Erling SmørgravAaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1330d95e11bfSDag-Erling SmørgravTheo de Raadt and Dug Song
1331d95e11bfSDag-Erling Smørgravremoved many bugs, re-added newer features and
1332d95e11bfSDag-Erling Smørgravcreated OpenSSH.
1333d95e11bfSDag-Erling SmørgravMarkus Friedl contributed the support for SSH
1334d95e11bfSDag-Erling Smørgravprotocol versions 1.5 and 2.0.
1335