[BACK]Return to ssh-keygen.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Annotation of src/usr.bin/ssh/ssh-keygen.1, Revision 1.204

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