Annotation of src/usr.bin/ssh/ssh-keygen.1, Revision 1.223
1.223 ! dtucker 1: .\" $OpenBSD: ssh-keygen.1,v 1.222 2022/05/09 03:09:53 djm Exp $
1.1 deraadt 2: .\"
3: .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4: .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5: .\" All rights reserved
6: .\"
1.22 deraadt 7: .\" As far as I am concerned, the code I have written for this software
8: .\" can be used freely for any purpose. Any derived versions of this
9: .\" software must be clearly marked as such, and if the derived work is
10: .\" incompatible with the protocol description in the RFC file, it must be
11: .\" called by a name other than "ssh" or "Secure Shell".
12: .\"
13: .\"
1.33 deraadt 14: .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
15: .\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
16: .\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
1.22 deraadt 17: .\"
18: .\" Redistribution and use in source and binary forms, with or without
19: .\" modification, are permitted provided that the following conditions
20: .\" are met:
21: .\" 1. Redistributions of source code must retain the above copyright
22: .\" notice, this list of conditions and the following disclaimer.
23: .\" 2. Redistributions in binary form must reproduce the above copyright
24: .\" notice, this list of conditions and the following disclaimer in the
25: .\" documentation and/or other materials provided with the distribution.
1.1 deraadt 26: .\"
1.22 deraadt 27: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28: .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29: .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30: .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31: .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32: .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33: .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34: .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35: .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36: .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.1 deraadt 37: .\"
1.223 ! dtucker 38: .Dd $Mdocdate: May 9 2022 $
1.2 deraadt 39: .Dt SSH-KEYGEN 1
40: .Os
41: .Sh NAME
42: .Nm ssh-keygen
1.179 jmc 43: .Nd OpenSSH authentication key utility
1.2 deraadt 44: .Sh SYNOPSIS
45: .Nm ssh-keygen
1.25 markus 46: .Op Fl q
1.205 solene 47: .Op Fl a Ar rounds
1.2 deraadt 48: .Op Fl b Ar bits
49: .Op Fl C Ar comment
1.20 markus 50: .Op Fl f Ar output_keyfile
1.155 djm 51: .Op Fl m Ar format
1.171 jmc 52: .Op Fl N Ar new_passphrase
1.191 naddy 53: .Op Fl O Ar option
1.205 solene 54: .Op Fl t Cm dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
1.173 naddy 55: .Op Fl w Ar provider
1.212 dtucker 56: .Op Fl Z Ar cipher
1.2 deraadt 57: .Nm ssh-keygen
58: .Fl p
1.205 solene 59: .Op Fl a Ar rounds
1.9 markus 60: .Op Fl f Ar keyfile
1.155 djm 61: .Op Fl m Ar format
1.171 jmc 62: .Op Fl N Ar new_passphrase
63: .Op Fl P Ar old_passphrase
1.212 dtucker 64: .Op Fl Z Ar cipher
1.2 deraadt 65: .Nm ssh-keygen
1.37 markus 66: .Fl i
1.171 jmc 67: .Op Fl f Ar input_keyfile
1.95 djm 68: .Op Fl m Ar key_format
1.16 deraadt 69: .Nm ssh-keygen
1.37 markus 70: .Fl e
1.171 jmc 71: .Op Fl f Ar input_keyfile
1.95 djm 72: .Op Fl m Ar key_format
1.16 deraadt 73: .Nm ssh-keygen
1.17 markus 74: .Fl y
1.20 markus 75: .Op Fl f Ar input_keyfile
1.17 markus 76: .Nm ssh-keygen
1.2 deraadt 77: .Fl c
1.205 solene 78: .Op Fl a Ar rounds
1.2 deraadt 79: .Op Fl C Ar comment
1.9 markus 80: .Op Fl f Ar keyfile
1.171 jmc 81: .Op Fl P Ar passphrase
1.9 markus 82: .Nm ssh-keygen
83: .Fl l
1.125 naddy 84: .Op Fl v
1.124 djm 85: .Op Fl E Ar fingerprint_hash
1.35 markus 86: .Op Fl f Ar input_keyfile
87: .Nm ssh-keygen
88: .Fl B
1.20 markus 89: .Op Fl f Ar input_keyfile
1.48 jakob 90: .Nm ssh-keygen
1.82 jmc 91: .Fl D Ar pkcs11
1.48 jakob 92: .Nm ssh-keygen
1.64 djm 93: .Fl F Ar hostname
1.170 jmc 94: .Op Fl lv
1.64 djm 95: .Op Fl f Ar known_hosts_file
96: .Nm ssh-keygen
97: .Fl H
98: .Op Fl f Ar known_hosts_file
99: .Nm ssh-keygen
1.187 djm 100: .Fl K
1.205 solene 101: .Op Fl a Ar rounds
1.187 djm 102: .Op Fl w Ar provider
103: .Nm ssh-keygen
1.64 djm 104: .Fl R Ar hostname
105: .Op Fl f Ar known_hosts_file
1.57 jakob 106: .Nm ssh-keygen
107: .Fl r Ar hostname
1.170 jmc 108: .Op Fl g
1.57 jakob 109: .Op Fl f Ar input_keyfile
1.60 djm 110: .Nm ssh-keygen
1.184 djm 111: .Fl M Cm generate
112: .Op Fl O Ar option
1.191 naddy 113: .Ar output_file
1.60 djm 114: .Nm ssh-keygen
1.184 djm 115: .Fl M Cm screen
1.191 naddy 116: .Op Fl f Ar input_file
1.184 djm 117: .Op Fl O Ar option
1.191 naddy 118: .Ar output_file
1.84 djm 119: .Nm ssh-keygen
1.171 jmc 120: .Fl I Ar certificate_identity
1.84 djm 121: .Fl s Ar ca_key
1.170 jmc 122: .Op Fl hU
1.142 djm 123: .Op Fl D Ar pkcs11_provider
1.84 djm 124: .Op Fl n Ar principals
1.93 djm 125: .Op Fl O Ar option
1.84 djm 126: .Op Fl V Ar validity_interval
1.93 djm 127: .Op Fl z Ar serial_number
1.84 djm 128: .Ar
1.86 djm 129: .Nm ssh-keygen
130: .Fl L
131: .Op Fl f Ar input_keyfile
1.102 stevesk 132: .Nm ssh-keygen
133: .Fl A
1.205 solene 134: .Op Fl a Ar rounds
1.143 djm 135: .Op Fl f Ar prefix_path
1.111 djm 136: .Nm ssh-keygen
137: .Fl k
138: .Fl f Ar krl_file
139: .Op Fl u
1.112 jmc 140: .Op Fl s Ar ca_public
141: .Op Fl z Ar version_number
1.111 djm 142: .Ar
143: .Nm ssh-keygen
144: .Fl Q
1.203 djm 145: .Op Fl l
1.111 djm 146: .Fl f Ar krl_file
147: .Ar
1.163 djm 148: .Nm ssh-keygen
1.196 djm 149: .Fl Y Cm find-principals
1.214 djm 150: .Op Fl O Ar option
1.194 djm 151: .Fl s Ar signature_file
152: .Fl f Ar allowed_signers_file
153: .Nm ssh-keygen
1.217 djm 154: .Fl Y Cm match-principals
155: .Fl I Ar signer_identity
156: .Fl f Ar allowed_signers_file
157: .Nm ssh-keygen
1.171 jmc 158: .Fl Y Cm check-novalidate
1.214 djm 159: .Op Fl O Ar option
1.171 jmc 160: .Fl n Ar namespace
161: .Fl s Ar signature_file
162: .Nm ssh-keygen
1.163 djm 163: .Fl Y Cm sign
1.219 djm 164: .Op Fl O Ar option
1.163 djm 165: .Fl f Ar key_file
166: .Fl n Ar namespace
167: .Ar
168: .Nm ssh-keygen
169: .Fl Y Cm verify
1.214 djm 170: .Op Fl O Ar option
1.171 jmc 171: .Fl f Ar allowed_signers_file
1.163 djm 172: .Fl I Ar signer_identity
173: .Fl n Ar namespace
174: .Fl s Ar signature_file
175: .Op Fl r Ar revocation_file
1.13 aaron 176: .Sh DESCRIPTION
1.2 deraadt 177: .Nm
1.37 markus 178: generates, manages and converts authentication keys for
1.2 deraadt 179: .Xr ssh 1 .
1.15 deraadt 180: .Nm
1.140 jmc 181: can create keys for use by SSH protocol version 2.
1.130 jmc 182: .Pp
1.58 jmc 183: The type of key to be generated is specified with the
1.25 markus 184: .Fl t
1.52 djm 185: option.
1.70 djm 186: If invoked without any arguments,
187: .Nm
1.141 naddy 188: will generate an RSA key.
1.15 deraadt 189: .Pp
1.60 djm 190: .Nm
191: is also used to generate groups for use in Diffie-Hellman group
192: exchange (DH-GEX).
193: See the
194: .Sx MODULI GENERATION
195: section for details.
196: .Pp
1.111 djm 197: Finally,
198: .Nm
199: can be used to generate and update Key Revocation Lists, and to test whether
1.112 jmc 200: given keys have been revoked by one.
201: See the
1.111 djm 202: .Sx KEY REVOCATION LISTS
203: section for details.
204: .Pp
1.2 deraadt 205: Normally each user wishing to use SSH
1.99 djm 206: with public key authentication runs this once to create the authentication
1.1 deraadt 207: key in
1.118 naddy 208: .Pa ~/.ssh/id_dsa ,
1.99 djm 209: .Pa ~/.ssh/id_ecdsa ,
1.173 naddy 210: .Pa ~/.ssh/id_ecdsa_sk ,
1.176 naddy 211: .Pa ~/.ssh/id_ed25519 ,
212: .Pa ~/.ssh/id_ed25519_sk
1.15 deraadt 213: or
1.68 djm 214: .Pa ~/.ssh/id_rsa .
1.15 deraadt 215: Additionally, the system administrator may use this to generate host keys,
216: as seen in
217: .Pa /etc/rc .
1.2 deraadt 218: .Pp
1.1 deraadt 219: Normally this program generates the key and asks for a file in which
1.12 aaron 220: to store the private key.
221: The public key is stored in a file with the same name but
1.2 deraadt 222: .Dq .pub
1.12 aaron 223: appended.
224: The program also asks for a passphrase.
225: The passphrase may be empty to indicate no passphrase
1.26 markus 226: (host keys must have an empty passphrase), or it may be a string of
1.12 aaron 227: arbitrary length.
1.51 stevesk 228: A passphrase is similar to a password, except it can be a phrase with a
229: series of words, punctuation, numbers, whitespace, or any string of
230: characters you want.
231: Good passphrases are 10-30 characters long, are
1.1 deraadt 232: not simple sentences or otherwise easily guessable (English
1.42 markus 233: prose has only 1-2 bits of entropy per character, and provides very bad
1.51 stevesk 234: passphrases), and contain a mix of upper and lowercase letters,
235: numbers, and non-alphanumeric characters.
1.12 aaron 236: The passphrase can be changed later by using the
1.2 deraadt 237: .Fl p
1.1 deraadt 238: option.
1.2 deraadt 239: .Pp
1.12 aaron 240: There is no way to recover a lost passphrase.
1.105 djm 241: If the passphrase is lost or forgotten, a new key must be generated
242: and the corresponding public key copied to other machines.
1.2 deraadt 243: .Pp
1.153 djm 244: .Nm
245: will by default write keys in an OpenSSH-specific format.
246: This format is preferred as it offers better protection for
247: keys at rest as well as allowing storage of key comments within
248: the private key file itself.
249: The key comment may be useful to help identify the key.
1.12 aaron 250: The comment is initialized to
1.2 deraadt 251: .Dq user@host
252: when the key is created, but can be changed using the
253: .Fl c
1.1 deraadt 254: option.
1.153 djm 255: .Pp
256: It is still possible for
257: .Nm
258: to write the previously-used PEM format private keys using the
259: .Fl m
260: flag.
261: This may be used when generating new keys, and existing new-format
262: keys may be converted using this option in conjunction with the
263: .Fl p
264: (change passphrase) flag.
1.2 deraadt 265: .Pp
1.205 solene 266: After a key is generated,
267: .Nm
268: will ask where the keys
1.15 deraadt 269: should be placed to be activated.
270: .Pp
1.2 deraadt 271: The options are as follows:
272: .Bl -tag -width Ds
1.102 stevesk 273: .It Fl A
1.223 ! dtucker 274: Generate host keys of all default key types (rsa, ecdsa, and
! 275: ed25519) if they do not already exist.
! 276: The host keys are generated with the default key file path,
1.102 stevesk 277: an empty passphrase, default bits for the key type, and default comment.
1.144 jmc 278: If
1.143 djm 279: .Fl f
1.144 jmc 280: has also been specified, its argument is used as a prefix to the
1.143 djm 281: default path for the resulting host key files.
1.104 jmc 282: This is used by
1.102 stevesk 283: .Pa /etc/rc
284: to generate new host keys.
1.117 djm 285: .It Fl a Ar rounds
1.169 jmc 286: When saving a private key, this option specifies the number of KDF
1.211 dtucker 287: (key derivation function, currently
288: .Xr bcrypt_pbkdf 3 )
289: rounds used.
1.117 djm 290: Higher numbers result in slower passphrase verification and increased
291: resistance to brute-force password cracking (should the keys be stolen).
1.204 dtucker 292: The default is 16 rounds.
1.66 jmc 293: .It Fl B
294: Show the bubblebabble digest of specified private or public key file.
1.2 deraadt 295: .It Fl b Ar bits
1.12 aaron 296: Specifies the number of bits in the key to create.
1.158 dtucker 297: For RSA keys, the minimum size is 1024 bits and the default is 3072 bits.
298: Generally, 3072 bits is considered sufficient.
1.72 dtucker 299: DSA keys must be exactly 1024 bits as specified by FIPS 186-2.
1.106 djm 300: For ECDSA keys, the
301: .Fl b
1.107 deraadt 302: flag determines the key length by selecting from one of three elliptic
1.106 djm 303: curve sizes: 256, 384 or 521 bits.
304: Attempting to use bit lengths other than these three values for ECDSA keys
305: will fail.
1.176 naddy 306: ECDSA-SK, Ed25519 and Ed25519-SK keys have a fixed length and the
1.118 naddy 307: .Fl b
308: flag will be ignored.
1.66 jmc 309: .It Fl C Ar comment
310: Provides a new comment.
1.2 deraadt 311: .It Fl c
1.1 deraadt 312: Requests changing the comment in the private and public key files.
313: The program will prompt for the file containing the private keys, for
1.41 stevesk 314: the passphrase if the key has one, and for the new comment.
1.81 markus 315: .It Fl D Ar pkcs11
1.157 naddy 316: Download the public keys provided by the PKCS#11 shared library
1.83 markus 317: .Ar pkcs11 .
1.98 djm 318: When used in combination with
319: .Fl s ,
320: this option indicates that a CA key resides in a PKCS#11 token (see the
321: .Sx CERTIFICATES
322: section for details).
1.124 djm 323: .It Fl E Ar fingerprint_hash
324: Specifies the hash algorithm used when displaying key fingerprints.
325: Valid options are:
326: .Dq md5
327: and
328: .Dq sha256 .
329: The default is
330: .Dq sha256 .
1.37 markus 331: .It Fl e
1.40 markus 332: This option will read a private or public OpenSSH key file and
1.154 djm 333: print to stdout a public key in one of the formats specified by the
1.95 djm 334: .Fl m
335: option.
336: The default export format is
337: .Dq RFC4716 .
1.96 jmc 338: This option allows exporting OpenSSH keys for use by other programs, including
1.95 djm 339: several commercial SSH implementations.
1.151 djm 340: .It Fl F Ar hostname | [hostname]:port
1.66 jmc 341: Search for the specified
342: .Ar hostname
1.151 djm 343: (with optional port number)
1.66 jmc 344: in a
345: .Pa known_hosts
346: file, listing any occurrences found.
347: This option is useful to find hashed host names or addresses and may also be
348: used in conjunction with the
349: .Fl H
350: option to print found keys in a hashed format.
351: .It Fl f Ar filename
352: Specifies the filename of the key file.
1.57 jakob 353: .It Fl g
1.62 jakob 354: Use generic DNS format when printing fingerprint resource records using the
1.63 jmc 355: .Fl r
1.62 jakob 356: command.
1.66 jmc 357: .It Fl H
358: Hash a
359: .Pa known_hosts
1.67 dtucker 360: file.
361: This replaces all hostnames and addresses with hashed representations
362: within the specified file; the original content is moved to a file with
363: a .old suffix.
1.66 jmc 364: These hashes may be used normally by
365: .Nm ssh
366: and
367: .Nm sshd ,
368: but they do not reveal identifying information should the file's contents
369: be disclosed.
370: This option will not modify existing hashed hostnames and is therefore safe
371: to use on files that mix hashed and non-hashed names.
1.84 djm 372: .It Fl h
373: When signing a key, create a host certificate instead of a user
374: certificate.
1.220 jsg 375: See the
1.84 djm 376: .Sx CERTIFICATES
377: section for details.
1.85 jmc 378: .It Fl I Ar certificate_identity
1.84 djm 379: Specify the key identity when signing a public key.
1.220 jsg 380: See the
1.84 djm 381: .Sx CERTIFICATES
382: section for details.
1.37 markus 383: .It Fl i
384: This option will read an unencrypted private (or public) key file
1.95 djm 385: in the format specified by the
386: .Fl m
387: option and print an OpenSSH compatible private
1.37 markus 388: (or public) key to stdout.
1.122 jmc 389: This option allows importing keys from other software, including several
390: commercial SSH implementations.
391: The default import format is
392: .Dq RFC4716 .
1.188 jmc 393: .It Fl K
1.187 djm 394: Download resident keys from a FIDO authenticator.
395: Public and private key files will be written to the current directory for
396: each downloaded key.
1.207 djm 397: If multiple FIDO authenticators are attached, keys will be downloaded from
398: the first touched authenticator.
1.221 florian 399: See the
400: .Sx FIDO AUTHENTICATOR
401: section for more information.
1.111 djm 402: .It Fl k
403: Generate a KRL file.
404: In this mode,
405: .Nm
406: will generate a KRL file at the location specified via the
407: .Fl f
1.114 jmc 408: flag that revokes every key or certificate presented on the command line.
1.111 djm 409: Keys/certificates to be revoked may be specified by public key file or
410: using the format described in the
411: .Sx KEY REVOCATION LISTS
412: section.
1.86 djm 413: .It Fl L
1.129 djm 414: Prints the contents of one or more certificates.
1.9 markus 415: .It Fl l
1.77 grunk 416: Show fingerprint of specified public key file.
1.50 markus 417: For RSA and DSA keys
418: .Nm
1.78 jmc 419: tries to find the matching public key file and prints its fingerprint.
420: If combined with
421: .Fl v ,
1.132 jmc 422: a visual ASCII art representation of the key is supplied with the
1.131 djm 423: fingerprint.
1.184 djm 424: .It Fl M Cm generate
425: Generate candidate Diffie-Hellman Group Exchange (DH-GEX) parameters for
426: eventual use by the
427: .Sq diffie-hellman-group-exchange-*
428: key exchange methods.
429: The numbers generated by this operation must be further screened before
430: use.
431: See the
432: .Sx MODULI GENERATION
433: section for more information.
434: .It Fl M Cm screen
435: Screen candidate parameters for Diffie-Hellman Group Exchange.
436: This will accept a list of candidate numbers and test that they are
437: safe (Sophie Germain) primes with acceptable group generators.
438: The results of this operation may be added to the
439: .Pa /etc/moduli
440: file.
441: See the
442: .Sx MODULI GENERATION
443: section for more information.
1.95 djm 444: .It Fl m Ar key_format
1.155 djm 445: Specify a key format for key generation, the
1.95 djm 446: .Fl i
1.155 djm 447: (import),
1.95 djm 448: .Fl e
1.155 djm 449: (export) conversion options, and the
450: .Fl p
451: change passphrase operation.
452: The latter may be used to convert between OpenSSH private key and PEM
453: private key formats.
1.95 djm 454: The supported key formats are:
455: .Dq RFC4716
1.96 jmc 456: (RFC 4716/SSH2 public or private key),
1.95 djm 457: .Dq PKCS8
1.161 djm 458: (PKCS8 public or private key)
1.95 djm 459: or
460: .Dq PEM
461: (PEM public key).
1.161 djm 462: By default OpenSSH will write newly-generated private keys in its own
463: format, but when converting public keys for export the default format is
1.95 djm 464: .Dq RFC4716 .
1.148 djm 465: Setting a format of
466: .Dq PEM
467: when generating or updating a supported private key type will cause the
468: key to be stored in the legacy PEM private key format.
1.66 jmc 469: .It Fl N Ar new_passphrase
470: Provides the new passphrase.
1.84 djm 471: .It Fl n Ar principals
472: Specify one or more principals (user or host names) to be included in
473: a certificate when signing a key.
474: Multiple principals may be specified, separated by commas.
1.220 jsg 475: See the
1.84 djm 476: .Sx CERTIFICATES
477: section for details.
1.93 djm 478: .It Fl O Ar option
1.184 djm 479: Specify a key/value option.
480: These are specific to the operation that
481: .Nm
482: has been requested to perform.
483: .Pp
484: When signing certificates, one of the options listed in the
1.183 djm 485: .Sx CERTIFICATES
1.184 djm 486: section may be specified here.
487: .Pp
488: When performing moduli generation or screening, one of the options
489: listed in the
490: .Sx MODULI GENERATION
491: section may be specified.
492: .Pp
1.221 florian 493: When generating FIDO authenticator-backed keys, the options listed in the
494: .Sx FIDO AUTHENTICATOR
495: section may be specified.
1.185 djm 496: .Pp
1.214 djm 497: When performing signature-related options using the
498: .Fl Y
499: flag, the following options are accepted:
500: .Bl -tag -width Ds
1.219 djm 501: .It Cm hashalg Ns = Ns Ar algorithm
502: Selects the hash algorithm to use for hashing the message to be signed.
503: Valid algorithms are
504: .Dq sha256
505: and
506: .Dq sha512.
507: The default is
508: .Dq sha512.
1.216 djm 509: .It Cm print-pubkey
510: Print the full public key to standard output after signature verification.
1.214 djm 511: .It Cm verify-time Ns = Ns Ar timestamp
512: Specifies a time to use when validating signatures instead of the current
513: time.
514: The time may be specified as a date in YYYYMMDD format or a time
515: in YYYYMMDDHHMM[SS] format.
516: .El
517: .Pp
1.185 djm 518: The
519: .Fl O
520: option may be specified multiple times.
1.66 jmc 521: .It Fl P Ar passphrase
522: Provides the (old) passphrase.
1.2 deraadt 523: .It Fl p
1.1 deraadt 524: Requests changing the passphrase of a private key file instead of
1.12 aaron 525: creating a new private key.
526: The program will prompt for the file
1.1 deraadt 527: containing the private key, for the old passphrase, and twice for the
528: new passphrase.
1.113 jmc 529: .It Fl Q
530: Test whether keys have been revoked in a KRL.
1.203 djm 531: If the
532: .Fl l
533: option is also specified then the contents of the KRL will be printed.
1.5 aaron 534: .It Fl q
535: Silence
536: .Nm ssh-keygen .
1.152 djm 537: .It Fl R Ar hostname | [hostname]:port
1.151 djm 538: Removes all keys belonging to the specified
1.64 djm 539: .Ar hostname
1.151 djm 540: (with optional port number)
1.65 jmc 541: from a
1.64 djm 542: .Pa known_hosts
543: file.
1.65 jmc 544: This option is useful to delete hashed hosts (see the
1.64 djm 545: .Fl H
546: option above).
1.66 jmc 547: .It Fl r Ar hostname
548: Print the SSHFP fingerprint resource record named
549: .Ar hostname
550: for the specified public key file.
1.84 djm 551: .It Fl s Ar ca_key
552: Certify (sign) a public key using the specified CA key.
1.220 jsg 553: See the
1.84 djm 554: .Sx CERTIFICATES
555: section for details.
1.111 djm 556: .Pp
557: When generating a KRL,
558: .Fl s
1.112 jmc 559: specifies a path to a CA public key file used to revoke certificates directly
1.111 djm 560: by key ID or serial number.
561: See the
562: .Sx KEY REVOCATION LISTS
563: section for details.
1.175 djm 564: .It Fl t Cm dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
1.66 jmc 565: Specifies the type of key to create.
566: The possible values are
1.100 naddy 567: .Dq dsa ,
1.118 naddy 568: .Dq ecdsa ,
1.173 naddy 569: .Dq ecdsa-sk ,
1.118 naddy 570: .Dq ed25519 ,
1.175 djm 571: .Dq ed25519-sk ,
1.100 naddy 572: or
1.139 jmc 573: .Dq rsa .
1.159 djm 574: .Pp
575: This flag may also be used to specify the desired signature type when
1.160 jmc 576: signing certificates using an RSA CA key.
1.159 djm 577: The available RSA signature variants are
578: .Dq ssh-rsa
579: (SHA1 signatures, not recommended),
1.160 jmc 580: .Dq rsa-sha2-256 ,
581: and
1.159 djm 582: .Dq rsa-sha2-512
583: (the default).
1.142 djm 584: .It Fl U
585: When used in combination with
1.222 djm 586: .Fl s
587: or
588: .Fl Y Ar sign ,
1.142 djm 589: this option indicates that a CA key resides in a
590: .Xr ssh-agent 1 .
591: See the
592: .Sx CERTIFICATES
593: section for more information.
1.112 jmc 594: .It Fl u
595: Update a KRL.
596: When specified with
597: .Fl k ,
1.114 jmc 598: keys listed via the command line are added to the existing KRL rather than
1.112 jmc 599: a new KRL being created.
1.84 djm 600: .It Fl V Ar validity_interval
601: Specify a validity interval when signing a certificate.
602: A validity interval may consist of a single time, indicating that the
603: certificate is valid beginning now and expiring at that time, or may consist
604: of two times separated by a colon to indicate an explicit time interval.
1.145 djm 605: .Pp
606: The start time may be specified as the string
607: .Dq always
608: to indicate the certificate has no specified start time,
1.147 djm 609: a date in YYYYMMDD format, a time in YYYYMMDDHHMM[SS] format,
1.145 djm 610: a relative time (to the current time) consisting of a minus sign followed by
611: an interval in the format described in the
1.116 jmc 612: TIME FORMATS section of
1.90 jmc 613: .Xr sshd_config 5 .
1.145 djm 614: .Pp
1.147 djm 615: The end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMM[SS] time,
1.145 djm 616: a relative time starting with a plus character or the string
617: .Dq forever
1.202 dtucker 618: to indicate that the certificate has no expiry date.
1.84 djm 619: .Pp
620: For example:
621: .Dq +52w1d
622: (valid from now to 52 weeks and one day from now),
623: .Dq -4w:+4w
624: (valid from four weeks ago to four weeks from now),
625: .Dq 20100101123000:20110101123000
626: (valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011),
627: .Dq -1d:20110101
1.210 dtucker 628: (valid from yesterday to midnight, January 1st, 2011),
1.145 djm 629: .Dq -1m:forever
630: (valid from one minute ago and never expiring).
1.61 djm 631: .It Fl v
632: Verbose mode.
633: Causes
634: .Nm
635: to print debugging messages about its progress.
636: This is helpful for debugging moduli generation.
637: Multiple
638: .Fl v
639: options increase the verbosity.
640: The maximum is 3.
1.173 naddy 641: .It Fl w Ar provider
1.180 naddy 642: Specifies a path to a library that will be used when creating
643: FIDO authenticator-hosted keys, overriding the default of using
644: the internal USB HID support.
1.196 djm 645: .It Fl Y Cm find-principals
646: Find the principal(s) associated with the public key of a signature,
1.194 djm 647: provided using the
648: .Fl s
649: flag in an authorized signers file provided using the
650: .Fl f
651: flag.
652: The format of the allowed signers file is documented in the
653: .Sx ALLOWED SIGNERS
1.195 jmc 654: section below.
1.217 djm 655: If one or more matching principals are found, they are returned on
656: standard output.
657: .It Fl Y Cm match-principals
658: Find principal matching the principal name provided using the
659: .Fl I
660: flag in the authorized signers file specified using the
661: .Fl f
662: flag.
1.196 djm 663: If one or more matching principals are found, they are returned on
664: standard output.
1.182 jmc 665: .It Fl Y Cm check-novalidate
666: Checks that a signature generated using
667: .Nm
668: .Fl Y Cm sign
669: has a valid structure.
670: This does not validate if a signature comes from an authorized signer.
671: When testing a signature,
672: .Nm
673: accepts a message on standard input and a signature namespace using
674: .Fl n .
675: A file containing the corresponding signature must also be supplied using the
676: .Fl s
677: flag.
678: Successful testing of the signature is signalled by
679: .Nm
680: returning a zero exit status.
1.166 jmc 681: .It Fl Y Cm sign
1.163 djm 682: Cryptographically sign a file or some data using a SSH key.
683: When signing,
684: .Nm
685: accepts zero or more files to sign on the command-line - if no files
686: are specified then
687: .Nm
688: will sign data presented on standard input.
689: Signatures are written to the path of the input file with
690: .Dq .sig
691: appended, or to standard output if the message to be signed was read from
692: standard input.
693: .Pp
694: The key used for signing is specified using the
695: .Fl f
696: option and may refer to either a private key, or a public key with the private
697: half available via
698: .Xr ssh-agent 1 .
699: An additional signature namespace, used to prevent signature confusion across
700: different domains of use (e.g. file signing vs email signing) must be provided
701: via the
702: .Fl n
703: flag.
704: Namespaces are arbitrary strings, and may include:
705: .Dq file
706: for file signing,
707: .Dq email
708: for email signing.
709: For custom uses, it is recommended to use names following a
710: NAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces.
1.166 jmc 711: .It Fl Y Cm verify
1.163 djm 712: Request to verify a signature generated using
713: .Nm
1.166 jmc 714: .Fl Y Cm sign
1.163 djm 715: as described above.
716: When verifying a signature,
717: .Nm
718: accepts a message on standard input and a signature namespace using
719: .Fl n .
720: A file containing the corresponding signature must also be supplied using the
721: .Fl s
722: flag, along with the identity of the signer using
723: .Fl I
724: and a list of allowed signers via the
725: .Fl f
726: flag.
727: The format of the allowed signers file is documented in the
728: .Sx ALLOWED SIGNERS
729: section below.
730: A file containing revoked keys can be passed using the
731: .Fl r
1.165 jmc 732: flag.
733: The revocation file may be a KRL or a one-per-line list of public keys.
1.163 djm 734: Successful verification by an authorized signer is signalled by
735: .Nm
736: returning a zero exit status.
1.181 jmc 737: .It Fl y
738: This option will read a private
739: OpenSSH format file and print an OpenSSH public key to stdout.
1.212 dtucker 740: .It Fl Z Ar cipher
741: Specifies the cipher to use for encryption when writing an OpenSSH-format
742: private key file.
743: The list of available ciphers may be obtained using
744: .Qq ssh -Q cipher .
745: The default is
746: .Dq aes256-ctr .
1.93 djm 747: .It Fl z Ar serial_number
748: Specifies a serial number to be embedded in the certificate to distinguish
749: this certificate from others from the same CA.
1.156 djm 750: If the
751: .Ar serial_number
752: is prefixed with a
753: .Sq +
754: character, then the serial number will be incremented for each certificate
755: signed on a single command-line.
1.93 djm 756: The default serial number is zero.
1.111 djm 757: .Pp
758: When generating a KRL, the
759: .Fl z
760: flag is used to specify a KRL version number.
1.2 deraadt 761: .El
1.60 djm 762: .Sh MODULI GENERATION
763: .Nm
764: may be used to generate groups for the Diffie-Hellman Group Exchange
765: (DH-GEX) protocol.
766: Generating these groups is a two-step process: first, candidate
767: primes are generated using a fast, but memory intensive process.
768: These candidate primes are then tested for suitability (a CPU-intensive
769: process).
770: .Pp
771: Generation of primes is performed using the
1.184 djm 772: .Fl M Cm generate
1.60 djm 773: option.
774: The desired length of the primes may be specified by the
1.184 djm 775: .Fl O Cm bits
1.60 djm 776: option.
777: For example:
778: .Pp
1.184 djm 779: .Dl # ssh-keygen -M generate -O bits=2048 moduli-2048.candidates
1.60 djm 780: .Pp
781: By default, the search for primes begins at a random point in the
782: desired length range.
783: This may be overridden using the
1.184 djm 784: .Fl O Cm start
1.60 djm 785: option, which specifies a different start point (in hex).
786: .Pp
1.109 dtucker 787: Once a set of candidates have been generated, they must be screened for
1.60 djm 788: suitability.
789: This may be performed using the
1.184 djm 790: .Fl M Cm screen
1.60 djm 791: option.
792: In this mode
793: .Nm
794: will read candidates from standard input (or a file specified using the
795: .Fl f
796: option).
797: For example:
798: .Pp
1.184 djm 799: .Dl # ssh-keygen -M screen -f moduli-2048.candidates moduli-2048
1.60 djm 800: .Pp
801: By default, each candidate will be subjected to 100 primality tests.
802: This may be overridden using the
1.184 djm 803: .Fl O Cm prime-tests
1.60 djm 804: option.
805: The DH generator value will be chosen automatically for the
806: prime under consideration.
807: If a specific generator is desired, it may be requested using the
1.184 djm 808: .Fl O Cm generator
1.60 djm 809: option.
1.66 jmc 810: Valid generator values are 2, 3, and 5.
1.60 djm 811: .Pp
812: Screened DH groups may be installed in
813: .Pa /etc/moduli .
1.213 dtucker 814: It is important that this file contains moduli of a range of bit lengths.
1.184 djm 815: .Pp
816: A number of options are available for moduli generation and screening via the
817: .Fl O
818: flag:
1.186 jmc 819: .Bl -tag -width Ds
1.184 djm 820: .It Ic lines Ns = Ns Ar number
821: Exit after screening the specified number of lines while performing DH
822: candidate screening.
823: .It Ic start-line Ns = Ns Ar line-number
824: Start screening at the specified line number while performing DH candidate
825: screening.
826: .It Ic checkpoint Ns = Ns Ar filename
827: Write the last line processed to the specified file while performing DH
828: candidate screening.
829: This will be used to skip lines in the input file that have already been
830: processed if the job is restarted.
831: .It Ic memory Ns = Ns Ar mbytes
832: Specify the amount of memory to use (in megabytes) when generating
833: candidate moduli for DH-GEX.
834: .It Ic start Ns = Ns Ar hex-value
835: Specify start point (in hex) when generating candidate moduli for DH-GEX.
836: .It Ic generator Ns = Ns Ar value
837: Specify desired generator (in decimal) when testing candidate moduli for DH-GEX.
838: .El
1.84 djm 839: .Sh CERTIFICATES
840: .Nm
841: supports signing of keys to produce certificates that may be used for
842: user or host authentication.
843: Certificates consist of a public key, some identity information, zero or
1.94 jmc 844: more principal (user or host) names and a set of options that
1.84 djm 845: are signed by a Certification Authority (CA) key.
846: Clients or servers may then trust only the CA key and verify its signature
847: on a certificate rather than trusting many user/host keys.
848: Note that OpenSSH certificates are a different, and much simpler, format to
849: the X.509 certificates used in
850: .Xr ssl 8 .
851: .Pp
852: .Nm
853: supports two types of certificates: user and host.
854: User certificates authenticate users to servers, whereas host certificates
1.85 jmc 855: authenticate server hosts to users.
856: To generate a user certificate:
1.84 djm 857: .Pp
858: .Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
859: .Pp
860: The resultant certificate will be placed in
1.91 djm 861: .Pa /path/to/user_key-cert.pub .
1.84 djm 862: A host certificate requires the
863: .Fl h
864: option:
865: .Pp
866: .Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub
867: .Pp
868: The host certificate will be output to
1.91 djm 869: .Pa /path/to/host_key-cert.pub .
1.98 djm 870: .Pp
871: It is possible to sign using a CA key stored in a PKCS#11 token by
872: providing the token library using
873: .Fl D
874: and identifying the CA key by providing its public half as an argument
875: to
876: .Fl s :
877: .Pp
1.127 naddy 878: .Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub
1.142 djm 879: .Pp
880: Similarly, it is possible for the CA key to be hosted in a
881: .Xr ssh-agent 1 .
882: This is indicated by the
883: .Fl U
884: flag and, again, the CA key must be identified by its public half.
885: .Pp
886: .Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub
1.98 djm 887: .Pp
888: In all cases,
1.84 djm 889: .Ar key_id
890: is a "key identifier" that is logged by the server when the certificate
891: is used for authentication.
892: .Pp
893: Certificates may be limited to be valid for a set of principal (user/host)
894: names.
895: By default, generated certificates are valid for all users or hosts.
896: To generate a certificate for a specified set of principals:
897: .Pp
898: .Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
1.127 naddy 899: .Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub"
1.84 djm 900: .Pp
901: Additional limitations on the validity and use of user certificates may
1.94 jmc 902: be specified through certificate options.
1.93 djm 903: A certificate option may disable features of the SSH session, may be
1.84 djm 904: valid only when presented from particular source addresses or may
905: force the use of a specific command.
1.183 djm 906: .Pp
907: The options that are valid for user certificates are:
908: .Pp
909: .Bl -tag -width Ds -compact
910: .It Ic clear
911: Clear all enabled permissions.
912: This is useful for clearing the default set of permissions so permissions may
913: be added individually.
914: .Pp
915: .It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents
916: .It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents
917: Includes an arbitrary certificate critical option or extension.
918: The specified
919: .Ar name
920: should include a domain suffix, e.g.\&
921: .Dq name@example.com .
922: If
923: .Ar contents
924: is specified then it is included as the contents of the extension/option
925: encoded as a string, otherwise the extension/option is created with no
926: contents (usually indicating a flag).
927: Extensions may be ignored by a client or server that does not recognise them,
928: whereas unknown critical options will cause the certificate to be refused.
929: .Pp
930: .It Ic force-command Ns = Ns Ar command
931: Forces the execution of
932: .Ar command
933: instead of any shell or command specified by the user when
934: the certificate is used for authentication.
935: .Pp
936: .It Ic no-agent-forwarding
937: Disable
938: .Xr ssh-agent 1
939: forwarding (permitted by default).
940: .Pp
941: .It Ic no-port-forwarding
942: Disable port forwarding (permitted by default).
943: .Pp
944: .It Ic no-pty
945: Disable PTY allocation (permitted by default).
946: .Pp
947: .It Ic no-user-rc
948: Disable execution of
949: .Pa ~/.ssh/rc
950: by
951: .Xr sshd 8
952: (permitted by default).
953: .Pp
954: .It Ic no-x11-forwarding
955: Disable X11 forwarding (permitted by default).
956: .Pp
957: .It Ic permit-agent-forwarding
958: Allows
959: .Xr ssh-agent 1
960: forwarding.
961: .Pp
962: .It Ic permit-port-forwarding
963: Allows port forwarding.
964: .Pp
965: .It Ic permit-pty
966: Allows PTY allocation.
967: .Pp
968: .It Ic permit-user-rc
969: Allows execution of
970: .Pa ~/.ssh/rc
971: by
972: .Xr sshd 8 .
973: .Pp
974: .It Ic permit-X11-forwarding
975: Allows X11 forwarding.
976: .Pp
977: .It Ic no-touch-required
1.206 djm 978: Do not require signatures made using this key include demonstration
1.193 naddy 979: of user presence (e.g. by having the user touch the authenticator).
1.192 naddy 980: This option only makes sense for the FIDO authenticator algorithms
1.183 djm 981: .Cm ecdsa-sk
982: and
983: .Cm ed25519-sk .
984: .Pp
985: .It Ic source-address Ns = Ns Ar address_list
986: Restrict the source addresses from which the certificate is considered valid.
987: The
988: .Ar address_list
989: is a comma-separated list of one or more address/netmask pairs in CIDR
990: format.
1.206 djm 991: .Pp
992: .It Ic verify-required
993: Require signatures made using this key indicate that the user was first
994: verified.
995: This option only makes sense for the FIDO authenticator algorithms
996: .Cm ecdsa-sk
997: and
998: .Cm ed25519-sk .
999: Currently PIN authentication is the only supported verification method,
1000: but other methods may be supported in the future.
1.183 djm 1001: .El
1002: .Pp
1003: At present, no standard options are valid for host keys.
1.84 djm 1004: .Pp
1005: Finally, certificates may be defined with a validity lifetime.
1006: The
1007: .Fl V
1008: option allows specification of certificate start and end times.
1009: A certificate that is presented at a time outside this range will not be
1010: considered valid.
1.210 dtucker 1011: By default, certificates are valid from the
1.110 jmc 1012: .Ux
1013: Epoch to the distant future.
1.84 djm 1014: .Pp
1015: For certificates to be used for user or host authentication, the CA
1016: public key must be trusted by
1017: .Xr sshd 8
1018: or
1019: .Xr ssh 1 .
1.220 jsg 1020: Refer to those manual pages for details.
1.221 florian 1021: .Sh FIDO AUTHENTICATOR
1022: .Nm
1023: is able to to generate FIDO authenticator-backed keys, after which
1024: they may be used much like any other key type supported by OpenSSH, so
1025: long as the hardware authenticator is attached when the keys are used.
1026: FIDO authenticators generally require the user to explicitly authorise
1027: operations by touching or tapping them.
1028: FIDO keys consist of two parts: a key handle part stored in the
1029: private key file on disk, and a per-device private key that is unique
1030: to each FIDO authenticator and that cannot be exported from the
1031: authenticator hardware.
1032: These are combined by the hardware at authentication time to derive
1033: the real key that is used to sign authentication challenges.
1034: Supported key types are
1035: .Cm ecdsa-sk
1036: and
1037: .Cm ed25519-sk .
1038: .Pp
1039: The options that are valid for FIDO keys are:
1040: .Bl -tag -width Ds
1041: .It Cm application
1042: Override the default FIDO application/origin string of
1043: .Dq ssh: .
1044: This may be useful when generating host or domain-specific resident keys.
1045: The specified application string must begin with
1046: .Dq ssh: .
1047: .It Cm challenge Ns = Ns Ar path
1048: Specifies a path to a challenge string that will be passed to the
1049: FIDO authenticator during key generation.
1050: The challenge string may be used as part of an out-of-band
1051: protocol for key enrollment
1052: (a random challenge is used by default).
1053: .It Cm device
1054: Explicitly specify a
1055: .Xr fido 4
1056: device to use, rather than letting the authenticator middleware select one.
1057: .It Cm no-touch-required
1058: Indicate that the generated private key should not require touch
1059: events (user presence) when making signatures.
1060: Note that
1061: .Xr sshd 8
1062: will refuse such signatures by default, unless overridden via
1063: an authorized_keys option.
1064: .It Cm resident
1065: Indicate that the key handle should be stored on the FIDO
1066: authenticator itself.
1067: This makes it easier to use the authenticator on multiple computers.
1068: Resident keys may be supported on FIDO2 authenticators and typically
1069: require that a PIN be set on the authenticator prior to generation.
1070: Resident keys may be loaded off the authenticator using
1071: .Xr ssh-add 1 .
1072: Storing both parts of a key on a FIDO authenticator increases the likelihood
1073: of an attacker being able to use a stolen authenticator device.
1074: .It Cm user
1075: A username to be associated with a resident key,
1076: overriding the empty default username.
1077: Specifying a username may be useful when generating multiple resident keys
1078: for the same application name.
1079: .It Cm verify-required
1080: Indicate that this private key should require user verification for
1081: each signature.
1082: Not all FIDO authenticators support this option.
1083: Currently PIN authentication is the only supported verification method,
1084: but other methods may be supported in the future.
1085: .It Cm write-attestation Ns = Ns Ar path
1086: May be used at key generation time to record the attestation data
1087: returned from FIDO authenticators during key generation.
1088: This information is potentially sensitive.
1089: By default, this information is discarded.
1090: .El
1.111 djm 1091: .Sh KEY REVOCATION LISTS
1092: .Nm
1093: is able to manage OpenSSH format Key Revocation Lists (KRLs).
1094: These binary files specify keys or certificates to be revoked using a
1.119 tedu 1095: compact format, taking as little as one bit per certificate if they are being
1.111 djm 1096: revoked by serial number.
1097: .Pp
1098: KRLs may be generated using the
1099: .Fl k
1100: flag.
1.114 jmc 1101: This option reads one or more files from the command line and generates a new
1.111 djm 1102: KRL.
1103: The files may either contain a KRL specification (see below) or public keys,
1104: listed one per line.
1105: Plain public keys are revoked by listing their hash or contents in the KRL and
1106: certificates revoked by serial number or key ID (if the serial is zero or
1107: not available).
1108: .Pp
1109: Revoking keys using a KRL specification offers explicit control over the
1110: types of record used to revoke keys and may be used to directly revoke
1111: certificates by serial number or key ID without having the complete original
1112: certificate on hand.
1113: A KRL specification consists of lines containing one of the following directives
1114: followed by a colon and some directive-specific information.
1115: .Bl -tag -width Ds
1.115 jmc 1116: .It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number
1.111 djm 1117: Revokes a certificate with the specified serial number.
1.112 jmc 1118: Serial numbers are 64-bit values, not including zero and may be expressed
1.111 djm 1119: in decimal, hex or octal.
1120: If two serial numbers are specified separated by a hyphen, then the range
1121: of serial numbers including and between each is revoked.
1122: The CA key must have been specified on the
1123: .Nm
1.114 jmc 1124: command line using the
1.111 djm 1125: .Fl s
1126: option.
1127: .It Cm id : Ar key_id
1128: Revokes a certificate with the specified key ID string.
1129: The CA key must have been specified on the
1130: .Nm
1.114 jmc 1131: command line using the
1.111 djm 1132: .Fl s
1133: option.
1134: .It Cm key : Ar public_key
1135: Revokes the specified key.
1.112 jmc 1136: If a certificate is listed, then it is revoked as a plain public key.
1.111 djm 1137: .It Cm sha1 : Ar public_key
1.149 djm 1138: Revokes the specified key by including its SHA1 hash in the KRL.
1139: .It Cm sha256 : Ar public_key
1140: Revokes the specified key by including its SHA256 hash in the KRL.
1141: KRLs that revoke keys by SHA256 hash are not supported by OpenSSH versions
1142: prior to 7.9.
1143: .It Cm hash : Ar fingerprint
1.150 djm 1144: Revokes a key using a fingerprint hash, as obtained from a
1.149 djm 1145: .Xr sshd 8
1146: authentication log message or the
1147: .Nm
1148: .Fl l
1149: flag.
1150: Only SHA256 fingerprints are supported here and resultant KRLs are
1151: not supported by OpenSSH versions prior to 7.9.
1.111 djm 1152: .El
1153: .Pp
1154: KRLs may be updated using the
1155: .Fl u
1156: flag in addition to
1157: .Fl k .
1.114 jmc 1158: When this option is specified, keys listed via the command line are merged into
1.111 djm 1159: the KRL, adding to those already there.
1160: .Pp
1161: It is also possible, given a KRL, to test whether it revokes a particular key
1162: (or keys).
1163: The
1164: .Fl Q
1.128 jmc 1165: flag will query an existing KRL, testing each key specified on the command line.
1.114 jmc 1166: If any key listed on the command line has been revoked (or an error encountered)
1.111 djm 1167: then
1168: .Nm
1169: will exit with a non-zero exit status.
1170: A zero exit status will only be returned if no key was revoked.
1.163 djm 1171: .Sh ALLOWED SIGNERS
1172: When verifying signatures,
1173: .Nm
1174: uses a simple list of identities and keys to determine whether a signature
1175: comes from an authorized source.
1176: This "allowed signers" file uses a format patterned after the
1177: AUTHORIZED_KEYS FILE FORMAT described in
1.165 jmc 1178: .Xr sshd 8 .
1.163 djm 1179: Each line of the file contains the following space-separated fields:
1180: principals, options, keytype, base64-encoded key.
1181: Empty lines and lines starting with a
1182: .Ql #
1183: are ignored as comments.
1184: .Pp
1.210 dtucker 1185: The principals field is a pattern-list (see PATTERNS in
1.163 djm 1186: .Xr ssh_config 5 )
1187: consisting of one or more comma-separated USER@DOMAIN identity patterns
1188: that are accepted for signing.
1189: When verifying, the identity presented via the
1.172 jmc 1190: .Fl I
1191: option must match a principals pattern in order for the corresponding key to be
1.163 djm 1192: considered acceptable for verification.
1193: .Pp
1194: The options (if present) consist of comma-separated option specifications.
1195: No spaces are permitted, except within double quotes.
1196: The following option specifications are supported (note that option keywords
1197: are case-insensitive):
1198: .Bl -tag -width Ds
1199: .It Cm cert-authority
1200: Indicates that this key is accepted as a certificate authority (CA) and
1201: that certificates signed by this CA may be accepted for verification.
1.214 djm 1202: .It Cm namespaces Ns = Ns "namespace-list"
1.163 djm 1203: Specifies a pattern-list of namespaces that are accepted for this key.
1.164 djm 1204: If this option is present, the signature namespace embedded in the
1.163 djm 1205: signature object and presented on the verification command-line must
1206: match the specified list before the key will be considered acceptable.
1.214 djm 1207: .It Cm valid-after Ns = Ns "timestamp"
1208: Indicates that the key is valid for use at or after the specified timestamp,
1.215 jmc 1209: which may be a date in YYYYMMDD format or a time in YYYYMMDDHHMM[SS] format.
1.214 djm 1210: .It Cm valid-before Ns = Ns "timestamp"
1211: Indicates that the key is valid for use at or before the specified timestamp.
1.163 djm 1212: .El
1213: .Pp
1214: When verifying signatures made by certificates, the expected principal
1215: name must match both the principals pattern in the allowed signers file and
1216: the principals embedded in the certificate itself.
1217: .Pp
1218: An example allowed signers file:
1219: .Bd -literal -offset 3n
1220: # Comments allowed at start of line
1221: user1@example.com,user2@example.com ssh-rsa AAAAX1...
1222: # A certificate authority, trusted for all principals in a domain.
1223: *@example.com cert-authority ssh-ed25519 AAAB4...
1224: # A key that is accepted only for file signing.
1225: user2@example.com namespaces="file" ssh-ed25519 AAA41...
1226: .Ed
1.173 naddy 1227: .Sh ENVIRONMENT
1228: .Bl -tag -width Ds
1229: .It Ev SSH_SK_PROVIDER
1.201 djm 1230: Specifies a path to a library that will be used when loading any
1231: FIDO authenticator-hosted keys, overriding the default of using
1232: the built-in USB HID support.
1.173 naddy 1233: .El
1.2 deraadt 1234: .Sh FILES
1.100 naddy 1235: .Bl -tag -width Ds -compact
1.68 djm 1236: .It Pa ~/.ssh/id_dsa
1.100 naddy 1237: .It Pa ~/.ssh/id_ecdsa
1.173 naddy 1238: .It Pa ~/.ssh/id_ecdsa_sk
1.118 naddy 1239: .It Pa ~/.ssh/id_ed25519
1.176 naddy 1240: .It Pa ~/.ssh/id_ed25519_sk
1.100 naddy 1241: .It Pa ~/.ssh/id_rsa
1.180 naddy 1242: Contains the DSA, ECDSA, authenticator-hosted ECDSA, Ed25519,
1243: authenticator-hosted Ed25519 or RSA authentication identity of the user.
1.15 deraadt 1244: This file should not be readable by anyone but the user.
1245: It is possible to
1246: specify a passphrase when generating the key; that passphrase will be
1.80 dtucker 1247: used to encrypt the private part of this file using 128-bit AES.
1.15 deraadt 1248: This file is not automatically accessed by
1249: .Nm
1250: but it is offered as the default file for the private key.
1.46 markus 1251: .Xr ssh 1
1.15 deraadt 1252: will read this file when a login attempt is made.
1.100 naddy 1253: .Pp
1.68 djm 1254: .It Pa ~/.ssh/id_dsa.pub
1.100 naddy 1255: .It Pa ~/.ssh/id_ecdsa.pub
1.173 naddy 1256: .It Pa ~/.ssh/id_ecdsa_sk.pub
1.118 naddy 1257: .It Pa ~/.ssh/id_ed25519.pub
1.176 naddy 1258: .It Pa ~/.ssh/id_ed25519_sk.pub
1.68 djm 1259: .It Pa ~/.ssh/id_rsa.pub
1.180 naddy 1260: Contains the DSA, ECDSA, authenticator-hosted ECDSA, Ed25519,
1261: authenticator-hosted Ed25519 or RSA public key for authentication.
1.15 deraadt 1262: The contents of this file should be added to
1.68 djm 1263: .Pa ~/.ssh/authorized_keys
1.15 deraadt 1264: on all machines
1.49 deraadt 1265: where the user wishes to log in using public key authentication.
1.12 aaron 1266: There is no need to keep the contents of this file secret.
1.100 naddy 1267: .Pp
1.60 djm 1268: .It Pa /etc/moduli
1269: Contains Diffie-Hellman groups used for DH-GEX.
1270: The file format is described in
1271: .Xr moduli 5 .
1.19 aaron 1272: .El
1.2 deraadt 1273: .Sh SEE ALSO
1274: .Xr ssh 1 ,
1275: .Xr ssh-add 1 ,
1.8 ericj 1276: .Xr ssh-agent 1 ,
1.60 djm 1277: .Xr moduli 5 ,
1.30 itojun 1278: .Xr sshd 8
1.37 markus 1279: .Rs
1.73 markus 1280: .%R RFC 4716
1281: .%T "The Secure Shell (SSH) Public Key File Format"
1282: .%D 2006
1.37 markus 1283: .Re
1.59 jmc 1284: .Sh AUTHORS
1285: OpenSSH is a derivative of the original and free
1286: ssh 1.2.12 release by Tatu Ylonen.
1287: Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1288: Theo de Raadt and Dug Song
1289: removed many bugs, re-added newer features and
1290: created OpenSSH.
1291: Markus Friedl contributed the support for SSH
1292: protocol versions 1.5 and 2.0.