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

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