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

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