xref: /freebsd/crypto/openssh/ssh-keygen.1 (revision 3d9fd9fcb432750f3716b28f6ccb0104cd9d351a)
1*3d9fd9fcSEd Maste.\"	$OpenBSD: ssh-keygen.1,v 1.233 2024/08/17 08:35:04 djm 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*3d9fd9fcSEd Maste.Dd $Mdocdate: August 17 2024 $
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
540fdf8faeSEd Maste.Op Fl t Cm 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
188c9315099SEd Mastewill generate an Ed25519 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
2084a421b63SDag-Erling Smørgrav.Pa ~/.ssh/id_ecdsa ,
20919261079SEd Maste.Pa ~/.ssh/id_ecdsa_sk ,
21019261079SEd Maste.Pa ~/.ssh/id_ed25519 ,
21119261079SEd Maste.Pa ~/.ssh/id_ed25519_sk
212a04a10f8SKris Kennawayor
213043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_rsa .
214a04a10f8SKris KennawayAdditionally, the system administrator may use this to generate host keys,
215a04a10f8SKris Kennawayas seen in
216a04a10f8SKris Kennaway.Pa /etc/rc .
217511b41d2SMark Murray.Pp
218511b41d2SMark MurrayNormally this program generates the key and asks for a file in which
219a8f6863aSKris Kennawayto store the private key.
220a8f6863aSKris KennawayThe public key is stored in a file with the same name but
221511b41d2SMark Murray.Dq .pub
222a8f6863aSKris Kennawayappended.
223a8f6863aSKris KennawayThe program also asks for a passphrase.
224a8f6863aSKris KennawayThe passphrase may be empty to indicate no passphrase
2251e8db6e2SBrian Feldman(host keys must have an empty passphrase), or it may be a string of
226a8f6863aSKris Kennawayarbitrary length.
227ae1f160dSDag-Erling SmørgravA passphrase is similar to a password, except it can be a phrase with a
228ae1f160dSDag-Erling Smørgravseries of words, punctuation, numbers, whitespace, or any string of
229ae1f160dSDag-Erling Smørgravcharacters you want.
230ae1f160dSDag-Erling SmørgravGood passphrases are 10-30 characters long, are
231511b41d2SMark Murraynot simple sentences or otherwise easily guessable (English
232ae1f160dSDag-Erling Smørgravprose has only 1-2 bits of entropy per character, and provides very bad
233ae1f160dSDag-Erling Smørgravpassphrases), and contain a mix of upper and lowercase letters,
234ae1f160dSDag-Erling Smørgravnumbers, and non-alphanumeric characters.
235a8f6863aSKris KennawayThe passphrase can be changed later by using the
236511b41d2SMark Murray.Fl p
237511b41d2SMark Murrayoption.
238511b41d2SMark Murray.Pp
239a8f6863aSKris KennawayThere is no way to recover a lost passphrase.
240e146993eSDag-Erling SmørgravIf the passphrase is lost or forgotten, a new key must be generated
241e146993eSDag-Erling Smørgravand the corresponding public key copied to other machines.
242511b41d2SMark Murray.Pp
24319261079SEd Maste.Nm
24419261079SEd Mastewill by default write keys in an OpenSSH-specific format.
24519261079SEd MasteThis format is preferred as it offers better protection for
24619261079SEd Mastekeys at rest as well as allowing storage of key comments within
24719261079SEd Mastethe private key file itself.
24819261079SEd MasteThe key comment may be useful to help identify the key.
249a8f6863aSKris KennawayThe comment is initialized to
250511b41d2SMark Murray.Dq user@host
251511b41d2SMark Murraywhen the key is created, but can be changed using the
252511b41d2SMark Murray.Fl c
253511b41d2SMark Murrayoption.
254511b41d2SMark Murray.Pp
25519261079SEd MasteIt is still possible for
25619261079SEd Maste.Nm
25719261079SEd Masteto write the previously-used PEM format private keys using the
25819261079SEd Maste.Fl m
25919261079SEd Masteflag.
26019261079SEd MasteThis may be used when generating new keys, and existing new-format
26119261079SEd Mastekeys may be converted using this option in conjunction with the
26219261079SEd Maste.Fl p
26319261079SEd Maste(change passphrase) flag.
26419261079SEd Maste.Pp
26519261079SEd MasteAfter a key is generated,
26619261079SEd Maste.Nm
26719261079SEd Mastewill ask where the keys
268a04a10f8SKris Kennawayshould be placed to be activated.
269a04a10f8SKris Kennaway.Pp
270511b41d2SMark MurrayThe options are as follows:
271511b41d2SMark Murray.Bl -tag -width Ds
272e146993eSDag-Erling Smørgrav.It Fl A
27338a52bd3SEd MasteGenerate host keys of all default key types (rsa, ecdsa, and
27438a52bd3SEd Masteed25519) if they do not already exist.
27538a52bd3SEd MasteThe host keys are generated with the default key file path,
276e146993eSDag-Erling Smørgravan empty passphrase, default bits for the key type, and default comment.
2774f52dfbbSDag-Erling SmørgravIf
2784f52dfbbSDag-Erling Smørgrav.Fl f
2794f52dfbbSDag-Erling Smørgravhas also been specified, its argument is used as a prefix to the
2804f52dfbbSDag-Erling Smørgravdefault path for the resulting host key files.
281e146993eSDag-Erling SmørgravThis is used by
282e146993eSDag-Erling Smørgrav.Pa /etc/rc
283e146993eSDag-Erling Smørgravto generate new host keys.
284f7167e0eSDag-Erling Smørgrav.It Fl a Ar rounds
28519261079SEd MasteWhen saving a private key, this option specifies the number of KDF
28619261079SEd Maste(key derivation function, currently
28719261079SEd Maste.Xr bcrypt_pbkdf 3 )
28819261079SEd Masterounds used.
289f7167e0eSDag-Erling SmørgravHigher numbers result in slower passphrase verification and increased
290f7167e0eSDag-Erling Smørgravresistance to brute-force password cracking (should the keys be stolen).
29119261079SEd MasteThe default is 16 rounds.
2925e8dbd04SDag-Erling Smørgrav.It Fl B
2935e8dbd04SDag-Erling SmørgravShow the bubblebabble digest of specified private or public key file.
294511b41d2SMark Murray.It Fl b Ar bits
295a8f6863aSKris KennawaySpecifies the number of bits in the key to create.
29619261079SEd MasteFor RSA keys, the minimum size is 1024 bits and the default is 3072 bits.
29719261079SEd MasteGenerally, 3072 bits is considered sufficient.
298e146993eSDag-Erling SmørgravFor ECDSA keys, the
299e146993eSDag-Erling Smørgrav.Fl b
300462c32cbSDag-Erling Smørgravflag determines the key length by selecting from one of three elliptic
301e146993eSDag-Erling Smørgravcurve sizes: 256, 384 or 521 bits.
302e146993eSDag-Erling SmørgravAttempting to use bit lengths other than these three values for ECDSA keys
303e146993eSDag-Erling Smørgravwill fail.
30419261079SEd MasteECDSA-SK, Ed25519 and Ed25519-SK keys have a fixed length and the
305f7167e0eSDag-Erling Smørgrav.Fl b
306f7167e0eSDag-Erling Smørgravflag will be ignored.
3075e8dbd04SDag-Erling Smørgrav.It Fl C Ar comment
3085e8dbd04SDag-Erling SmørgravProvides a new comment.
309511b41d2SMark Murray.It Fl c
310511b41d2SMark MurrayRequests changing the comment in the private and public key files.
311511b41d2SMark MurrayThe program will prompt for the file containing the private keys, for
312ae1f160dSDag-Erling Smørgravthe passphrase if the key has one, and for the new comment.
313b15c8340SDag-Erling Smørgrav.It Fl D Ar pkcs11
31419261079SEd MasteDownload the public keys provided by the PKCS#11 shared library
315b15c8340SDag-Erling Smørgrav.Ar pkcs11 .
316e2f6069cSDag-Erling SmørgravWhen used in combination with
317e2f6069cSDag-Erling Smørgrav.Fl s ,
318e2f6069cSDag-Erling Smørgravthis option indicates that a CA key resides in a PKCS#11 token (see the
319e2f6069cSDag-Erling Smørgrav.Sx CERTIFICATES
320e2f6069cSDag-Erling Smørgravsection for details).
321bc5531deSDag-Erling Smørgrav.It Fl E Ar fingerprint_hash
322bc5531deSDag-Erling SmørgravSpecifies the hash algorithm used when displaying key fingerprints.
323bc5531deSDag-Erling SmørgravValid options are:
324bc5531deSDag-Erling Smørgrav.Dq md5
325bc5531deSDag-Erling Smørgravand
326bc5531deSDag-Erling Smørgrav.Dq sha256 .
327bc5531deSDag-Erling SmørgravThe default is
328bc5531deSDag-Erling Smørgrav.Dq sha256 .
3291e8db6e2SBrian Feldman.It Fl e
3301e8db6e2SBrian FeldmanThis option will read a private or public OpenSSH key file and
33119261079SEd Masteprint to stdout a public key in one of the formats specified by the
332e2f6069cSDag-Erling Smørgrav.Fl m
333e2f6069cSDag-Erling Smørgravoption.
334e2f6069cSDag-Erling SmørgravThe default export format is
335e2f6069cSDag-Erling Smørgrav.Dq RFC4716 .
336e2f6069cSDag-Erling SmørgravThis option allows exporting OpenSSH keys for use by other programs, including
337e2f6069cSDag-Erling Smørgravseveral commercial SSH implementations.
33819261079SEd Maste.It Fl F Ar hostname | [hostname]:port
3395e8dbd04SDag-Erling SmørgravSearch for the specified
3405e8dbd04SDag-Erling Smørgrav.Ar hostname
34119261079SEd Maste(with optional port number)
3425e8dbd04SDag-Erling Smørgravin a
3435e8dbd04SDag-Erling Smørgrav.Pa known_hosts
3445e8dbd04SDag-Erling Smørgravfile, listing any occurrences found.
3455e8dbd04SDag-Erling SmørgravThis option is useful to find hashed host names or addresses and may also be
3465e8dbd04SDag-Erling Smørgravused in conjunction with the
3475e8dbd04SDag-Erling Smørgrav.Fl H
3485e8dbd04SDag-Erling Smørgravoption to print found keys in a hashed format.
3495e8dbd04SDag-Erling Smørgrav.It Fl f Ar filename
3505e8dbd04SDag-Erling SmørgravSpecifies the filename of the key file.
351d95e11bfSDag-Erling Smørgrav.It Fl g
352d74d50a8SDag-Erling SmørgravUse generic DNS format when printing fingerprint resource records using the
353d74d50a8SDag-Erling Smørgrav.Fl r
354d74d50a8SDag-Erling Smørgravcommand.
3555e8dbd04SDag-Erling Smørgrav.It Fl H
3565e8dbd04SDag-Erling SmørgravHash a
3575e8dbd04SDag-Erling Smørgrav.Pa known_hosts
3584518870cSDag-Erling Smørgravfile.
3594518870cSDag-Erling SmørgravThis replaces all hostnames and addresses with hashed representations
3604518870cSDag-Erling Smørgravwithin the specified file; the original content is moved to a file with
3614518870cSDag-Erling Smørgrava .old suffix.
3625e8dbd04SDag-Erling SmørgravThese hashes may be used normally by
3635e8dbd04SDag-Erling Smørgrav.Nm ssh
3645e8dbd04SDag-Erling Smørgravand
3655e8dbd04SDag-Erling Smørgrav.Nm sshd ,
3665e8dbd04SDag-Erling Smørgravbut they do not reveal identifying information should the file's contents
3675e8dbd04SDag-Erling Smørgravbe disclosed.
3685e8dbd04SDag-Erling SmørgravThis option will not modify existing hashed hostnames and is therefore safe
3695e8dbd04SDag-Erling Smørgravto use on files that mix hashed and non-hashed names.
370b15c8340SDag-Erling Smørgrav.It Fl h
371b15c8340SDag-Erling SmørgravWhen signing a key, create a host certificate instead of a user
372b15c8340SDag-Erling Smørgravcertificate.
3731323ec57SEd MasteSee the
374b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
375b15c8340SDag-Erling Smørgravsection for details.
376b15c8340SDag-Erling Smørgrav.It Fl I Ar certificate_identity
377b15c8340SDag-Erling SmørgravSpecify the key identity when signing a public key.
3781323ec57SEd MasteSee the
379b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
380b15c8340SDag-Erling Smørgravsection for details.
3811e8db6e2SBrian Feldman.It Fl i
3821e8db6e2SBrian FeldmanThis option will read an unencrypted private (or public) key file
383e2f6069cSDag-Erling Smørgravin the format specified by the
384e2f6069cSDag-Erling Smørgrav.Fl m
385e2f6069cSDag-Erling Smørgravoption and print an OpenSSH compatible private
3861e8db6e2SBrian Feldman(or public) key to stdout.
387a0ee8cc6SDag-Erling SmørgravThis option allows importing keys from other software, including several
388a0ee8cc6SDag-Erling Smørgravcommercial SSH implementations.
389a0ee8cc6SDag-Erling SmørgravThe default import format is
390a0ee8cc6SDag-Erling Smørgrav.Dq RFC4716 .
39119261079SEd Maste.It Fl K
39219261079SEd MasteDownload resident keys from a FIDO authenticator.
39319261079SEd MastePublic and private key files will be written to the current directory for
39419261079SEd Masteeach downloaded key.
39519261079SEd MasteIf multiple FIDO authenticators are attached, keys will be downloaded from
39619261079SEd Mastethe first touched authenticator.
39738a52bd3SEd MasteSee the
39838a52bd3SEd Maste.Sx FIDO AUTHENTICATOR
39938a52bd3SEd Mastesection for more information.
4006888a9beSDag-Erling Smørgrav.It Fl k
4016888a9beSDag-Erling SmørgravGenerate a KRL file.
4026888a9beSDag-Erling SmørgravIn this mode,
4036888a9beSDag-Erling Smørgrav.Nm
4046888a9beSDag-Erling Smørgravwill generate a KRL file at the location specified via the
4056888a9beSDag-Erling Smørgrav.Fl f
4066888a9beSDag-Erling Smørgravflag that revokes every key or certificate presented on the command line.
4076888a9beSDag-Erling SmørgravKeys/certificates to be revoked may be specified by public key file or
4086888a9beSDag-Erling Smørgravusing the format described in the
4096888a9beSDag-Erling Smørgrav.Sx KEY REVOCATION LISTS
4106888a9beSDag-Erling Smørgravsection.
411b15c8340SDag-Erling Smørgrav.It Fl L
412acc1a9efSDag-Erling SmørgravPrints the contents of one or more certificates.
413511b41d2SMark Murray.It Fl l
414ae1f160dSDag-Erling SmørgravShow fingerprint of specified public key file.
415ae1f160dSDag-Erling Smørgrav.Nm
4160fdf8faeSEd Mastewill try to find the matching public key file and prints its fingerprint.
417d4af9e69SDag-Erling SmørgravIf combined with
418d4af9e69SDag-Erling Smørgrav.Fl v ,
419076ad2f8SDag-Erling Smørgrava visual ASCII art representation of the key is supplied with the
420076ad2f8SDag-Erling Smørgravfingerprint.
42119261079SEd Maste.It Fl M Cm generate
42219261079SEd MasteGenerate candidate Diffie-Hellman Group Exchange (DH-GEX) parameters for
42319261079SEd Masteeventual use by the
42419261079SEd Maste.Sq diffie-hellman-group-exchange-*
42519261079SEd Mastekey exchange methods.
42619261079SEd MasteThe numbers generated by this operation must be further screened before
42719261079SEd Masteuse.
42819261079SEd MasteSee the
42919261079SEd Maste.Sx MODULI GENERATION
43019261079SEd Mastesection for more information.
43119261079SEd Maste.It Fl M Cm screen
43219261079SEd MasteScreen candidate parameters for Diffie-Hellman Group Exchange.
43319261079SEd MasteThis will accept a list of candidate numbers and test that they are
43419261079SEd Mastesafe (Sophie Germain) primes with acceptable group generators.
43519261079SEd MasteThe results of this operation may be added to the
43619261079SEd Maste.Pa /etc/moduli
43719261079SEd Mastefile.
43819261079SEd MasteSee the
43919261079SEd Maste.Sx MODULI GENERATION
44019261079SEd Mastesection for more information.
441e2f6069cSDag-Erling Smørgrav.It Fl m Ar key_format
44219261079SEd MasteSpecify a key format for key generation, the
443e2f6069cSDag-Erling Smørgrav.Fl i
44419261079SEd Maste(import),
445e2f6069cSDag-Erling Smørgrav.Fl e
44619261079SEd Maste(export) conversion options, and the
44719261079SEd Maste.Fl p
44819261079SEd Mastechange passphrase operation.
44919261079SEd MasteThe latter may be used to convert between OpenSSH private key and PEM
45019261079SEd Masteprivate key formats.
451e2f6069cSDag-Erling SmørgravThe supported key formats are:
452e2f6069cSDag-Erling Smørgrav.Dq RFC4716
453e2f6069cSDag-Erling Smørgrav(RFC 4716/SSH2 public or private key),
454e2f6069cSDag-Erling Smørgrav.Dq PKCS8
45519261079SEd Maste(PKCS8 public or private key)
456e2f6069cSDag-Erling Smørgravor
457e2f6069cSDag-Erling Smørgrav.Dq PEM
458e2f6069cSDag-Erling Smørgrav(PEM public key).
45919261079SEd MasteBy default OpenSSH will write newly-generated private keys in its own
46019261079SEd Masteformat, but when converting public keys for export the default format is
461e2f6069cSDag-Erling Smørgrav.Dq RFC4716 .
462190cef3dSDag-Erling SmørgravSetting a format of
463190cef3dSDag-Erling Smørgrav.Dq PEM
464190cef3dSDag-Erling Smørgravwhen generating or updating a supported private key type will cause the
465190cef3dSDag-Erling Smørgravkey to be stored in the legacy PEM private key format.
4665e8dbd04SDag-Erling Smørgrav.It Fl N Ar new_passphrase
4675e8dbd04SDag-Erling SmørgravProvides the new passphrase.
468b15c8340SDag-Erling Smørgrav.It Fl n Ar principals
469b15c8340SDag-Erling SmørgravSpecify one or more principals (user or host names) to be included in
470b15c8340SDag-Erling Smørgrava certificate when signing a key.
471b15c8340SDag-Erling SmørgravMultiple principals may be specified, separated by commas.
4721323ec57SEd MasteSee the
473b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
474b15c8340SDag-Erling Smørgravsection for details.
475e2f6069cSDag-Erling Smørgrav.It Fl O Ar option
47619261079SEd MasteSpecify a key/value option.
47719261079SEd MasteThese are specific to the operation that
47819261079SEd Maste.Nm
47919261079SEd Mastehas been requested to perform.
48047dd1d1bSDag-Erling Smørgrav.Pp
48119261079SEd MasteWhen signing certificates, one of the options listed in the
48219261079SEd Maste.Sx CERTIFICATES
48319261079SEd Mastesection may be specified here.
48419261079SEd Maste.Pp
48519261079SEd MasteWhen performing moduli generation or screening, one of the options
48619261079SEd Mastelisted in the
48719261079SEd Maste.Sx MODULI GENERATION
48819261079SEd Mastesection may be specified.
48919261079SEd Maste.Pp
49038a52bd3SEd MasteWhen generating FIDO authenticator-backed keys, the options listed in the
49138a52bd3SEd Maste.Sx FIDO AUTHENTICATOR
49238a52bd3SEd Mastesection may be specified.
49319261079SEd Maste.Pp
49419261079SEd MasteWhen performing signature-related options using the
49519261079SEd Maste.Fl Y
49619261079SEd Masteflag, the following options are accepted:
49719261079SEd Maste.Bl -tag -width Ds
4981323ec57SEd Maste.It Cm hashalg Ns = Ns Ar algorithm
4991323ec57SEd MasteSelects the hash algorithm to use for hashing the message to be signed.
5001323ec57SEd MasteValid algorithms are
5011323ec57SEd Maste.Dq sha256
5021323ec57SEd Masteand
5031323ec57SEd Maste.Dq sha512.
5041323ec57SEd MasteThe default is
5051323ec57SEd Maste.Dq sha512.
50619261079SEd Maste.It Cm print-pubkey
50719261079SEd MastePrint the full public key to standard output after signature verification.
50819261079SEd Maste.It Cm verify-time Ns = Ns Ar timestamp
50919261079SEd MasteSpecifies a time to use when validating signatures instead of the current
51019261079SEd Mastetime.
51138a52bd3SEd MasteThe time may be specified as a date or time in the YYYYMMDD[Z] or
51238a52bd3SEd Mastein YYYYMMDDHHMM[SS][Z] formats.
51338a52bd3SEd MasteDates and times will be interpreted in the current system time zone unless
51438a52bd3SEd Mastesuffixed with a Z character, which causes them to be interpreted in the
51538a52bd3SEd MasteUTC time zone.
51619261079SEd Maste.El
51719261079SEd Maste.Pp
5184d3fc8b0SEd MasteWhen generating SSHFP DNS records from public keys using the
5194d3fc8b0SEd Maste.Fl r
5204d3fc8b0SEd Masteflag, the following options are accepted:
5214d3fc8b0SEd Maste.Bl -tag -width Ds
5224d3fc8b0SEd Maste.It Cm hashalg Ns = Ns Ar algorithm
5234d3fc8b0SEd MasteSelects a hash algorithm to use when printing SSHFP records using the
5244d3fc8b0SEd Maste.Fl D
5254d3fc8b0SEd Masteflag.
5264d3fc8b0SEd MasteValid algorithms are
5274d3fc8b0SEd Maste.Dq sha1
5284d3fc8b0SEd Masteand
5294d3fc8b0SEd Maste.Dq sha256 .
5304d3fc8b0SEd MasteThe default is to print both.
5314d3fc8b0SEd Maste.El
5324d3fc8b0SEd Maste.Pp
53319261079SEd MasteThe
53419261079SEd Maste.Fl O
53519261079SEd Masteoption may be specified multiple times.
53619261079SEd Maste.It Fl P Ar passphrase
53719261079SEd MasteProvides the (old) passphrase.
53819261079SEd Maste.It Fl p
53919261079SEd MasteRequests changing the passphrase of a private key file instead of
54019261079SEd Mastecreating a new private key.
54119261079SEd MasteThe program will prompt for the file
54219261079SEd Mastecontaining the private key, for the old passphrase, and twice for the
54319261079SEd Mastenew passphrase.
54419261079SEd Maste.It Fl Q
54519261079SEd MasteTest whether keys have been revoked in a KRL.
54619261079SEd MasteIf the
54719261079SEd Maste.Fl l
54819261079SEd Masteoption is also specified then the contents of the KRL will be printed.
54919261079SEd Maste.It Fl q
55019261079SEd MasteSilence
55119261079SEd Maste.Nm ssh-keygen .
55219261079SEd Maste.It Fl R Ar hostname | [hostname]:port
55319261079SEd MasteRemoves all keys belonging to the specified
55419261079SEd Maste.Ar hostname
55519261079SEd Maste(with optional port number)
55619261079SEd Mastefrom a
55719261079SEd Maste.Pa known_hosts
55819261079SEd Mastefile.
55919261079SEd MasteThis option is useful to delete hashed hosts (see the
56019261079SEd Maste.Fl H
56119261079SEd Masteoption above).
56219261079SEd Maste.It Fl r Ar hostname
56319261079SEd MastePrint the SSHFP fingerprint resource record named
56419261079SEd Maste.Ar hostname
56519261079SEd Mastefor the specified public key file.
56619261079SEd Maste.It Fl s Ar ca_key
56719261079SEd MasteCertify (sign) a public key using the specified CA key.
5681323ec57SEd MasteSee the
56919261079SEd Maste.Sx CERTIFICATES
57019261079SEd Mastesection for details.
57119261079SEd Maste.Pp
57219261079SEd MasteWhen generating a KRL,
57319261079SEd Maste.Fl s
57419261079SEd Mastespecifies a path to a CA public key file used to revoke certificates directly
57519261079SEd Masteby key ID or serial number.
57619261079SEd MasteSee the
57719261079SEd Maste.Sx KEY REVOCATION LISTS
57819261079SEd Mastesection for details.
5790fdf8faeSEd Maste.It Fl t Cm ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
58019261079SEd MasteSpecifies the type of key to create.
58119261079SEd MasteThe possible values are
58219261079SEd Maste.Dq ecdsa ,
58319261079SEd Maste.Dq ecdsa-sk ,
584*3d9fd9fcSEd Maste.Dq ed25519 (the default),
58519261079SEd Maste.Dq ed25519-sk ,
58619261079SEd Masteor
58719261079SEd Maste.Dq rsa .
58819261079SEd Maste.Pp
58919261079SEd MasteThis flag may also be used to specify the desired signature type when
59019261079SEd Mastesigning certificates using an RSA CA key.
59119261079SEd MasteThe available RSA signature variants are
59219261079SEd Maste.Dq ssh-rsa
59319261079SEd Maste(SHA1 signatures, not recommended),
59419261079SEd Maste.Dq rsa-sha2-256 ,
59519261079SEd Masteand
59619261079SEd Maste.Dq rsa-sha2-512
597*3d9fd9fcSEd Maste(the default for RSA keys).
59819261079SEd Maste.It Fl U
59919261079SEd MasteWhen used in combination with
60038a52bd3SEd Maste.Fl s
60138a52bd3SEd Masteor
60238a52bd3SEd Maste.Fl Y Cm sign ,
60319261079SEd Mastethis option indicates that a CA key resides in a
60419261079SEd Maste.Xr ssh-agent 1 .
60519261079SEd MasteSee the
60619261079SEd Maste.Sx CERTIFICATES
60719261079SEd Mastesection for more information.
60819261079SEd Maste.It Fl u
60919261079SEd MasteUpdate a KRL.
61019261079SEd MasteWhen specified with
61119261079SEd Maste.Fl k ,
61219261079SEd Mastekeys listed via the command line are added to the existing KRL rather than
61319261079SEd Mastea new KRL being created.
61419261079SEd Maste.It Fl V Ar validity_interval
61519261079SEd MasteSpecify a validity interval when signing a certificate.
61619261079SEd MasteA validity interval may consist of a single time, indicating that the
61719261079SEd Mastecertificate is valid beginning now and expiring at that time, or may consist
61819261079SEd Masteof two times separated by a colon to indicate an explicit time interval.
61919261079SEd Maste.Pp
62038a52bd3SEd MasteThe start time may be specified as:
62138a52bd3SEd Maste.Bl -bullet -compact
62238a52bd3SEd Maste.It
62338a52bd3SEd MasteThe string
62419261079SEd Maste.Dq always
62538a52bd3SEd Masteto indicate the certificate has no specified start time.
62638a52bd3SEd Maste.It
62738a52bd3SEd MasteA date or time in the system time zone formatted as YYYYMMDD or
62838a52bd3SEd MasteYYYYMMDDHHMM[SS].
62938a52bd3SEd Maste.It
63038a52bd3SEd MasteA date or time in the UTC time zone as YYYYMMDDZ or YYYYMMDDHHMM[SS]Z.
63138a52bd3SEd Maste.It
63238a52bd3SEd MasteA relative time before the current system time consisting of a minus sign
63338a52bd3SEd Mastefollowed by an interval in the format described in the
63419261079SEd MasteTIME FORMATS section of
63519261079SEd Maste.Xr sshd_config 5 .
63638a52bd3SEd Maste.It
63738a52bd3SEd MasteA raw seconds since epoch (Jan 1 1970 00:00:00 UTC) as a hexadecimal
63838a52bd3SEd Mastenumber beginning with
63938a52bd3SEd Maste.Dq 0x .
64038a52bd3SEd Maste.El
64119261079SEd Maste.Pp
64238a52bd3SEd MasteThe end time may be specified similarly to the start time:
64338a52bd3SEd Maste.Bl -bullet -compact
64438a52bd3SEd Maste.It
64538a52bd3SEd MasteThe string
64619261079SEd Maste.Dq forever
64738a52bd3SEd Masteto indicate the certificate has no specified end time.
64838a52bd3SEd Maste.It
64938a52bd3SEd MasteA date or time in the system time zone formatted as YYYYMMDD or
65038a52bd3SEd MasteYYYYMMDDHHMM[SS].
65138a52bd3SEd Maste.It
65238a52bd3SEd MasteA date or time in the UTC time zone as YYYYMMDDZ or YYYYMMDDHHMM[SS]Z.
65338a52bd3SEd Maste.It
65438a52bd3SEd MasteA relative time after the current system time consisting of a plus sign
65538a52bd3SEd Mastefollowed by an interval in the format described in the
65638a52bd3SEd MasteTIME FORMATS section of
65738a52bd3SEd Maste.Xr sshd_config 5 .
65838a52bd3SEd Maste.It
65938a52bd3SEd MasteA raw seconds since epoch (Jan 1 1970 00:00:00 UTC) as a hexadecimal
66038a52bd3SEd Mastenumber beginning with
66138a52bd3SEd Maste.Dq 0x .
66238a52bd3SEd Maste.El
66319261079SEd Maste.Pp
66419261079SEd MasteFor example:
66538a52bd3SEd Maste.Bl -tag -width Ds
66638a52bd3SEd Maste.It +52w1d
66738a52bd3SEd MasteValid from now to 52 weeks and one day from now.
66838a52bd3SEd Maste.It -4w:+4w
66938a52bd3SEd MasteValid from four weeks ago to four weeks from now.
67038a52bd3SEd Maste.It 20100101123000:20110101123000
67138a52bd3SEd MasteValid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011.
67238a52bd3SEd Maste.It 20100101123000Z:20110101123000Z
67338a52bd3SEd MasteSimilar, but interpreted in the UTC time zone rather than the system time zone.
67438a52bd3SEd Maste.It -1d:20110101
67538a52bd3SEd MasteValid from yesterday to midnight, January 1st, 2011.
67638a52bd3SEd Maste.It 0x1:0x2000000000
67738a52bd3SEd MasteValid from roughly early 1970 to May 2033.
67838a52bd3SEd Maste.It -1m:forever
67938a52bd3SEd MasteValid from one minute ago and never expiring.
68038a52bd3SEd Maste.El
68119261079SEd Maste.It Fl v
68219261079SEd MasteVerbose mode.
68319261079SEd MasteCauses
68419261079SEd Maste.Nm
68519261079SEd Masteto print debugging messages about its progress.
68619261079SEd MasteThis is helpful for debugging moduli generation.
68719261079SEd MasteMultiple
68819261079SEd Maste.Fl v
68919261079SEd Masteoptions increase the verbosity.
69019261079SEd MasteThe maximum is 3.
69119261079SEd Maste.It Fl w Ar provider
69219261079SEd MasteSpecifies a path to a library that will be used when creating
69319261079SEd MasteFIDO authenticator-hosted keys, overriding the default of using
69419261079SEd Mastethe internal USB HID support.
69519261079SEd Maste.It Fl Y Cm find-principals
69619261079SEd MasteFind the principal(s) associated with the public key of a signature,
69719261079SEd Masteprovided using the
69819261079SEd Maste.Fl s
69919261079SEd Masteflag in an authorized signers file provided using the
70019261079SEd Maste.Fl f
70119261079SEd Masteflag.
70219261079SEd MasteThe format of the allowed signers file is documented in the
70319261079SEd Maste.Sx ALLOWED SIGNERS
70419261079SEd Mastesection below.
70519261079SEd MasteIf one or more matching principals are found, they are returned on
70619261079SEd Mastestandard output.
7071323ec57SEd Maste.It Fl Y Cm match-principals
7081323ec57SEd MasteFind principal matching the principal name provided using the
7091323ec57SEd Maste.Fl I
7101323ec57SEd Masteflag in the authorized signers file specified using the
7111323ec57SEd Maste.Fl f
7121323ec57SEd Masteflag.
7131323ec57SEd MasteIf one or more matching principals are found, they are returned on
7141323ec57SEd Mastestandard output.
71519261079SEd Maste.It Fl Y Cm check-novalidate
71619261079SEd MasteChecks that a signature generated using
71719261079SEd Maste.Nm
71819261079SEd Maste.Fl Y Cm sign
71919261079SEd Mastehas a valid structure.
72019261079SEd MasteThis does not validate if a signature comes from an authorized signer.
72119261079SEd MasteWhen testing a signature,
72219261079SEd Maste.Nm
72319261079SEd Masteaccepts a message on standard input and a signature namespace using
72419261079SEd Maste.Fl n .
72519261079SEd MasteA file containing the corresponding signature must also be supplied using the
72619261079SEd Maste.Fl s
72719261079SEd Masteflag.
72819261079SEd MasteSuccessful testing of the signature is signalled by
72919261079SEd Maste.Nm
73019261079SEd Mastereturning a zero exit status.
73119261079SEd Maste.It Fl Y Cm sign
732535af610SEd MasteCryptographically sign a file or some data using an SSH key.
73319261079SEd MasteWhen signing,
73419261079SEd Maste.Nm
73519261079SEd Masteaccepts zero or more files to sign on the command-line - if no files
73619261079SEd Masteare specified then
73719261079SEd Maste.Nm
73819261079SEd Mastewill sign data presented on standard input.
73919261079SEd MasteSignatures are written to the path of the input file with
74019261079SEd Maste.Dq .sig
74119261079SEd Masteappended, or to standard output if the message to be signed was read from
74219261079SEd Mastestandard input.
74319261079SEd Maste.Pp
74419261079SEd MasteThe key used for signing is specified using the
74519261079SEd Maste.Fl f
74619261079SEd Masteoption and may refer to either a private key, or a public key with the private
74719261079SEd Mastehalf available via
74819261079SEd Maste.Xr ssh-agent 1 .
74919261079SEd MasteAn additional signature namespace, used to prevent signature confusion across
75019261079SEd Mastedifferent domains of use (e.g. file signing vs email signing) must be provided
75119261079SEd Mastevia the
75219261079SEd Maste.Fl n
75319261079SEd Masteflag.
75419261079SEd MasteNamespaces are arbitrary strings, and may include:
75519261079SEd Maste.Dq file
75619261079SEd Mastefor file signing,
75719261079SEd Maste.Dq email
75819261079SEd Mastefor email signing.
75919261079SEd MasteFor custom uses, it is recommended to use names following a
76019261079SEd MasteNAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces.
76119261079SEd Maste.It Fl Y Cm verify
76219261079SEd MasteRequest to verify a signature generated using
76319261079SEd Maste.Nm
76419261079SEd Maste.Fl Y Cm sign
76519261079SEd Masteas described above.
76619261079SEd MasteWhen verifying a signature,
76719261079SEd Maste.Nm
76819261079SEd Masteaccepts a message on standard input and a signature namespace using
76919261079SEd Maste.Fl n .
77019261079SEd MasteA file containing the corresponding signature must also be supplied using the
77119261079SEd Maste.Fl s
77219261079SEd Masteflag, along with the identity of the signer using
77319261079SEd Maste.Fl I
77419261079SEd Masteand a list of allowed signers via the
77519261079SEd Maste.Fl f
77619261079SEd Masteflag.
77719261079SEd MasteThe format of the allowed signers file is documented in the
77819261079SEd Maste.Sx ALLOWED SIGNERS
77919261079SEd Mastesection below.
78019261079SEd MasteA file containing revoked keys can be passed using the
78119261079SEd Maste.Fl r
78219261079SEd Masteflag.
78319261079SEd MasteThe revocation file may be a KRL or a one-per-line list of public keys.
78419261079SEd MasteSuccessful verification by an authorized signer is signalled by
78519261079SEd Maste.Nm
78619261079SEd Mastereturning a zero exit status.
78719261079SEd Maste.It Fl y
78819261079SEd MasteThis option will read a private
78919261079SEd MasteOpenSSH format file and print an OpenSSH public key to stdout.
79019261079SEd Maste.It Fl Z Ar cipher
79119261079SEd MasteSpecifies the cipher to use for encryption when writing an OpenSSH-format
79219261079SEd Masteprivate key file.
79319261079SEd MasteThe list of available ciphers may be obtained using
79419261079SEd Maste.Qq ssh -Q cipher .
79519261079SEd MasteThe default is
79619261079SEd Maste.Dq aes256-ctr .
79719261079SEd Maste.It Fl z Ar serial_number
79819261079SEd MasteSpecifies a serial number to be embedded in the certificate to distinguish
79919261079SEd Mastethis certificate from others from the same CA.
80019261079SEd MasteIf the
80119261079SEd Maste.Ar serial_number
80219261079SEd Masteis prefixed with a
80319261079SEd Maste.Sq +
80419261079SEd Mastecharacter, then the serial number will be incremented for each certificate
80519261079SEd Mastesigned on a single command-line.
80619261079SEd MasteThe default serial number is zero.
80719261079SEd Maste.Pp
80819261079SEd MasteWhen generating a KRL, the
80919261079SEd Maste.Fl z
81019261079SEd Masteflag is used to specify a KRL version number.
81119261079SEd Maste.El
81219261079SEd Maste.Sh MODULI GENERATION
81319261079SEd Maste.Nm
81419261079SEd Mastemay be used to generate groups for the Diffie-Hellman Group Exchange
81519261079SEd Maste(DH-GEX) protocol.
81619261079SEd MasteGenerating these groups is a two-step process: first, candidate
81719261079SEd Masteprimes are generated using a fast, but memory intensive process.
81819261079SEd MasteThese candidate primes are then tested for suitability (a CPU-intensive
81919261079SEd Masteprocess).
82019261079SEd Maste.Pp
82119261079SEd MasteGeneration of primes is performed using the
82219261079SEd Maste.Fl M Cm generate
82319261079SEd Masteoption.
82419261079SEd MasteThe desired length of the primes may be specified by the
82519261079SEd Maste.Fl O Cm bits
82619261079SEd Masteoption.
82719261079SEd MasteFor example:
82819261079SEd Maste.Pp
82919261079SEd Maste.Dl # ssh-keygen -M generate -O bits=2048 moduli-2048.candidates
83019261079SEd Maste.Pp
83119261079SEd MasteBy default, the search for primes begins at a random point in the
83219261079SEd Mastedesired length range.
83319261079SEd MasteThis may be overridden using the
83419261079SEd Maste.Fl O Cm start
83519261079SEd Masteoption, which specifies a different start point (in hex).
83619261079SEd Maste.Pp
83719261079SEd MasteOnce a set of candidates have been generated, they must be screened for
83819261079SEd Mastesuitability.
83919261079SEd MasteThis may be performed using the
84019261079SEd Maste.Fl M Cm screen
84119261079SEd Masteoption.
84219261079SEd MasteIn this mode
84319261079SEd Maste.Nm
84419261079SEd Mastewill read candidates from standard input (or a file specified using the
84519261079SEd Maste.Fl f
84619261079SEd Masteoption).
84719261079SEd MasteFor example:
84819261079SEd Maste.Pp
84919261079SEd Maste.Dl # ssh-keygen -M screen -f moduli-2048.candidates moduli-2048
85019261079SEd Maste.Pp
85119261079SEd MasteBy default, each candidate will be subjected to 100 primality tests.
85219261079SEd MasteThis may be overridden using the
85319261079SEd Maste.Fl O Cm prime-tests
85419261079SEd Masteoption.
85519261079SEd MasteThe DH generator value will be chosen automatically for the
85619261079SEd Masteprime under consideration.
85719261079SEd MasteIf a specific generator is desired, it may be requested using the
85819261079SEd Maste.Fl O Cm generator
85919261079SEd Masteoption.
86019261079SEd MasteValid generator values are 2, 3, and 5.
86119261079SEd Maste.Pp
86219261079SEd MasteScreened DH groups may be installed in
86319261079SEd Maste.Pa /etc/moduli .
86419261079SEd MasteIt is important that this file contains moduli of a range of bit lengths.
86519261079SEd Maste.Pp
86619261079SEd MasteA number of options are available for moduli generation and screening via the
86719261079SEd Maste.Fl O
86819261079SEd Masteflag:
86919261079SEd Maste.Bl -tag -width Ds
87019261079SEd Maste.It Ic lines Ns = Ns Ar number
87119261079SEd MasteExit after screening the specified number of lines while performing DH
87219261079SEd Mastecandidate screening.
87319261079SEd Maste.It Ic start-line Ns = Ns Ar line-number
87419261079SEd MasteStart screening at the specified line number while performing DH candidate
87519261079SEd Mastescreening.
87619261079SEd Maste.It Ic checkpoint Ns = Ns Ar filename
87719261079SEd MasteWrite the last line processed to the specified file while performing DH
87819261079SEd Mastecandidate screening.
87919261079SEd MasteThis will be used to skip lines in the input file that have already been
88019261079SEd Masteprocessed if the job is restarted.
88119261079SEd Maste.It Ic memory Ns = Ns Ar mbytes
88219261079SEd MasteSpecify the amount of memory to use (in megabytes) when generating
88319261079SEd Mastecandidate moduli for DH-GEX.
88419261079SEd Maste.It Ic start Ns = Ns Ar hex-value
88519261079SEd MasteSpecify start point (in hex) when generating candidate moduli for DH-GEX.
88619261079SEd Maste.It Ic generator Ns = Ns Ar value
88719261079SEd MasteSpecify desired generator (in decimal) when testing candidate moduli for DH-GEX.
88819261079SEd Maste.El
88919261079SEd Maste.Sh CERTIFICATES
89019261079SEd Maste.Nm
89119261079SEd Mastesupports signing of keys to produce certificates that may be used for
89219261079SEd Masteuser or host authentication.
89319261079SEd MasteCertificates consist of a public key, some identity information, zero or
89419261079SEd Mastemore principal (user or host) names and a set of options that
89519261079SEd Masteare signed by a Certification Authority (CA) key.
89619261079SEd MasteClients or servers may then trust only the CA key and verify its signature
89719261079SEd Masteon a certificate rather than trusting many user/host keys.
89819261079SEd MasteNote that OpenSSH certificates are a different, and much simpler, format to
89919261079SEd Mastethe X.509 certificates used in
90019261079SEd Maste.Xr ssl 8 .
90119261079SEd Maste.Pp
90219261079SEd Maste.Nm
90319261079SEd Mastesupports two types of certificates: user and host.
90419261079SEd MasteUser certificates authenticate users to servers, whereas host certificates
90519261079SEd Masteauthenticate server hosts to users.
90619261079SEd MasteTo generate a user certificate:
90719261079SEd Maste.Pp
90819261079SEd Maste.Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
90919261079SEd Maste.Pp
91019261079SEd MasteThe resultant certificate will be placed in
91119261079SEd Maste.Pa /path/to/user_key-cert.pub .
91219261079SEd MasteA host certificate requires the
91319261079SEd Maste.Fl h
91419261079SEd Masteoption:
91519261079SEd Maste.Pp
91619261079SEd Maste.Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub
91719261079SEd Maste.Pp
91819261079SEd MasteThe host certificate will be output to
91919261079SEd Maste.Pa /path/to/host_key-cert.pub .
92019261079SEd Maste.Pp
92119261079SEd MasteIt is possible to sign using a CA key stored in a PKCS#11 token by
92219261079SEd Masteproviding the token library using
92319261079SEd Maste.Fl D
92419261079SEd Masteand identifying the CA key by providing its public half as an argument
92519261079SEd Masteto
92619261079SEd Maste.Fl s :
92719261079SEd Maste.Pp
92819261079SEd Maste.Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub
92919261079SEd Maste.Pp
93019261079SEd MasteSimilarly, it is possible for the CA key to be hosted in a
93119261079SEd Maste.Xr ssh-agent 1 .
93219261079SEd MasteThis is indicated by the
93319261079SEd Maste.Fl U
93419261079SEd Masteflag and, again, the CA key must be identified by its public half.
93519261079SEd Maste.Pp
93619261079SEd Maste.Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub
93719261079SEd Maste.Pp
93819261079SEd MasteIn all cases,
93919261079SEd Maste.Ar key_id
94019261079SEd Masteis a "key identifier" that is logged by the server when the certificate
94119261079SEd Masteis used for authentication.
94219261079SEd Maste.Pp
94319261079SEd MasteCertificates may be limited to be valid for a set of principal (user/host)
94419261079SEd Mastenames.
94519261079SEd MasteBy default, generated certificates are valid for all users or hosts.
94619261079SEd MasteTo generate a certificate for a specified set of principals:
94719261079SEd Maste.Pp
94819261079SEd Maste.Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
94919261079SEd Maste.Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub"
95019261079SEd Maste.Pp
95119261079SEd MasteAdditional limitations on the validity and use of user certificates may
95219261079SEd Mastebe specified through certificate options.
95319261079SEd MasteA certificate option may disable features of the SSH session, may be
95419261079SEd Mastevalid only when presented from particular source addresses or may
95519261079SEd Masteforce the use of a specific command.
95619261079SEd Maste.Pp
957e2f6069cSDag-Erling SmørgravThe options that are valid for user certificates are:
9584f52dfbbSDag-Erling Smørgrav.Pp
9594f52dfbbSDag-Erling Smørgrav.Bl -tag -width Ds -compact
9608ad9b54aSDag-Erling Smørgrav.It Ic clear
9618ad9b54aSDag-Erling SmørgravClear all enabled permissions.
9628ad9b54aSDag-Erling SmørgravThis is useful for clearing the default set of permissions so permissions may
9638ad9b54aSDag-Erling Smørgravbe added individually.
9644f52dfbbSDag-Erling Smørgrav.Pp
9654f52dfbbSDag-Erling Smørgrav.It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents
9664f52dfbbSDag-Erling Smørgrav.It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents
9674f52dfbbSDag-Erling SmørgravIncludes an arbitrary certificate critical option or extension.
9684f52dfbbSDag-Erling SmørgravThe specified
9694f52dfbbSDag-Erling Smørgrav.Ar name
9704f52dfbbSDag-Erling Smørgravshould include a domain suffix, e.g.\&
9714f52dfbbSDag-Erling Smørgrav.Dq name@example.com .
9724f52dfbbSDag-Erling SmørgravIf
9734f52dfbbSDag-Erling Smørgrav.Ar contents
9744f52dfbbSDag-Erling Smørgravis specified then it is included as the contents of the extension/option
9754f52dfbbSDag-Erling Smørgravencoded as a string, otherwise the extension/option is created with no
9764f52dfbbSDag-Erling Smørgravcontents (usually indicating a flag).
9774f52dfbbSDag-Erling SmørgravExtensions may be ignored by a client or server that does not recognise them,
9784f52dfbbSDag-Erling Smørgravwhereas unknown critical options will cause the certificate to be refused.
9794f52dfbbSDag-Erling Smørgrav.Pp
9808ad9b54aSDag-Erling Smørgrav.It Ic force-command Ns = Ns Ar command
9818ad9b54aSDag-Erling SmørgravForces the execution of
9828ad9b54aSDag-Erling Smørgrav.Ar command
9838ad9b54aSDag-Erling Smørgravinstead of any shell or command specified by the user when
9848ad9b54aSDag-Erling Smørgravthe certificate is used for authentication.
9854f52dfbbSDag-Erling Smørgrav.Pp
986b15c8340SDag-Erling Smørgrav.It Ic no-agent-forwarding
987b15c8340SDag-Erling SmørgravDisable
988b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1
989b15c8340SDag-Erling Smørgravforwarding (permitted by default).
9904f52dfbbSDag-Erling Smørgrav.Pp
991b15c8340SDag-Erling Smørgrav.It Ic no-port-forwarding
992b15c8340SDag-Erling SmørgravDisable port forwarding (permitted by default).
9934f52dfbbSDag-Erling Smørgrav.Pp
994b15c8340SDag-Erling Smørgrav.It Ic no-pty
995b15c8340SDag-Erling SmørgravDisable PTY allocation (permitted by default).
9964f52dfbbSDag-Erling Smørgrav.Pp
997b15c8340SDag-Erling Smørgrav.It Ic no-user-rc
998b15c8340SDag-Erling SmørgravDisable execution of
999b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc
1000b15c8340SDag-Erling Smørgravby
1001b15c8340SDag-Erling Smørgrav.Xr sshd 8
1002b15c8340SDag-Erling Smørgrav(permitted by default).
10034f52dfbbSDag-Erling Smørgrav.Pp
10048ad9b54aSDag-Erling Smørgrav.It Ic no-x11-forwarding
10058ad9b54aSDag-Erling SmørgravDisable X11 forwarding (permitted by default).
10064f52dfbbSDag-Erling Smørgrav.Pp
1007b15c8340SDag-Erling Smørgrav.It Ic permit-agent-forwarding
1008b15c8340SDag-Erling SmørgravAllows
1009b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1
1010b15c8340SDag-Erling Smørgravforwarding.
10114f52dfbbSDag-Erling Smørgrav.Pp
1012b15c8340SDag-Erling Smørgrav.It Ic permit-port-forwarding
1013b15c8340SDag-Erling SmørgravAllows port forwarding.
10144f52dfbbSDag-Erling Smørgrav.Pp
1015b15c8340SDag-Erling Smørgrav.It Ic permit-pty
1016b15c8340SDag-Erling SmørgravAllows PTY allocation.
10174f52dfbbSDag-Erling Smørgrav.Pp
1018b15c8340SDag-Erling Smørgrav.It Ic permit-user-rc
1019b15c8340SDag-Erling SmørgravAllows execution of
1020b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc
1021b15c8340SDag-Erling Smørgravby
1022b15c8340SDag-Erling Smørgrav.Xr sshd 8 .
10234f52dfbbSDag-Erling Smørgrav.Pp
102447dd1d1bSDag-Erling Smørgrav.It Ic permit-X11-forwarding
10258ad9b54aSDag-Erling SmørgravAllows X11 forwarding.
10264f52dfbbSDag-Erling Smørgrav.Pp
102719261079SEd Maste.It Ic no-touch-required
102819261079SEd MasteDo not require signatures made using this key include demonstration
102919261079SEd Masteof user presence (e.g. by having the user touch the authenticator).
103019261079SEd MasteThis option only makes sense for the FIDO authenticator algorithms
103119261079SEd Maste.Cm ecdsa-sk
103219261079SEd Masteand
103319261079SEd Maste.Cm ed25519-sk .
103419261079SEd Maste.Pp
10358ad9b54aSDag-Erling Smørgrav.It Ic source-address Ns = Ns Ar address_list
10368ad9b54aSDag-Erling SmørgravRestrict the source addresses from which the certificate is considered valid.
1037b15c8340SDag-Erling SmørgravThe
1038b15c8340SDag-Erling Smørgrav.Ar address_list
1039b15c8340SDag-Erling Smørgravis a comma-separated list of one or more address/netmask pairs in CIDR
1040b15c8340SDag-Erling Smørgravformat.
104119261079SEd Maste.Pp
104219261079SEd Maste.It Ic verify-required
104319261079SEd MasteRequire signatures made using this key indicate that the user was first
104419261079SEd Masteverified.
104519261079SEd MasteThis option only makes sense for the FIDO authenticator algorithms
104619261079SEd Maste.Cm ecdsa-sk
104719261079SEd Masteand
104819261079SEd Maste.Cm ed25519-sk .
104919261079SEd MasteCurrently PIN authentication is the only supported verification method,
105019261079SEd Mastebut other methods may be supported in the future.
1051b15c8340SDag-Erling Smørgrav.El
10526888a9beSDag-Erling Smørgrav.Pp
105319261079SEd MasteAt present, no standard options are valid for host keys.
1054b15c8340SDag-Erling Smørgrav.Pp
1055b15c8340SDag-Erling SmørgravFinally, certificates may be defined with a validity lifetime.
1056b15c8340SDag-Erling SmørgravThe
1057b15c8340SDag-Erling Smørgrav.Fl V
1058b15c8340SDag-Erling Smørgravoption allows specification of certificate start and end times.
1059b15c8340SDag-Erling SmørgravA certificate that is presented at a time outside this range will not be
1060b15c8340SDag-Erling Smørgravconsidered valid.
106119261079SEd MasteBy default, certificates are valid from the
10626888a9beSDag-Erling Smørgrav.Ux
10636888a9beSDag-Erling SmørgravEpoch to the distant future.
1064b15c8340SDag-Erling Smørgrav.Pp
1065b15c8340SDag-Erling SmørgravFor certificates to be used for user or host authentication, the CA
1066b15c8340SDag-Erling Smørgravpublic key must be trusted by
1067b15c8340SDag-Erling Smørgrav.Xr sshd 8
1068b15c8340SDag-Erling Smørgravor
1069b15c8340SDag-Erling Smørgrav.Xr ssh 1 .
10701323ec57SEd MasteRefer to those manual pages for details.
107138a52bd3SEd Maste.Sh FIDO AUTHENTICATOR
107238a52bd3SEd Maste.Nm
107338a52bd3SEd Masteis able to generate FIDO authenticator-backed keys, after which
107438a52bd3SEd Mastethey may be used much like any other key type supported by OpenSSH, so
107538a52bd3SEd Mastelong as the hardware authenticator is attached when the keys are used.
107638a52bd3SEd MasteFIDO authenticators generally require the user to explicitly authorise
107738a52bd3SEd Masteoperations by touching or tapping them.
107838a52bd3SEd MasteFIDO keys consist of two parts: a key handle part stored in the
107938a52bd3SEd Masteprivate key file on disk, and a per-device private key that is unique
108038a52bd3SEd Masteto each FIDO authenticator and that cannot be exported from the
108138a52bd3SEd Masteauthenticator hardware.
108238a52bd3SEd MasteThese are combined by the hardware at authentication time to derive
108338a52bd3SEd Mastethe real key that is used to sign authentication challenges.
108438a52bd3SEd MasteSupported key types are
108538a52bd3SEd Maste.Cm ecdsa-sk
108638a52bd3SEd Masteand
108738a52bd3SEd Maste.Cm ed25519-sk .
108838a52bd3SEd Maste.Pp
108938a52bd3SEd MasteThe options that are valid for FIDO keys are:
109038a52bd3SEd Maste.Bl -tag -width Ds
109138a52bd3SEd Maste.It Cm application
109238a52bd3SEd MasteOverride the default FIDO application/origin string of
109338a52bd3SEd Maste.Dq ssh: .
109438a52bd3SEd MasteThis may be useful when generating host or domain-specific resident keys.
109538a52bd3SEd MasteThe specified application string must begin with
109638a52bd3SEd Maste.Dq ssh: .
109738a52bd3SEd Maste.It Cm challenge Ns = Ns Ar path
109838a52bd3SEd MasteSpecifies a path to a challenge string that will be passed to the
109938a52bd3SEd MasteFIDO authenticator during key generation.
110038a52bd3SEd MasteThe challenge string may be used as part of an out-of-band
110138a52bd3SEd Masteprotocol for key enrollment
110238a52bd3SEd Maste(a random challenge is used by default).
110338a52bd3SEd Maste.It Cm device
110438a52bd3SEd MasteExplicitly specify a
110538a52bd3SEd Maste.Xr fido 4
110638a52bd3SEd Mastedevice to use, rather than letting the authenticator middleware select one.
110738a52bd3SEd Maste.It Cm no-touch-required
110838a52bd3SEd MasteIndicate that the generated private key should not require touch
110938a52bd3SEd Masteevents (user presence) when making signatures.
111038a52bd3SEd MasteNote that
111138a52bd3SEd Maste.Xr sshd 8
111238a52bd3SEd Mastewill refuse such signatures by default, unless overridden via
111338a52bd3SEd Mastean authorized_keys option.
111438a52bd3SEd Maste.It Cm resident
111538a52bd3SEd MasteIndicate that the key handle should be stored on the FIDO
111638a52bd3SEd Masteauthenticator itself.
111738a52bd3SEd MasteThis makes it easier to use the authenticator on multiple computers.
111838a52bd3SEd MasteResident keys may be supported on FIDO2 authenticators and typically
111938a52bd3SEd Masterequire that a PIN be set on the authenticator prior to generation.
112038a52bd3SEd MasteResident keys may be loaded off the authenticator using
112138a52bd3SEd Maste.Xr ssh-add 1 .
112238a52bd3SEd MasteStoring both parts of a key on a FIDO authenticator increases the likelihood
112338a52bd3SEd Masteof an attacker being able to use a stolen authenticator device.
112438a52bd3SEd Maste.It Cm user
112538a52bd3SEd MasteA username to be associated with a resident key,
112638a52bd3SEd Masteoverriding the empty default username.
112738a52bd3SEd MasteSpecifying a username may be useful when generating multiple resident keys
112838a52bd3SEd Mastefor the same application name.
112938a52bd3SEd Maste.It Cm verify-required
113038a52bd3SEd MasteIndicate that this private key should require user verification for
113138a52bd3SEd Masteeach signature.
113238a52bd3SEd MasteNot all FIDO authenticators support this option.
113338a52bd3SEd MasteCurrently PIN authentication is the only supported verification method,
113438a52bd3SEd Mastebut other methods may be supported in the future.
113538a52bd3SEd Maste.It Cm write-attestation Ns = Ns Ar path
113638a52bd3SEd MasteMay be used at key generation time to record the attestation data
113738a52bd3SEd Mastereturned from FIDO authenticators during key generation.
113838a52bd3SEd MasteThis information is potentially sensitive.
113938a52bd3SEd MasteBy default, this information is discarded.
114038a52bd3SEd Maste.El
11416888a9beSDag-Erling Smørgrav.Sh KEY REVOCATION LISTS
11426888a9beSDag-Erling Smørgrav.Nm
11436888a9beSDag-Erling Smørgravis able to manage OpenSSH format Key Revocation Lists (KRLs).
11446888a9beSDag-Erling SmørgravThese binary files specify keys or certificates to be revoked using a
1145f7167e0eSDag-Erling Smørgravcompact format, taking as little as one bit per certificate if they are being
11466888a9beSDag-Erling Smørgravrevoked by serial number.
11476888a9beSDag-Erling Smørgrav.Pp
11486888a9beSDag-Erling SmørgravKRLs may be generated using the
11496888a9beSDag-Erling Smørgrav.Fl k
11506888a9beSDag-Erling Smørgravflag.
11516888a9beSDag-Erling SmørgravThis option reads one or more files from the command line and generates a new
11526888a9beSDag-Erling SmørgravKRL.
11536888a9beSDag-Erling SmørgravThe files may either contain a KRL specification (see below) or public keys,
11546888a9beSDag-Erling Smørgravlisted one per line.
11556888a9beSDag-Erling SmørgravPlain public keys are revoked by listing their hash or contents in the KRL and
11566888a9beSDag-Erling Smørgravcertificates revoked by serial number or key ID (if the serial is zero or
11576888a9beSDag-Erling Smørgravnot available).
11586888a9beSDag-Erling Smørgrav.Pp
11596888a9beSDag-Erling SmørgravRevoking keys using a KRL specification offers explicit control over the
11606888a9beSDag-Erling Smørgravtypes of record used to revoke keys and may be used to directly revoke
11616888a9beSDag-Erling Smørgravcertificates by serial number or key ID without having the complete original
11626888a9beSDag-Erling Smørgravcertificate on hand.
11636888a9beSDag-Erling SmørgravA KRL specification consists of lines containing one of the following directives
11646888a9beSDag-Erling Smørgravfollowed by a colon and some directive-specific information.
11656888a9beSDag-Erling Smørgrav.Bl -tag -width Ds
11666888a9beSDag-Erling Smørgrav.It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number
11676888a9beSDag-Erling SmørgravRevokes a certificate with the specified serial number.
11686888a9beSDag-Erling SmørgravSerial numbers are 64-bit values, not including zero and may be expressed
11696888a9beSDag-Erling Smørgravin decimal, hex or octal.
11706888a9beSDag-Erling SmørgravIf two serial numbers are specified separated by a hyphen, then the range
11716888a9beSDag-Erling Smørgravof serial numbers including and between each is revoked.
11726888a9beSDag-Erling SmørgravThe CA key must have been specified on the
11736888a9beSDag-Erling Smørgrav.Nm
11746888a9beSDag-Erling Smørgravcommand line using the
11756888a9beSDag-Erling Smørgrav.Fl s
11766888a9beSDag-Erling Smørgravoption.
11776888a9beSDag-Erling Smørgrav.It Cm id : Ar key_id
11786888a9beSDag-Erling SmørgravRevokes a certificate with the specified key ID string.
11796888a9beSDag-Erling SmørgravThe CA key must have been specified on the
11806888a9beSDag-Erling Smørgrav.Nm
11816888a9beSDag-Erling Smørgravcommand line using the
11826888a9beSDag-Erling Smørgrav.Fl s
11836888a9beSDag-Erling Smørgravoption.
11846888a9beSDag-Erling Smørgrav.It Cm key : Ar public_key
11856888a9beSDag-Erling SmørgravRevokes the specified key.
11866888a9beSDag-Erling SmørgravIf a certificate is listed, then it is revoked as a plain public key.
11876888a9beSDag-Erling Smørgrav.It Cm sha1 : Ar public_key
11882f513db7SEd MasteRevokes the specified key by including its SHA1 hash in the KRL.
11892f513db7SEd Maste.It Cm sha256 : Ar public_key
11902f513db7SEd MasteRevokes the specified key by including its SHA256 hash in the KRL.
11912f513db7SEd MasteKRLs that revoke keys by SHA256 hash are not supported by OpenSSH versions
11922f513db7SEd Masteprior to 7.9.
11932f513db7SEd Maste.It Cm hash : Ar fingerprint
11942f513db7SEd MasteRevokes a key using a fingerprint hash, as obtained from a
11952f513db7SEd Maste.Xr sshd 8
11962f513db7SEd Masteauthentication log message or the
11972f513db7SEd Maste.Nm
11982f513db7SEd Maste.Fl l
11992f513db7SEd Masteflag.
12002f513db7SEd MasteOnly SHA256 fingerprints are supported here and resultant KRLs are
12012f513db7SEd Mastenot supported by OpenSSH versions prior to 7.9.
12026888a9beSDag-Erling Smørgrav.El
12036888a9beSDag-Erling Smørgrav.Pp
12046888a9beSDag-Erling SmørgravKRLs may be updated using the
12056888a9beSDag-Erling Smørgrav.Fl u
12066888a9beSDag-Erling Smørgravflag in addition to
12076888a9beSDag-Erling Smørgrav.Fl k .
12086888a9beSDag-Erling SmørgravWhen this option is specified, keys listed via the command line are merged into
12096888a9beSDag-Erling Smørgravthe KRL, adding to those already there.
12106888a9beSDag-Erling Smørgrav.Pp
12116888a9beSDag-Erling SmørgravIt is also possible, given a KRL, to test whether it revokes a particular key
12126888a9beSDag-Erling Smørgrav(or keys).
12136888a9beSDag-Erling SmørgravThe
12146888a9beSDag-Erling Smørgrav.Fl Q
12156888a9beSDag-Erling Smørgravflag will query an existing KRL, testing each key specified on the command line.
12166888a9beSDag-Erling SmørgravIf any key listed on the command line has been revoked (or an error encountered)
12176888a9beSDag-Erling Smørgravthen
12186888a9beSDag-Erling Smørgrav.Nm
12196888a9beSDag-Erling Smørgravwill exit with a non-zero exit status.
12206888a9beSDag-Erling SmørgravA zero exit status will only be returned if no key was revoked.
122119261079SEd Maste.Sh ALLOWED SIGNERS
122219261079SEd MasteWhen verifying signatures,
122319261079SEd Maste.Nm
122419261079SEd Masteuses a simple list of identities and keys to determine whether a signature
122519261079SEd Mastecomes from an authorized source.
122619261079SEd MasteThis "allowed signers" file uses a format patterned after the
122719261079SEd MasteAUTHORIZED_KEYS FILE FORMAT described in
122819261079SEd Maste.Xr sshd 8 .
122919261079SEd MasteEach line of the file contains the following space-separated fields:
123019261079SEd Masteprincipals, options, keytype, base64-encoded key.
123119261079SEd MasteEmpty lines and lines starting with a
123219261079SEd Maste.Ql #
123319261079SEd Masteare ignored as comments.
123419261079SEd Maste.Pp
123519261079SEd MasteThe principals field is a pattern-list (see PATTERNS in
123619261079SEd Maste.Xr ssh_config 5 )
123719261079SEd Masteconsisting of one or more comma-separated USER@DOMAIN identity patterns
123819261079SEd Mastethat are accepted for signing.
123919261079SEd MasteWhen verifying, the identity presented via the
124019261079SEd Maste.Fl I
124119261079SEd Masteoption must match a principals pattern in order for the corresponding key to be
124219261079SEd Masteconsidered acceptable for verification.
124319261079SEd Maste.Pp
124419261079SEd MasteThe options (if present) consist of comma-separated option specifications.
124519261079SEd MasteNo spaces are permitted, except within double quotes.
124619261079SEd MasteThe following option specifications are supported (note that option keywords
124719261079SEd Masteare case-insensitive):
124819261079SEd Maste.Bl -tag -width Ds
124919261079SEd Maste.It Cm cert-authority
125019261079SEd MasteIndicates that this key is accepted as a certificate authority (CA) and
125119261079SEd Mastethat certificates signed by this CA may be accepted for verification.
125219261079SEd Maste.It Cm namespaces Ns = Ns "namespace-list"
125319261079SEd MasteSpecifies a pattern-list of namespaces that are accepted for this key.
125419261079SEd MasteIf this option is present, the signature namespace embedded in the
125519261079SEd Mastesignature object and presented on the verification command-line must
125619261079SEd Mastematch the specified list before the key will be considered acceptable.
125719261079SEd Maste.It Cm valid-after Ns = Ns "timestamp"
125819261079SEd MasteIndicates that the key is valid for use at or after the specified timestamp,
125938a52bd3SEd Mastewhich may be a date or time in the YYYYMMDD[Z] or YYYYMMDDHHMM[SS][Z] formats.
126038a52bd3SEd MasteDates and times will be interpreted in the current system time zone unless
126138a52bd3SEd Mastesuffixed with a Z character, which causes them to be interpreted in the UTC
126238a52bd3SEd Mastetime zone.
126319261079SEd Maste.It Cm valid-before Ns = Ns "timestamp"
126419261079SEd MasteIndicates that the key is valid for use at or before the specified timestamp.
126519261079SEd Maste.El
126619261079SEd Maste.Pp
126719261079SEd MasteWhen verifying signatures made by certificates, the expected principal
126819261079SEd Mastename must match both the principals pattern in the allowed signers file and
126919261079SEd Mastethe principals embedded in the certificate itself.
127019261079SEd Maste.Pp
127119261079SEd MasteAn example allowed signers file:
127219261079SEd Maste.Bd -literal -offset 3n
127319261079SEd Maste# Comments allowed at start of line
127419261079SEd Masteuser1@example.com,user2@example.com ssh-rsa AAAAX1...
127519261079SEd Maste# A certificate authority, trusted for all principals in a domain.
127619261079SEd Maste*@example.com cert-authority ssh-ed25519 AAAB4...
127719261079SEd Maste# A key that is accepted only for file signing.
127819261079SEd Masteuser2@example.com namespaces="file" ssh-ed25519 AAA41...
127919261079SEd Maste.Ed
128019261079SEd Maste.Sh ENVIRONMENT
128119261079SEd Maste.Bl -tag -width Ds
128219261079SEd Maste.It Ev SSH_SK_PROVIDER
128319261079SEd MasteSpecifies a path to a library that will be used when loading any
128419261079SEd MasteFIDO authenticator-hosted keys, overriding the default of using
128519261079SEd Mastethe built-in USB HID support.
128619261079SEd Maste.El
1287511b41d2SMark Murray.Sh FILES
12884a421b63SDag-Erling Smørgrav.Bl -tag -width Ds -compact
12894a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa
129019261079SEd Maste.It Pa ~/.ssh/id_ecdsa_sk
1291f7167e0eSDag-Erling Smørgrav.It Pa ~/.ssh/id_ed25519
129219261079SEd Maste.It Pa ~/.ssh/id_ed25519_sk
1293043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa
12940fdf8faeSEd MasteContains the ECDSA, authenticator-hosted ECDSA, Ed25519,
129519261079SEd Masteauthenticator-hosted Ed25519 or RSA authentication identity of the user.
12961e8db6e2SBrian FeldmanThis file should not be readable by anyone but the user.
12971e8db6e2SBrian FeldmanIt is possible to
12981e8db6e2SBrian Feldmanspecify a passphrase when generating the key; that passphrase will be
1299b15c8340SDag-Erling Smørgravused to encrypt the private part of this file using 128-bit AES.
13001e8db6e2SBrian FeldmanThis file is not automatically accessed by
13011e8db6e2SBrian Feldman.Nm
13021e8db6e2SBrian Feldmanbut it is offered as the default file for the private key.
1303ae1f160dSDag-Erling Smørgrav.Xr ssh 1
13041e8db6e2SBrian Feldmanwill read this file when a login attempt is made.
13054a421b63SDag-Erling Smørgrav.Pp
13064a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa.pub
130719261079SEd Maste.It Pa ~/.ssh/id_ecdsa_sk.pub
1308f7167e0eSDag-Erling Smørgrav.It Pa ~/.ssh/id_ed25519.pub
130919261079SEd Maste.It Pa ~/.ssh/id_ed25519_sk.pub
1310043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa.pub
13110fdf8faeSEd MasteContains the ECDSA, authenticator-hosted ECDSA, Ed25519,
131219261079SEd Masteauthenticator-hosted Ed25519 or RSA public key for authentication.
13131e8db6e2SBrian FeldmanThe contents of this file should be added to
1314043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys
13151e8db6e2SBrian Feldmanon all machines
1316ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication.
1317a04a10f8SKris KennawayThere is no need to keep the contents of this file secret.
13184a421b63SDag-Erling Smørgrav.Pp
1319d95e11bfSDag-Erling Smørgrav.It Pa /etc/moduli
1320d95e11bfSDag-Erling SmørgravContains Diffie-Hellman groups used for DH-GEX.
1321d95e11bfSDag-Erling SmørgravThe file format is described in
1322d95e11bfSDag-Erling Smørgrav.Xr moduli 5 .
1323b66f2d16SKris Kennaway.El
1324511b41d2SMark Murray.Sh SEE ALSO
1325511b41d2SMark Murray.Xr ssh 1 ,
1326511b41d2SMark Murray.Xr ssh-add 1 ,
1327511b41d2SMark Murray.Xr ssh-agent 1 ,
1328d95e11bfSDag-Erling Smørgrav.Xr moduli 5 ,
13291e8db6e2SBrian Feldman.Xr sshd 8
13301e8db6e2SBrian Feldman.Rs
1331d4af9e69SDag-Erling Smørgrav.%R RFC 4716
1332d4af9e69SDag-Erling Smørgrav.%T "The Secure Shell (SSH) Public Key File Format"
1333d4af9e69SDag-Erling Smørgrav.%D 2006
13341e8db6e2SBrian Feldman.Re
1335d95e11bfSDag-Erling Smørgrav.Sh AUTHORS
1336d95e11bfSDag-Erling SmørgravOpenSSH is a derivative of the original and free
1337d95e11bfSDag-Erling Smørgravssh 1.2.12 release by Tatu Ylonen.
1338d95e11bfSDag-Erling SmørgravAaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1339d95e11bfSDag-Erling SmørgravTheo de Raadt and Dug Song
1340d95e11bfSDag-Erling Smørgravremoved many bugs, re-added newer features and
1341d95e11bfSDag-Erling Smørgravcreated OpenSSH.
1342d95e11bfSDag-Erling SmørgravMarkus Friedl contributed the support for SSH
1343d95e11bfSDag-Erling Smørgravprotocol versions 1.5 and 2.0.
1344