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