[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.214

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