djm@openbsd.org | d637c4a | 2019-09-03 08:35:27 +0000 | [diff] [blame^] | 1 | .\" $OpenBSD: ssh-keygen.1,v 1.164 2019/09/03 08:35:27 djm Exp $ |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 2 | .\" |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
| 5 | .\" All rights reserved |
| 6 | .\" |
Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 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". |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 12 | .\" |
Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 13 | .\" |
Ben Lindstrom | 92a2e38 | 2001-03-05 06:59:27 +0000 | [diff] [blame] | 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. |
Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 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. |
| 26 | .\" |
| 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. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 37 | .\" |
djm@openbsd.org | 2a9c9f7 | 2019-09-03 08:34:19 +0000 | [diff] [blame] | 38 | .Dd $Mdocdate: September 3 2019 $ |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 39 | .Dt SSH-KEYGEN 1 |
| 40 | .Os |
| 41 | .Sh NAME |
| 42 | .Nm ssh-keygen |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 43 | .Nd authentication key generation, management and conversion |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 44 | .Sh SYNOPSIS |
Damien Miller | 495dca3 | 2003-04-01 21:42:14 +1000 | [diff] [blame] | 45 | .Bk -words |
Damien Miller | bad5e03 | 2010-07-16 13:59:59 +1000 | [diff] [blame] | 46 | .Nm ssh-keygen |
Damien Miller | 0bc1bd8 | 2000-11-13 22:57:25 +1100 | [diff] [blame] | 47 | .Op Fl q |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 48 | .Op Fl b Ar bits |
jmc@openbsd.org | f10c0d3 | 2017-05-02 17:04:09 +0000 | [diff] [blame] | 49 | .Op Fl t Cm dsa | ecdsa | ed25519 | rsa |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 50 | .Op Fl N Ar new_passphrase |
| 51 | .Op Fl C Ar comment |
Damien Miller | 1a425f3 | 2000-09-02 10:08:09 +1100 | [diff] [blame] | 52 | .Op Fl f Ar output_keyfile |
djm@openbsd.org | ecd2f33 | 2019-01-22 11:40:42 +0000 | [diff] [blame] | 53 | .Op Fl m Ar format |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 54 | .Nm ssh-keygen |
| 55 | .Fl p |
| 56 | .Op Fl P Ar old_passphrase |
| 57 | .Op Fl N Ar new_passphrase |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 58 | .Op Fl f Ar keyfile |
djm@openbsd.org | ecd2f33 | 2019-01-22 11:40:42 +0000 | [diff] [blame] | 59 | .Op Fl m Ar format |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 60 | .Nm ssh-keygen |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 61 | .Fl i |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 62 | .Op Fl m Ar key_format |
Damien Miller | 1a425f3 | 2000-09-02 10:08:09 +1100 | [diff] [blame] | 63 | .Op Fl f Ar input_keyfile |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 64 | .Nm ssh-keygen |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 65 | .Fl e |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 66 | .Op Fl m Ar key_format |
Damien Miller | 1a425f3 | 2000-09-02 10:08:09 +1100 | [diff] [blame] | 67 | .Op Fl f Ar input_keyfile |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 68 | .Nm ssh-keygen |
| 69 | .Fl y |
Damien Miller | 1a425f3 | 2000-09-02 10:08:09 +1100 | [diff] [blame] | 70 | .Op Fl f Ar input_keyfile |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 71 | .Nm ssh-keygen |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 72 | .Fl c |
| 73 | .Op Fl P Ar passphrase |
| 74 | .Op Fl C Ar comment |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 75 | .Op Fl f Ar keyfile |
| 76 | .Nm ssh-keygen |
| 77 | .Fl l |
naddy@openbsd.org | 6288e3a | 2015-02-24 15:24:05 +0000 | [diff] [blame] | 78 | .Op Fl v |
djm@openbsd.org | 56d1c83 | 2014-12-21 22:27:55 +0000 | [diff] [blame] | 79 | .Op Fl E Ar fingerprint_hash |
Ben Lindstrom | 8fd372b | 2001-03-12 03:02:17 +0000 | [diff] [blame] | 80 | .Op Fl f Ar input_keyfile |
| 81 | .Nm ssh-keygen |
| 82 | .Fl B |
Damien Miller | 1a425f3 | 2000-09-02 10:08:09 +1100 | [diff] [blame] | 83 | .Op Fl f Ar input_keyfile |
Ben Lindstrom | a1ec4a9 | 2001-08-06 21:51:34 +0000 | [diff] [blame] | 84 | .Nm ssh-keygen |
Damien Miller | 048dc93 | 2010-02-12 09:22:04 +1100 | [diff] [blame] | 85 | .Fl D Ar pkcs11 |
Ben Lindstrom | a1ec4a9 | 2001-08-06 21:51:34 +0000 | [diff] [blame] | 86 | .Nm ssh-keygen |
Damien Miller | 4b42d7f | 2005-03-01 21:48:35 +1100 | [diff] [blame] | 87 | .Fl F Ar hostname |
| 88 | .Op Fl f Ar known_hosts_file |
Damien Miller | 718ed50 | 2008-11-03 19:15:20 +1100 | [diff] [blame] | 89 | .Op Fl l |
djm@openbsd.org | bca0582 | 2019-07-19 03:38:01 +0000 | [diff] [blame] | 90 | .Op Fl v |
Damien Miller | 4b42d7f | 2005-03-01 21:48:35 +1100 | [diff] [blame] | 91 | .Nm ssh-keygen |
| 92 | .Fl H |
| 93 | .Op Fl f Ar known_hosts_file |
| 94 | .Nm ssh-keygen |
| 95 | .Fl R Ar hostname |
| 96 | .Op Fl f Ar known_hosts_file |
| 97 | .Nm ssh-keygen |
Damien Miller | 37876e9 | 2003-05-15 10:19:46 +1000 | [diff] [blame] | 98 | .Fl r Ar hostname |
| 99 | .Op Fl f Ar input_keyfile |
| 100 | .Op Fl g |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 101 | .Nm ssh-keygen |
| 102 | .Fl G Ar output_file |
Darren Tucker | 06930c7 | 2003-12-31 11:34:51 +1100 | [diff] [blame] | 103 | .Op Fl v |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 104 | .Op Fl b Ar bits |
| 105 | .Op Fl M Ar memory |
| 106 | .Op Fl S Ar start_point |
| 107 | .Nm ssh-keygen |
| 108 | .Fl T Ar output_file |
| 109 | .Fl f Ar input_file |
Darren Tucker | 06930c7 | 2003-12-31 11:34:51 +1100 | [diff] [blame] | 110 | .Op Fl v |
Damien Miller | 4f752cf | 2013-12-18 17:45:35 +1100 | [diff] [blame] | 111 | .Op Fl a Ar rounds |
Damien Miller | dfceafe | 2012-07-06 13:44:19 +1000 | [diff] [blame] | 112 | .Op Fl J Ar num_lines |
| 113 | .Op Fl j Ar start_line |
Damien Miller | 390d056 | 2011-10-18 16:05:19 +1100 | [diff] [blame] | 114 | .Op Fl K Ar checkpt |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 115 | .Op Fl W Ar generator |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 116 | .Nm ssh-keygen |
| 117 | .Fl s Ar ca_key |
| 118 | .Fl I Ar certificate_identity |
| 119 | .Op Fl h |
djm@openbsd.org | a98339e | 2017-06-28 01:09:22 +0000 | [diff] [blame] | 120 | .Op Fl U |
| 121 | .Op Fl D Ar pkcs11_provider |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 122 | .Op Fl n Ar principals |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 123 | .Op Fl O Ar option |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 124 | .Op Fl V Ar validity_interval |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 125 | .Op Fl z Ar serial_number |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 126 | .Ar |
Damien Miller | f2b70ca | 2010-03-05 07:39:35 +1100 | [diff] [blame] | 127 | .Nm ssh-keygen |
Damien Miller | f2b70ca | 2010-03-05 07:39:35 +1100 | [diff] [blame] | 128 | .Fl L |
| 129 | .Op Fl f Ar input_keyfile |
Damien Miller | 58f1baf | 2011-05-05 14:06:15 +1000 | [diff] [blame] | 130 | .Nm ssh-keygen |
| 131 | .Fl A |
djm@openbsd.org | 853edbe | 2017-07-07 03:53:12 +0000 | [diff] [blame] | 132 | .Op Fl f Ar prefix_path |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 133 | .Nm ssh-keygen |
| 134 | .Fl k |
| 135 | .Fl f Ar krl_file |
| 136 | .Op Fl u |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 137 | .Op Fl s Ar ca_public |
| 138 | .Op Fl z Ar version_number |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 139 | .Ar |
| 140 | .Nm ssh-keygen |
| 141 | .Fl Q |
| 142 | .Fl f Ar krl_file |
| 143 | .Ar |
djm@openbsd.org | 2a9c9f7 | 2019-09-03 08:34:19 +0000 | [diff] [blame] | 144 | .Nm ssh-keygen |
| 145 | .Fl Y Cm sign |
| 146 | .Fl f Ar key_file |
| 147 | .Fl n Ar namespace |
| 148 | .Ar |
| 149 | .Nm ssh-keygen |
| 150 | .Fl Y Cm verify |
| 151 | .Fl I Ar signer_identity |
| 152 | .Fl f Ar allowed_keys_file |
| 153 | .Fl n Ar namespace |
| 154 | .Fl s Ar signature_file |
| 155 | .Op Fl r Ar revocation_file |
Damien Miller | 15f5b56 | 2010-03-03 10:25:21 +1100 | [diff] [blame] | 156 | .Ek |
Damien Miller | 22c7726 | 2000-04-13 12:26:34 +1000 | [diff] [blame] | 157 | .Sh DESCRIPTION |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 158 | .Nm |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 159 | generates, manages and converts authentication keys for |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 160 | .Xr ssh 1 . |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 161 | .Nm |
jmc@openbsd.org | 2b6f799 | 2017-05-03 06:32:02 +0000 | [diff] [blame] | 162 | can create keys for use by SSH protocol version 2. |
jmc@openbsd.org | a685ae8 | 2016-02-17 07:38:19 +0000 | [diff] [blame] | 163 | .Pp |
Damien Miller | fbf486b | 2003-05-23 18:44:23 +1000 | [diff] [blame] | 164 | The type of key to be generated is specified with the |
Damien Miller | 0bc1bd8 | 2000-11-13 22:57:25 +1100 | [diff] [blame] | 165 | .Fl t |
Damien Miller | a41c8b1 | 2002-01-22 23:05:08 +1100 | [diff] [blame] | 166 | option. |
Damien Miller | f14be5c | 2005-11-05 15:15:49 +1100 | [diff] [blame] | 167 | If invoked without any arguments, |
| 168 | .Nm |
naddy@openbsd.org | 2e9c324 | 2017-05-05 10:41:58 +0000 | [diff] [blame] | 169 | will generate an RSA key. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 170 | .Pp |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 171 | .Nm |
| 172 | is also used to generate groups for use in Diffie-Hellman group |
| 173 | exchange (DH-GEX). |
| 174 | See the |
| 175 | .Sx MODULI GENERATION |
| 176 | section for details. |
| 177 | .Pp |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 178 | Finally, |
| 179 | .Nm |
| 180 | can be used to generate and update Key Revocation Lists, and to test whether |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 181 | given keys have been revoked by one. |
| 182 | See the |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 183 | .Sx KEY REVOCATION LISTS |
| 184 | section for details. |
| 185 | .Pp |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 186 | Normally each user wishing to use SSH |
Damien Miller | eb8b60e | 2010-08-31 22:41:14 +1000 | [diff] [blame] | 187 | with public key authentication runs this once to create the authentication |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 188 | key in |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 189 | .Pa ~/.ssh/id_dsa , |
Damien Miller | eb8b60e | 2010-08-31 22:41:14 +1000 | [diff] [blame] | 190 | .Pa ~/.ssh/id_ecdsa , |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 191 | .Pa ~/.ssh/id_ed25519 |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 192 | or |
Damien Miller | 167ea5d | 2005-05-26 12:04:02 +1000 | [diff] [blame] | 193 | .Pa ~/.ssh/id_rsa . |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 194 | Additionally, the system administrator may use this to generate host keys, |
| 195 | as seen in |
| 196 | .Pa /etc/rc . |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 197 | .Pp |
| 198 | Normally this program generates the key and asks for a file in which |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 199 | to store the private key. |
| 200 | The public key is stored in a file with the same name but |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 201 | .Dq .pub |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 202 | appended. |
| 203 | The program also asks for a passphrase. |
| 204 | The passphrase may be empty to indicate no passphrase |
Ben Lindstrom | bf555ba | 2001-01-18 02:04:35 +0000 | [diff] [blame] | 205 | (host keys must have an empty passphrase), or it may be a string of |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 206 | arbitrary length. |
Ben Lindstrom | 4e366d5 | 2001-12-06 16:43:21 +0000 | [diff] [blame] | 207 | A passphrase is similar to a password, except it can be a phrase with a |
| 208 | series of words, punctuation, numbers, whitespace, or any string of |
| 209 | characters you want. |
| 210 | Good passphrases are 10-30 characters long, are |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 211 | not simple sentences or otherwise easily guessable (English |
Ben Lindstrom | 2a097a4 | 2001-06-09 01:13:40 +0000 | [diff] [blame] | 212 | prose has only 1-2 bits of entropy per character, and provides very bad |
Ben Lindstrom | 4e366d5 | 2001-12-06 16:43:21 +0000 | [diff] [blame] | 213 | passphrases), and contain a mix of upper and lowercase letters, |
| 214 | numbers, and non-alphanumeric characters. |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 215 | The passphrase can be changed later by using the |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 216 | .Fl p |
| 217 | option. |
| 218 | .Pp |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 219 | There is no way to recover a lost passphrase. |
Damien Miller | 085c90f | 2011-05-05 14:15:33 +1000 | [diff] [blame] | 220 | If the passphrase is lost or forgotten, a new key must be generated |
| 221 | and the corresponding public key copied to other machines. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 222 | .Pp |
djm@openbsd.org | c45616a | 2019-01-22 11:00:15 +0000 | [diff] [blame] | 223 | .Nm |
| 224 | will by default write keys in an OpenSSH-specific format. |
| 225 | This format is preferred as it offers better protection for |
| 226 | keys at rest as well as allowing storage of key comments within |
| 227 | the private key file itself. |
| 228 | The key comment may be useful to help identify the key. |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 229 | The comment is initialized to |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 230 | .Dq user@host |
| 231 | when the key is created, but can be changed using the |
| 232 | .Fl c |
| 233 | option. |
| 234 | .Pp |
djm@openbsd.org | c45616a | 2019-01-22 11:00:15 +0000 | [diff] [blame] | 235 | It is still possible for |
| 236 | .Nm |
| 237 | to write the previously-used PEM format private keys using the |
| 238 | .Fl m |
| 239 | flag. |
| 240 | This may be used when generating new keys, and existing new-format |
| 241 | keys may be converted using this option in conjunction with the |
| 242 | .Fl p |
| 243 | (change passphrase) flag. |
| 244 | .Pp |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 245 | After a key is generated, instructions below detail where the keys |
| 246 | should be placed to be activated. |
| 247 | .Pp |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 248 | The options are as follows: |
| 249 | .Bl -tag -width Ds |
Damien Miller | 58f1baf | 2011-05-05 14:06:15 +1000 | [diff] [blame] | 250 | .It Fl A |
jmc@openbsd.org | f10c0d3 | 2017-05-02 17:04:09 +0000 | [diff] [blame] | 251 | For each of the key types (rsa, dsa, ecdsa and ed25519) |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 252 | for which host keys |
Damien Miller | 58f1baf | 2011-05-05 14:06:15 +1000 | [diff] [blame] | 253 | do not exist, generate the host keys with the default key file path, |
| 254 | an empty passphrase, default bits for the key type, and default comment. |
jmc@openbsd.org | dc44dd3 | 2017-07-08 18:32:54 +0000 | [diff] [blame] | 255 | If |
djm@openbsd.org | 853edbe | 2017-07-07 03:53:12 +0000 | [diff] [blame] | 256 | .Fl f |
jmc@openbsd.org | dc44dd3 | 2017-07-08 18:32:54 +0000 | [diff] [blame] | 257 | has also been specified, its argument is used as a prefix to the |
djm@openbsd.org | 853edbe | 2017-07-07 03:53:12 +0000 | [diff] [blame] | 258 | default path for the resulting host key files. |
Damien Miller | 3ca1eb3 | 2011-05-05 14:13:50 +1000 | [diff] [blame] | 259 | This is used by |
Damien Miller | 58f1baf | 2011-05-05 14:06:15 +1000 | [diff] [blame] | 260 | .Pa /etc/rc |
| 261 | to generate new host keys. |
Damien Miller | 4f752cf | 2013-12-18 17:45:35 +1100 | [diff] [blame] | 262 | .It Fl a Ar rounds |
djm@openbsd.org | ed7bd5d | 2018-08-08 01:16:01 +0000 | [diff] [blame] | 263 | When saving a private key this option specifies the number of KDF |
| 264 | (key derivation function) rounds used. |
Damien Miller | 4f752cf | 2013-12-18 17:45:35 +1100 | [diff] [blame] | 265 | Higher numbers result in slower passphrase verification and increased |
| 266 | resistance to brute-force password cracking (should the keys be stolen). |
| 267 | .Pp |
jmc@openbsd.org | 2b6f799 | 2017-05-03 06:32:02 +0000 | [diff] [blame] | 268 | When screening DH-GEX candidates (using the |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 269 | .Fl T |
Damien Miller | 4f752cf | 2013-12-18 17:45:35 +1100 | [diff] [blame] | 270 | command). |
| 271 | This option specifies the number of primality tests to perform. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 272 | .It Fl B |
| 273 | Show the bubblebabble digest of specified private or public key file. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 274 | .It Fl b Ar bits |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 275 | Specifies the number of bits in the key to create. |
dtucker@openbsd.org | d7c6e38 | 2019-04-19 05:47:44 +0000 | [diff] [blame] | 276 | For RSA keys, the minimum size is 1024 bits and the default is 3072 bits. |
| 277 | Generally, 3072 bits is considered sufficient. |
Darren Tucker | 9f64733 | 2005-11-28 16:41:46 +1100 | [diff] [blame] | 278 | DSA keys must be exactly 1024 bits as specified by FIPS 186-2. |
Damien Miller | ad21032 | 2011-05-05 14:15:54 +1000 | [diff] [blame] | 279 | For ECDSA keys, the |
| 280 | .Fl b |
Damien Miller | 6232a16 | 2011-09-22 21:36:00 +1000 | [diff] [blame] | 281 | flag determines the key length by selecting from one of three elliptic |
Damien Miller | ad21032 | 2011-05-05 14:15:54 +1000 | [diff] [blame] | 282 | curve sizes: 256, 384 or 521 bits. |
| 283 | Attempting to use bit lengths other than these three values for ECDSA keys |
| 284 | will fail. |
sobrado@openbsd.org | f70b22b | 2014-08-30 15:33:50 +0000 | [diff] [blame] | 285 | Ed25519 keys have a fixed length and the |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 286 | .Fl b |
| 287 | flag will be ignored. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 288 | .It Fl C Ar comment |
| 289 | Provides a new comment. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 290 | .It Fl c |
| 291 | Requests changing the comment in the private and public key files. |
| 292 | The program will prompt for the file containing the private keys, for |
Ben Lindstrom | aafff9c | 2001-05-06 03:01:02 +0000 | [diff] [blame] | 293 | the passphrase if the key has one, and for the new comment. |
Damien Miller | 7ea845e | 2010-02-12 09:21:02 +1100 | [diff] [blame] | 294 | .It Fl D Ar pkcs11 |
naddy@openbsd.org | c13b745 | 2019-03-05 16:17:12 +0000 | [diff] [blame] | 295 | Download the public keys provided by the PKCS#11 shared library |
Damien Miller | a761844 | 2010-02-12 09:26:02 +1100 | [diff] [blame] | 296 | .Ar pkcs11 . |
Damien Miller | 757f34e | 2010-08-05 13:05:31 +1000 | [diff] [blame] | 297 | When used in combination with |
| 298 | .Fl s , |
| 299 | this option indicates that a CA key resides in a PKCS#11 token (see the |
| 300 | .Sx CERTIFICATES |
| 301 | section for details). |
djm@openbsd.org | 56d1c83 | 2014-12-21 22:27:55 +0000 | [diff] [blame] | 302 | .It Fl E Ar fingerprint_hash |
| 303 | Specifies the hash algorithm used when displaying key fingerprints. |
| 304 | Valid options are: |
| 305 | .Dq md5 |
| 306 | and |
| 307 | .Dq sha256 . |
| 308 | The default is |
| 309 | .Dq sha256 . |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 310 | .It Fl e |
Ben Lindstrom | 46c264f | 2001-04-24 16:56:58 +0000 | [diff] [blame] | 311 | This option will read a private or public OpenSSH key file and |
djm@openbsd.org | 180b520 | 2019-01-22 11:19:42 +0000 | [diff] [blame] | 312 | print to stdout a public key in one of the formats specified by the |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 313 | .Fl m |
| 314 | option. |
| 315 | The default export format is |
| 316 | .Dq RFC4716 . |
Damien Miller | ea72728 | 2010-07-02 13:35:34 +1000 | [diff] [blame] | 317 | This option allows exporting OpenSSH keys for use by other programs, including |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 318 | several commercial SSH implementations. |
djm@openbsd.org | 737e4ed | 2018-12-07 03:32:26 +0000 | [diff] [blame] | 319 | .It Fl F Ar hostname | [hostname]:port |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 320 | Search for the specified |
| 321 | .Ar hostname |
djm@openbsd.org | 737e4ed | 2018-12-07 03:32:26 +0000 | [diff] [blame] | 322 | (with optional port number) |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 323 | in a |
| 324 | .Pa known_hosts |
| 325 | file, listing any occurrences found. |
| 326 | This option is useful to find hashed host names or addresses and may also be |
| 327 | used in conjunction with the |
| 328 | .Fl H |
| 329 | option to print found keys in a hashed format. |
| 330 | .It Fl f Ar filename |
| 331 | Specifies the filename of the key file. |
| 332 | .It Fl G Ar output_file |
| 333 | Generate candidate primes for DH-GEX. |
| 334 | These primes must be screened for |
| 335 | safety (using the |
| 336 | .Fl T |
| 337 | option) before use. |
Damien Miller | 37876e9 | 2003-05-15 10:19:46 +1000 | [diff] [blame] | 338 | .It Fl g |
Darren Tucker | 0b42e6d | 2004-08-13 21:22:40 +1000 | [diff] [blame] | 339 | Use generic DNS format when printing fingerprint resource records using the |
Darren Tucker | 6e37037 | 2004-08-13 21:23:25 +1000 | [diff] [blame] | 340 | .Fl r |
Darren Tucker | 0b42e6d | 2004-08-13 21:22:40 +1000 | [diff] [blame] | 341 | command. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 342 | .It Fl H |
| 343 | Hash a |
| 344 | .Pa known_hosts |
Darren Tucker | da1adbc | 2005-03-14 23:15:58 +1100 | [diff] [blame] | 345 | file. |
| 346 | This replaces all hostnames and addresses with hashed representations |
| 347 | within the specified file; the original content is moved to a file with |
| 348 | a .old suffix. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 349 | These hashes may be used normally by |
| 350 | .Nm ssh |
| 351 | and |
| 352 | .Nm sshd , |
| 353 | but they do not reveal identifying information should the file's contents |
| 354 | be disclosed. |
| 355 | This option will not modify existing hashed hostnames and is therefore safe |
| 356 | to use on files that mix hashed and non-hashed names. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 357 | .It Fl h |
| 358 | When signing a key, create a host certificate instead of a user |
| 359 | certificate. |
| 360 | Please see the |
| 361 | .Sx CERTIFICATES |
| 362 | section for details. |
Damien Miller | 15f5b56 | 2010-03-03 10:25:21 +1100 | [diff] [blame] | 363 | .It Fl I Ar certificate_identity |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 364 | Specify the key identity when signing a public key. |
| 365 | Please see the |
| 366 | .Sx CERTIFICATES |
| 367 | section for details. |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 368 | .It Fl i |
| 369 | This option will read an unencrypted private (or public) key file |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 370 | in the format specified by the |
| 371 | .Fl m |
| 372 | option and print an OpenSSH compatible private |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 373 | (or public) key to stdout. |
Damien Miller | 43b156c | 2014-04-20 13:23:03 +1000 | [diff] [blame] | 374 | This option allows importing keys from other software, including several |
| 375 | commercial SSH implementations. |
| 376 | The default import format is |
| 377 | .Dq RFC4716 . |
Damien Miller | dfceafe | 2012-07-06 13:44:19 +1000 | [diff] [blame] | 378 | .It Fl J Ar num_lines |
| 379 | Exit after screening the specified number of lines |
| 380 | while performing DH candidate screening using the |
| 381 | .Fl T |
| 382 | option. |
| 383 | .It Fl j Ar start_line |
| 384 | Start screening at the specified line number |
| 385 | while performing DH candidate screening using the |
| 386 | .Fl T |
| 387 | option. |
Damien Miller | 390d056 | 2011-10-18 16:05:19 +1100 | [diff] [blame] | 388 | .It Fl K Ar checkpt |
| 389 | Write the last line processed to the file |
| 390 | .Ar checkpt |
| 391 | while performing DH candidate screening using the |
| 392 | .Fl T |
| 393 | option. |
| 394 | This will be used to skip lines in the input file that have already been |
| 395 | processed if the job is restarted. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 396 | .It Fl k |
| 397 | Generate a KRL file. |
| 398 | In this mode, |
| 399 | .Nm |
| 400 | will generate a KRL file at the location specified via the |
| 401 | .Fl f |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 402 | flag that revokes every key or certificate presented on the command line. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 403 | Keys/certificates to be revoked may be specified by public key file or |
| 404 | using the format described in the |
| 405 | .Sx KEY REVOCATION LISTS |
| 406 | section. |
Damien Miller | f2b70ca | 2010-03-05 07:39:35 +1100 | [diff] [blame] | 407 | .It Fl L |
djm@openbsd.org | 94bc0b7 | 2015-11-13 04:34:15 +0000 | [diff] [blame] | 408 | Prints the contents of one or more certificates. |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 409 | .It Fl l |
Darren Tucker | 35c4553 | 2008-06-13 04:43:15 +1000 | [diff] [blame] | 410 | Show fingerprint of specified public key file. |
Damien Miller | eb5fec6 | 2001-11-12 10:52:44 +1100 | [diff] [blame] | 411 | For RSA and DSA keys |
| 412 | .Nm |
Darren Tucker | f09e825 | 2008-06-13 05:18:03 +1000 | [diff] [blame] | 413 | tries to find the matching public key file and prints its fingerprint. |
| 414 | If combined with |
| 415 | .Fl v , |
jmc@openbsd.org | 9283884 | 2016-05-03 18:38:12 +0000 | [diff] [blame] | 416 | a visual ASCII art representation of the key is supplied with the |
djm@openbsd.org | cdcd941 | 2016-05-03 14:54:08 +0000 | [diff] [blame] | 417 | fingerprint. |
Damien Miller | ea72728 | 2010-07-02 13:35:34 +1000 | [diff] [blame] | 418 | .It Fl M Ar memory |
| 419 | Specify the amount of memory to use (in megabytes) when generating |
| 420 | candidate moduli for DH-GEX. |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 421 | .It Fl m Ar key_format |
djm@openbsd.org | ecd2f33 | 2019-01-22 11:40:42 +0000 | [diff] [blame] | 422 | Specify a key format for key generation, the |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 423 | .Fl i |
djm@openbsd.org | ecd2f33 | 2019-01-22 11:40:42 +0000 | [diff] [blame] | 424 | (import), |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 425 | .Fl e |
djm@openbsd.org | ecd2f33 | 2019-01-22 11:40:42 +0000 | [diff] [blame] | 426 | (export) conversion options, and the |
| 427 | .Fl p |
| 428 | change passphrase operation. |
| 429 | The latter may be used to convert between OpenSSH private key and PEM |
| 430 | private key formats. |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 431 | The supported key formats are: |
| 432 | .Dq RFC4716 |
Damien Miller | ea72728 | 2010-07-02 13:35:34 +1000 | [diff] [blame] | 433 | (RFC 4716/SSH2 public or private key), |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 434 | .Dq PKCS8 |
djm@openbsd.org | eb0d8e7 | 2019-07-15 13:16:29 +0000 | [diff] [blame] | 435 | (PKCS8 public or private key) |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 436 | or |
| 437 | .Dq PEM |
| 438 | (PEM public key). |
djm@openbsd.org | eb0d8e7 | 2019-07-15 13:16:29 +0000 | [diff] [blame] | 439 | By default OpenSSH will write newly-generated private keys in its own |
| 440 | format, but when converting public keys for export the default format is |
Damien Miller | 44b2504 | 2010-07-02 13:35:01 +1000 | [diff] [blame] | 441 | .Dq RFC4716 . |
djm@openbsd.org | ed7bd5d | 2018-08-08 01:16:01 +0000 | [diff] [blame] | 442 | Setting a format of |
| 443 | .Dq PEM |
| 444 | when generating or updating a supported private key type will cause the |
| 445 | key to be stored in the legacy PEM private key format. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 446 | .It Fl N Ar new_passphrase |
| 447 | Provides the new passphrase. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 448 | .It Fl n Ar principals |
| 449 | Specify one or more principals (user or host names) to be included in |
| 450 | a certificate when signing a key. |
| 451 | Multiple principals may be specified, separated by commas. |
| 452 | Please see the |
| 453 | .Sx CERTIFICATES |
| 454 | section for details. |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 455 | .It Fl O Ar option |
| 456 | Specify a certificate option when signing a key. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 457 | This option may be specified multiple times. |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 458 | See also the |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 459 | .Sx CERTIFICATES |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 460 | section for further details. |
djm@openbsd.org | 130283d | 2018-01-25 03:34:43 +0000 | [diff] [blame] | 461 | .Pp |
| 462 | At present, no standard options are valid for host keys. |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 463 | The options that are valid for user certificates are: |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 464 | .Pp |
| 465 | .Bl -tag -width Ds -compact |
Damien Miller | c59e244 | 2010-03-22 05:50:31 +1100 | [diff] [blame] | 466 | .It Ic clear |
| 467 | Clear all enabled permissions. |
| 468 | This is useful for clearing the default set of permissions so permissions may |
| 469 | be added individually. |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 470 | .Pp |
jmc@openbsd.org | d4084cd | 2017-04-29 06:06:01 +0000 | [diff] [blame] | 471 | .It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 472 | .It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents |
| 473 | Includes an arbitrary certificate critical option or extension. |
| 474 | The specified |
djm@openbsd.org | 249516e | 2017-04-29 04:12:25 +0000 | [diff] [blame] | 475 | .Ar name |
jmc@openbsd.org | d4084cd | 2017-04-29 06:06:01 +0000 | [diff] [blame] | 476 | should include a domain suffix, e.g.\& |
djm@openbsd.org | 249516e | 2017-04-29 04:12:25 +0000 | [diff] [blame] | 477 | .Dq name@example.com . |
jmc@openbsd.org | d4084cd | 2017-04-29 06:06:01 +0000 | [diff] [blame] | 478 | If |
djm@openbsd.org | 249516e | 2017-04-29 04:12:25 +0000 | [diff] [blame] | 479 | .Ar contents |
| 480 | is specified then it is included as the contents of the extension/option |
| 481 | encoded as a string, otherwise the extension/option is created with no |
| 482 | contents (usually indicating a flag). |
| 483 | Extensions may be ignored by a client or server that does not recognise them, |
| 484 | whereas unknown critical options will cause the certificate to be refused. |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 485 | .Pp |
| 486 | .It Ic force-command Ns = Ns Ar command |
| 487 | Forces the execution of |
| 488 | .Ar command |
| 489 | instead of any shell or command specified by the user when |
| 490 | the certificate is used for authentication. |
| 491 | .Pp |
| 492 | .It Ic no-agent-forwarding |
| 493 | Disable |
| 494 | .Xr ssh-agent 1 |
| 495 | forwarding (permitted by default). |
| 496 | .Pp |
| 497 | .It Ic no-port-forwarding |
| 498 | Disable port forwarding (permitted by default). |
| 499 | .Pp |
| 500 | .It Ic no-pty |
| 501 | Disable PTY allocation (permitted by default). |
| 502 | .Pp |
| 503 | .It Ic no-user-rc |
| 504 | Disable execution of |
| 505 | .Pa ~/.ssh/rc |
| 506 | by |
| 507 | .Xr sshd 8 |
| 508 | (permitted by default). |
| 509 | .Pp |
| 510 | .It Ic no-x11-forwarding |
| 511 | Disable X11 forwarding (permitted by default). |
| 512 | .Pp |
| 513 | .It Ic permit-agent-forwarding |
| 514 | Allows |
| 515 | .Xr ssh-agent 1 |
| 516 | forwarding. |
| 517 | .Pp |
| 518 | .It Ic permit-port-forwarding |
| 519 | Allows port forwarding. |
| 520 | .Pp |
| 521 | .It Ic permit-pty |
| 522 | Allows PTY allocation. |
| 523 | .Pp |
| 524 | .It Ic permit-user-rc |
| 525 | Allows execution of |
| 526 | .Pa ~/.ssh/rc |
| 527 | by |
| 528 | .Xr sshd 8 . |
| 529 | .Pp |
djm@openbsd.org | 130283d | 2018-01-25 03:34:43 +0000 | [diff] [blame] | 530 | .It Ic permit-X11-forwarding |
jmc@openbsd.org | 6b84897 | 2017-05-02 07:13:31 +0000 | [diff] [blame] | 531 | Allows X11 forwarding. |
| 532 | .Pp |
| 533 | .It Ic source-address Ns = Ns Ar address_list |
| 534 | Restrict the source addresses from which the certificate is considered valid. |
| 535 | The |
| 536 | .Ar address_list |
| 537 | is a comma-separated list of one or more address/netmask pairs in CIDR |
| 538 | format. |
| 539 | .El |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 540 | .It Fl P Ar passphrase |
| 541 | Provides the (old) passphrase. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 542 | .It Fl p |
| 543 | Requests changing the passphrase of a private key file instead of |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 544 | creating a new private key. |
| 545 | The program will prompt for the file |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 546 | containing the private key, for the old passphrase, and twice for the |
| 547 | new passphrase. |
Damien Miller | 072fdcd | 2013-01-20 22:34:04 +1100 | [diff] [blame] | 548 | .It Fl Q |
| 549 | Test whether keys have been revoked in a KRL. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 550 | .It Fl q |
| 551 | Silence |
| 552 | .Nm ssh-keygen . |
djm@openbsd.org | 63bba57 | 2018-12-07 03:33:18 +0000 | [diff] [blame] | 553 | .It Fl R Ar hostname | [hostname]:port |
djm@openbsd.org | 737e4ed | 2018-12-07 03:32:26 +0000 | [diff] [blame] | 554 | Removes all keys belonging to the specified |
Damien Miller | 4b42d7f | 2005-03-01 21:48:35 +1100 | [diff] [blame] | 555 | .Ar hostname |
djm@openbsd.org | 737e4ed | 2018-12-07 03:32:26 +0000 | [diff] [blame] | 556 | (with optional port number) |
Damien Miller | 4c9c6fd | 2005-03-02 12:03:43 +1100 | [diff] [blame] | 557 | from a |
Damien Miller | 4b42d7f | 2005-03-01 21:48:35 +1100 | [diff] [blame] | 558 | .Pa known_hosts |
| 559 | file. |
Damien Miller | 4c9c6fd | 2005-03-02 12:03:43 +1100 | [diff] [blame] | 560 | This option is useful to delete hashed hosts (see the |
Damien Miller | 4b42d7f | 2005-03-01 21:48:35 +1100 | [diff] [blame] | 561 | .Fl H |
| 562 | option above). |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 563 | .It Fl r Ar hostname |
| 564 | Print the SSHFP fingerprint resource record named |
| 565 | .Ar hostname |
| 566 | for the specified public key file. |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 567 | .It Fl S Ar start |
| 568 | Specify start point (in hex) when generating candidate moduli for DH-GEX. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 569 | .It Fl s Ar ca_key |
| 570 | Certify (sign) a public key using the specified CA key. |
| 571 | Please see the |
| 572 | .Sx CERTIFICATES |
| 573 | section for details. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 574 | .Pp |
| 575 | When generating a KRL, |
| 576 | .Fl s |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 577 | specifies a path to a CA public key file used to revoke certificates directly |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 578 | by key ID or serial number. |
| 579 | See the |
| 580 | .Sx KEY REVOCATION LISTS |
| 581 | section for details. |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 582 | .It Fl T Ar output_file |
| 583 | Test DH group exchange candidate primes (generated using the |
| 584 | .Fl G |
| 585 | option) for safety. |
jmc@openbsd.org | f10c0d3 | 2017-05-02 17:04:09 +0000 | [diff] [blame] | 586 | .It Fl t Cm dsa | ecdsa | ed25519 | rsa |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 587 | Specifies the type of key to create. |
| 588 | The possible values are |
Damien Miller | 6186bbc | 2010-09-24 22:00:54 +1000 | [diff] [blame] | 589 | .Dq dsa , |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 590 | .Dq ecdsa , |
| 591 | .Dq ed25519 , |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 592 | or |
jmc@openbsd.org | f10c0d3 | 2017-05-02 17:04:09 +0000 | [diff] [blame] | 593 | .Dq rsa . |
djm@openbsd.org | 476e355 | 2019-05-20 00:20:35 +0000 | [diff] [blame] | 594 | .Pp |
| 595 | This flag may also be used to specify the desired signature type when |
jmc@openbsd.org | 85ceb0e | 2019-05-20 06:01:59 +0000 | [diff] [blame] | 596 | signing certificates using an RSA CA key. |
djm@openbsd.org | 476e355 | 2019-05-20 00:20:35 +0000 | [diff] [blame] | 597 | The available RSA signature variants are |
| 598 | .Dq ssh-rsa |
| 599 | (SHA1 signatures, not recommended), |
jmc@openbsd.org | 85ceb0e | 2019-05-20 06:01:59 +0000 | [diff] [blame] | 600 | .Dq rsa-sha2-256 , |
| 601 | and |
djm@openbsd.org | 476e355 | 2019-05-20 00:20:35 +0000 | [diff] [blame] | 602 | .Dq rsa-sha2-512 |
| 603 | (the default). |
djm@openbsd.org | a98339e | 2017-06-28 01:09:22 +0000 | [diff] [blame] | 604 | .It Fl U |
| 605 | When used in combination with |
| 606 | .Fl s , |
| 607 | this option indicates that a CA key resides in a |
| 608 | .Xr ssh-agent 1 . |
| 609 | See the |
| 610 | .Sx CERTIFICATES |
| 611 | section for more information. |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 612 | .It Fl u |
| 613 | Update a KRL. |
| 614 | When specified with |
| 615 | .Fl k , |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 616 | keys listed via the command line are added to the existing KRL rather than |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 617 | a new KRL being created. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 618 | .It Fl V Ar validity_interval |
| 619 | Specify a validity interval when signing a certificate. |
| 620 | A validity interval may consist of a single time, indicating that the |
| 621 | certificate is valid beginning now and expiring at that time, or may consist |
| 622 | of two times separated by a colon to indicate an explicit time interval. |
djm@openbsd.org@openbsd.org | d52131a | 2017-11-03 05:14:04 +0000 | [diff] [blame] | 623 | .Pp |
| 624 | The start time may be specified as the string |
| 625 | .Dq always |
| 626 | to indicate the certificate has no specified start time, |
djm@openbsd.org | bf0fbf2 | 2018-03-12 00:52:01 +0000 | [diff] [blame] | 627 | a date in YYYYMMDD format, a time in YYYYMMDDHHMM[SS] format, |
djm@openbsd.org@openbsd.org | d52131a | 2017-11-03 05:14:04 +0000 | [diff] [blame] | 628 | a relative time (to the current time) consisting of a minus sign followed by |
| 629 | an interval in the format described in the |
Damien Miller | fecfd11 | 2013-07-18 16:11:50 +1000 | [diff] [blame] | 630 | TIME FORMATS section of |
Damien Miller | 77497e1 | 2010-03-22 05:50:51 +1100 | [diff] [blame] | 631 | .Xr sshd_config 5 . |
djm@openbsd.org@openbsd.org | d52131a | 2017-11-03 05:14:04 +0000 | [diff] [blame] | 632 | .Pp |
djm@openbsd.org | bf0fbf2 | 2018-03-12 00:52:01 +0000 | [diff] [blame] | 633 | The end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMM[SS] time, |
djm@openbsd.org@openbsd.org | d52131a | 2017-11-03 05:14:04 +0000 | [diff] [blame] | 634 | a relative time starting with a plus character or the string |
| 635 | .Dq forever |
| 636 | to indicate that the certificate has no expirty date. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 637 | .Pp |
| 638 | For example: |
| 639 | .Dq +52w1d |
| 640 | (valid from now to 52 weeks and one day from now), |
| 641 | .Dq -4w:+4w |
| 642 | (valid from four weeks ago to four weeks from now), |
| 643 | .Dq 20100101123000:20110101123000 |
| 644 | (valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011), |
| 645 | .Dq -1d:20110101 |
| 646 | (valid from yesterday to midnight, January 1st, 2011). |
djm@openbsd.org@openbsd.org | d52131a | 2017-11-03 05:14:04 +0000 | [diff] [blame] | 647 | .Dq -1m:forever |
| 648 | (valid from one minute ago and never expiring). |
Darren Tucker | 06930c7 | 2003-12-31 11:34:51 +1100 | [diff] [blame] | 649 | .It Fl v |
| 650 | Verbose mode. |
| 651 | Causes |
| 652 | .Nm |
| 653 | to print debugging messages about its progress. |
| 654 | This is helpful for debugging moduli generation. |
| 655 | Multiple |
| 656 | .Fl v |
| 657 | options increase the verbosity. |
| 658 | The maximum is 3. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 659 | .It Fl W Ar generator |
| 660 | Specify desired generator when testing candidate moduli for DH-GEX. |
| 661 | .It Fl y |
| 662 | This option will read a private |
| 663 | OpenSSH format file and print an OpenSSH public key to stdout. |
djm@openbsd.org | 2a9c9f7 | 2019-09-03 08:34:19 +0000 | [diff] [blame] | 664 | .It Fl Y Ar sign |
| 665 | Cryptographically sign a file or some data using a SSH key. |
| 666 | When signing, |
| 667 | .Nm |
| 668 | accepts zero or more files to sign on the command-line - if no files |
| 669 | are specified then |
| 670 | .Nm |
| 671 | will sign data presented on standard input. |
| 672 | Signatures are written to the path of the input file with |
| 673 | .Dq .sig |
| 674 | appended, or to standard output if the message to be signed was read from |
| 675 | standard input. |
| 676 | .Pp |
| 677 | The key used for signing is specified using the |
| 678 | .Fl f |
| 679 | option and may refer to either a private key, or a public key with the private |
| 680 | half available via |
| 681 | .Xr ssh-agent 1 . |
| 682 | An additional signature namespace, used to prevent signature confusion across |
| 683 | different domains of use (e.g. file signing vs email signing) must be provided |
| 684 | via the |
| 685 | .Fl n |
| 686 | flag. |
| 687 | Namespaces are arbitrary strings, and may include: |
| 688 | .Dq file |
| 689 | for file signing, |
| 690 | .Dq email |
| 691 | for email signing. |
| 692 | For custom uses, it is recommended to use names following a |
| 693 | NAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces. |
| 694 | .It Fl Y Ar verify |
| 695 | Request to verify a signature generated using |
| 696 | .Nm |
| 697 | .Fl Y sign |
| 698 | as described above. |
| 699 | When verifying a signature, |
| 700 | .Nm |
| 701 | accepts a message on standard input and a signature namespace using |
| 702 | .Fl n . |
| 703 | A file containing the corresponding signature must also be supplied using the |
| 704 | .Fl s |
| 705 | flag, along with the identity of the signer using |
| 706 | .Fl I |
| 707 | and a list of allowed signers via the |
| 708 | .Fl f |
| 709 | flag. |
| 710 | The format of the allowed signers file is documented in the |
| 711 | .Sx ALLOWED SIGNERS |
| 712 | section below. |
| 713 | A file containing revoked keys can be passed using the |
| 714 | .Fl r |
| 715 | flag. The revocation file may be a KRL or a one-per-line list |
| 716 | of public keys. |
| 717 | Successful verification by an authorized signer is signalled by |
| 718 | .Nm |
| 719 | returning a zero exit status. |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 720 | .It Fl z Ar serial_number |
| 721 | Specifies a serial number to be embedded in the certificate to distinguish |
| 722 | this certificate from others from the same CA. |
djm@openbsd.org | be06394 | 2019-01-23 04:51:02 +0000 | [diff] [blame] | 723 | If the |
| 724 | .Ar serial_number |
| 725 | is prefixed with a |
| 726 | .Sq + |
| 727 | character, then the serial number will be incremented for each certificate |
| 728 | signed on a single command-line. |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 729 | The default serial number is zero. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 730 | .Pp |
| 731 | When generating a KRL, the |
| 732 | .Fl z |
| 733 | flag is used to specify a KRL version number. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 734 | .El |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 735 | .Sh MODULI GENERATION |
| 736 | .Nm |
| 737 | may be used to generate groups for the Diffie-Hellman Group Exchange |
| 738 | (DH-GEX) protocol. |
| 739 | Generating these groups is a two-step process: first, candidate |
| 740 | primes are generated using a fast, but memory intensive process. |
| 741 | These candidate primes are then tested for suitability (a CPU-intensive |
| 742 | process). |
| 743 | .Pp |
| 744 | Generation of primes is performed using the |
| 745 | .Fl G |
| 746 | option. |
| 747 | The desired length of the primes may be specified by the |
| 748 | .Fl b |
| 749 | option. |
| 750 | For example: |
| 751 | .Pp |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 752 | .Dl # ssh-keygen -G moduli-2048.candidates -b 2048 |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 753 | .Pp |
| 754 | By default, the search for primes begins at a random point in the |
| 755 | desired length range. |
| 756 | This may be overridden using the |
| 757 | .Fl S |
| 758 | option, which specifies a different start point (in hex). |
| 759 | .Pp |
Damien Miller | dfceafe | 2012-07-06 13:44:19 +1000 | [diff] [blame] | 760 | Once a set of candidates have been generated, they must be screened for |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 761 | suitability. |
| 762 | This may be performed using the |
| 763 | .Fl T |
| 764 | option. |
| 765 | In this mode |
| 766 | .Nm |
| 767 | will read candidates from standard input (or a file specified using the |
| 768 | .Fl f |
| 769 | option). |
| 770 | For example: |
| 771 | .Pp |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 772 | .Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 773 | .Pp |
| 774 | By default, each candidate will be subjected to 100 primality tests. |
| 775 | This may be overridden using the |
| 776 | .Fl a |
| 777 | option. |
| 778 | The DH generator value will be chosen automatically for the |
| 779 | prime under consideration. |
| 780 | If a specific generator is desired, it may be requested using the |
| 781 | .Fl W |
| 782 | option. |
Damien Miller | 265d309 | 2005-03-02 12:05:06 +1100 | [diff] [blame] | 783 | Valid generator values are 2, 3, and 5. |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 784 | .Pp |
| 785 | Screened DH groups may be installed in |
| 786 | .Pa /etc/moduli . |
| 787 | It is important that this file contains moduli of a range of bit lengths and |
| 788 | that both ends of a connection share common moduli. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 789 | .Sh CERTIFICATES |
| 790 | .Nm |
| 791 | supports signing of keys to produce certificates that may be used for |
| 792 | user or host authentication. |
| 793 | Certificates consist of a public key, some identity information, zero or |
Damien Miller | 1f18142 | 2010-04-18 08:08:03 +1000 | [diff] [blame] | 794 | more principal (user or host) names and a set of options that |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 795 | are signed by a Certification Authority (CA) key. |
| 796 | Clients or servers may then trust only the CA key and verify its signature |
| 797 | on a certificate rather than trusting many user/host keys. |
| 798 | Note that OpenSSH certificates are a different, and much simpler, format to |
| 799 | the X.509 certificates used in |
| 800 | .Xr ssl 8 . |
| 801 | .Pp |
| 802 | .Nm |
| 803 | supports two types of certificates: user and host. |
| 804 | User certificates authenticate users to servers, whereas host certificates |
Damien Miller | 15f5b56 | 2010-03-03 10:25:21 +1100 | [diff] [blame] | 805 | authenticate server hosts to users. |
| 806 | To generate a user certificate: |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 807 | .Pp |
| 808 | .Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub |
| 809 | .Pp |
| 810 | The resultant certificate will be placed in |
Damien Miller | 1b61a28 | 2010-03-22 05:55:06 +1100 | [diff] [blame] | 811 | .Pa /path/to/user_key-cert.pub . |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 812 | A host certificate requires the |
| 813 | .Fl h |
| 814 | option: |
| 815 | .Pp |
| 816 | .Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub |
| 817 | .Pp |
| 818 | The host certificate will be output to |
Damien Miller | 1b61a28 | 2010-03-22 05:55:06 +1100 | [diff] [blame] | 819 | .Pa /path/to/host_key-cert.pub . |
Damien Miller | 757f34e | 2010-08-05 13:05:31 +1000 | [diff] [blame] | 820 | .Pp |
| 821 | It is possible to sign using a CA key stored in a PKCS#11 token by |
| 822 | providing the token library using |
| 823 | .Fl D |
| 824 | and identifying the CA key by providing its public half as an argument |
| 825 | to |
| 826 | .Fl s : |
| 827 | .Pp |
naddy@openbsd.org | 05291e5 | 2015-08-20 19:20:06 +0000 | [diff] [blame] | 828 | .Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub |
Damien Miller | 757f34e | 2010-08-05 13:05:31 +1000 | [diff] [blame] | 829 | .Pp |
djm@openbsd.org | a98339e | 2017-06-28 01:09:22 +0000 | [diff] [blame] | 830 | Similarly, it is possible for the CA key to be hosted in a |
| 831 | .Xr ssh-agent 1 . |
| 832 | This is indicated by the |
| 833 | .Fl U |
| 834 | flag and, again, the CA key must be identified by its public half. |
| 835 | .Pp |
| 836 | .Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub |
| 837 | .Pp |
Damien Miller | 757f34e | 2010-08-05 13:05:31 +1000 | [diff] [blame] | 838 | In all cases, |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 839 | .Ar key_id |
| 840 | is a "key identifier" that is logged by the server when the certificate |
| 841 | is used for authentication. |
| 842 | .Pp |
| 843 | Certificates may be limited to be valid for a set of principal (user/host) |
| 844 | names. |
| 845 | By default, generated certificates are valid for all users or hosts. |
| 846 | To generate a certificate for a specified set of principals: |
| 847 | .Pp |
| 848 | .Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub |
naddy@openbsd.org | 05291e5 | 2015-08-20 19:20:06 +0000 | [diff] [blame] | 849 | .Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub" |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 850 | .Pp |
| 851 | Additional limitations on the validity and use of user certificates may |
Damien Miller | 1f18142 | 2010-04-18 08:08:03 +1000 | [diff] [blame] | 852 | be specified through certificate options. |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 853 | A certificate option may disable features of the SSH session, may be |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 854 | valid only when presented from particular source addresses or may |
| 855 | force the use of a specific command. |
Damien Miller | 4e270b0 | 2010-04-16 15:56:21 +1000 | [diff] [blame] | 856 | For a list of valid certificate options, see the documentation for the |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 857 | .Fl O |
| 858 | option above. |
| 859 | .Pp |
| 860 | Finally, certificates may be defined with a validity lifetime. |
| 861 | The |
| 862 | .Fl V |
| 863 | option allows specification of certificate start and end times. |
| 864 | A certificate that is presented at a time outside this range will not be |
| 865 | considered valid. |
Darren Tucker | 3ee50c5 | 2012-09-06 21:18:11 +1000 | [diff] [blame] | 866 | By default, certificates are valid from |
| 867 | .Ux |
| 868 | Epoch to the distant future. |
Damien Miller | 0a80ca1 | 2010-02-27 07:55:05 +1100 | [diff] [blame] | 869 | .Pp |
| 870 | For certificates to be used for user or host authentication, the CA |
| 871 | public key must be trusted by |
| 872 | .Xr sshd 8 |
| 873 | or |
| 874 | .Xr ssh 1 . |
| 875 | Please refer to those manual pages for details. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 876 | .Sh KEY REVOCATION LISTS |
| 877 | .Nm |
| 878 | is able to manage OpenSSH format Key Revocation Lists (KRLs). |
| 879 | These binary files specify keys or certificates to be revoked using a |
Damien Miller | 1379771 | 2013-12-29 17:47:14 +1100 | [diff] [blame] | 880 | compact format, taking as little as one bit per certificate if they are being |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 881 | revoked by serial number. |
| 882 | .Pp |
| 883 | KRLs may be generated using the |
| 884 | .Fl k |
| 885 | flag. |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 886 | This option reads one or more files from the command line and generates a new |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 887 | KRL. |
| 888 | The files may either contain a KRL specification (see below) or public keys, |
| 889 | listed one per line. |
| 890 | Plain public keys are revoked by listing their hash or contents in the KRL and |
| 891 | certificates revoked by serial number or key ID (if the serial is zero or |
| 892 | not available). |
| 893 | .Pp |
| 894 | Revoking keys using a KRL specification offers explicit control over the |
| 895 | types of record used to revoke keys and may be used to directly revoke |
| 896 | certificates by serial number or key ID without having the complete original |
| 897 | certificate on hand. |
| 898 | A KRL specification consists of lines containing one of the following directives |
| 899 | followed by a colon and some directive-specific information. |
| 900 | .Bl -tag -width Ds |
Damien Miller | a0a7ee8 | 2013-01-20 22:35:06 +1100 | [diff] [blame] | 901 | .It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 902 | Revokes a certificate with the specified serial number. |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 903 | Serial numbers are 64-bit values, not including zero and may be expressed |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 904 | in decimal, hex or octal. |
| 905 | If two serial numbers are specified separated by a hyphen, then the range |
| 906 | of serial numbers including and between each is revoked. |
| 907 | The CA key must have been specified on the |
| 908 | .Nm |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 909 | command line using the |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 910 | .Fl s |
| 911 | option. |
| 912 | .It Cm id : Ar key_id |
| 913 | Revokes a certificate with the specified key ID string. |
| 914 | The CA key must have been specified on the |
| 915 | .Nm |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 916 | command line using the |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 917 | .Fl s |
| 918 | option. |
| 919 | .It Cm key : Ar public_key |
| 920 | Revokes the specified key. |
Damien Miller | ac5542b | 2013-01-20 22:33:02 +1100 | [diff] [blame] | 921 | If a certificate is listed, then it is revoked as a plain public key. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 922 | .It Cm sha1 : Ar public_key |
djm@openbsd.org | 9405c62 | 2018-09-12 01:21:34 +0000 | [diff] [blame] | 923 | Revokes the specified key by including its SHA1 hash in the KRL. |
| 924 | .It Cm sha256 : Ar public_key |
| 925 | Revokes the specified key by including its SHA256 hash in the KRL. |
| 926 | KRLs that revoke keys by SHA256 hash are not supported by OpenSSH versions |
| 927 | prior to 7.9. |
| 928 | .It Cm hash : Ar fingerprint |
djm@openbsd.org | f0fcd7e | 2018-09-12 06:18:59 +0000 | [diff] [blame] | 929 | Revokes a key using a fingerprint hash, as obtained from a |
djm@openbsd.org | 9405c62 | 2018-09-12 01:21:34 +0000 | [diff] [blame] | 930 | .Xr sshd 8 |
| 931 | authentication log message or the |
| 932 | .Nm |
| 933 | .Fl l |
| 934 | flag. |
| 935 | Only SHA256 fingerprints are supported here and resultant KRLs are |
| 936 | not supported by OpenSSH versions prior to 7.9. |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 937 | .El |
| 938 | .Pp |
| 939 | KRLs may be updated using the |
| 940 | .Fl u |
| 941 | flag in addition to |
| 942 | .Fl k . |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 943 | When this option is specified, keys listed via the command line are merged into |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 944 | the KRL, adding to those already there. |
| 945 | .Pp |
| 946 | It is also possible, given a KRL, to test whether it revokes a particular key |
| 947 | (or keys). |
| 948 | The |
| 949 | .Fl Q |
jmc@openbsd.org | 8b29008 | 2015-11-05 09:48:05 +0000 | [diff] [blame] | 950 | flag will query an existing KRL, testing each key specified on the command line. |
Damien Miller | 881a7a2 | 2013-01-20 22:34:46 +1100 | [diff] [blame] | 951 | If any key listed on the command line has been revoked (or an error encountered) |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 952 | then |
| 953 | .Nm |
| 954 | will exit with a non-zero exit status. |
| 955 | A zero exit status will only be returned if no key was revoked. |
djm@openbsd.org | 2a9c9f7 | 2019-09-03 08:34:19 +0000 | [diff] [blame] | 956 | .Sh ALLOWED SIGNERS |
| 957 | When verifying signatures, |
| 958 | .Nm |
| 959 | uses a simple list of identities and keys to determine whether a signature |
| 960 | comes from an authorized source. |
| 961 | This "allowed signers" file uses a format patterned after the |
| 962 | AUTHORIZED_KEYS FILE FORMAT described in |
| 963 | .Xr sshd(8) . |
| 964 | Each line of the file contains the following space-separated fields: |
| 965 | principals, options, keytype, base64-encoded key. |
| 966 | Empty lines and lines starting with a |
| 967 | .Ql # |
| 968 | are ignored as comments. |
| 969 | .Pp |
| 970 | The principals field is a pattern-list (See PATTERNS in |
| 971 | .Xr ssh_config 5 ) |
| 972 | consisting of one or more comma-separated USER@DOMAIN identity patterns |
| 973 | that are accepted for signing. |
| 974 | When verifying, the identity presented via the |
| 975 | .Fl I option |
| 976 | must match a principals pattern in order for the corresponding key to be |
| 977 | considered acceptable for verification. |
| 978 | .Pp |
| 979 | The options (if present) consist of comma-separated option specifications. |
| 980 | No spaces are permitted, except within double quotes. |
| 981 | The following option specifications are supported (note that option keywords |
| 982 | are case-insensitive): |
| 983 | .Bl -tag -width Ds |
| 984 | .It Cm cert-authority |
| 985 | Indicates that this key is accepted as a certificate authority (CA) and |
| 986 | that certificates signed by this CA may be accepted for verification. |
| 987 | .It Cm namespaces="namespace-list" |
| 988 | Specifies a pattern-list of namespaces that are accepted for this key. |
djm@openbsd.org | d637c4a | 2019-09-03 08:35:27 +0000 | [diff] [blame^] | 989 | If this option is present, the signature namespace embedded in the |
djm@openbsd.org | 2a9c9f7 | 2019-09-03 08:34:19 +0000 | [diff] [blame] | 990 | signature object and presented on the verification command-line must |
| 991 | match the specified list before the key will be considered acceptable. |
| 992 | .El |
| 993 | .Pp |
| 994 | When verifying signatures made by certificates, the expected principal |
| 995 | name must match both the principals pattern in the allowed signers file and |
| 996 | the principals embedded in the certificate itself. |
| 997 | .Pp |
| 998 | An example allowed signers file: |
| 999 | .Bd -literal -offset 3n |
| 1000 | # Comments allowed at start of line |
| 1001 | user1@example.com,user2@example.com ssh-rsa AAAAX1... |
| 1002 | # A certificate authority, trusted for all principals in a domain. |
| 1003 | *@example.com cert-authority ssh-ed25519 AAAB4... |
| 1004 | # A key that is accepted only for file signing. |
| 1005 | user2@example.com namespaces="file" ssh-ed25519 AAA41... |
| 1006 | .Ed |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 1007 | .Sh FILES |
Damien Miller | 6186bbc | 2010-09-24 22:00:54 +1000 | [diff] [blame] | 1008 | .Bl -tag -width Ds -compact |
Damien Miller | 167ea5d | 2005-05-26 12:04:02 +1000 | [diff] [blame] | 1009 | .It Pa ~/.ssh/id_dsa |
Damien Miller | 6186bbc | 2010-09-24 22:00:54 +1000 | [diff] [blame] | 1010 | .It Pa ~/.ssh/id_ecdsa |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 1011 | .It Pa ~/.ssh/id_ed25519 |
Damien Miller | 167ea5d | 2005-05-26 12:04:02 +1000 | [diff] [blame] | 1012 | .It Pa ~/.ssh/id_rsa |
naddy@openbsd.org | 2e9c324 | 2017-05-05 10:41:58 +0000 | [diff] [blame] | 1013 | Contains the DSA, ECDSA, Ed25519 or RSA |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 1014 | authentication identity of the user. |
Ben Lindstrom | 18a82ac | 2001-04-11 15:59:35 +0000 | [diff] [blame] | 1015 | This file should not be readable by anyone but the user. |
| 1016 | It is possible to |
| 1017 | specify a passphrase when generating the key; that passphrase will be |
Darren Tucker | 199ee6f | 2009-10-24 11:50:17 +1100 | [diff] [blame] | 1018 | used to encrypt the private part of this file using 128-bit AES. |
Ben Lindstrom | 18a82ac | 2001-04-11 15:59:35 +0000 | [diff] [blame] | 1019 | This file is not automatically accessed by |
| 1020 | .Nm |
| 1021 | but it is offered as the default file for the private key. |
Ben Lindstrom | bda98b0 | 2001-07-04 03:35:24 +0000 | [diff] [blame] | 1022 | .Xr ssh 1 |
Ben Lindstrom | 18a82ac | 2001-04-11 15:59:35 +0000 | [diff] [blame] | 1023 | will read this file when a login attempt is made. |
Damien Miller | 6186bbc | 2010-09-24 22:00:54 +1000 | [diff] [blame] | 1024 | .Pp |
| 1025 | .It Pa ~/.ssh/id_dsa.pub |
| 1026 | .It Pa ~/.ssh/id_ecdsa.pub |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 1027 | .It Pa ~/.ssh/id_ed25519.pub |
Damien Miller | 167ea5d | 2005-05-26 12:04:02 +1000 | [diff] [blame] | 1028 | .It Pa ~/.ssh/id_rsa.pub |
naddy@openbsd.org | 2e9c324 | 2017-05-05 10:41:58 +0000 | [diff] [blame] | 1029 | Contains the DSA, ECDSA, Ed25519 or RSA |
Damien Miller | 8ba0ead | 2013-12-18 17:46:27 +1100 | [diff] [blame] | 1030 | public key for authentication. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 1031 | The contents of this file should be added to |
Damien Miller | 167ea5d | 2005-05-26 12:04:02 +1000 | [diff] [blame] | 1032 | .Pa ~/.ssh/authorized_keys |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 1033 | on all machines |
Ben Lindstrom | 594e203 | 2001-09-12 18:35:30 +0000 | [diff] [blame] | 1034 | where the user wishes to log in using public key authentication. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 1035 | There is no need to keep the contents of this file secret. |
Damien Miller | 6186bbc | 2010-09-24 22:00:54 +1000 | [diff] [blame] | 1036 | .Pp |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 1037 | .It Pa /etc/moduli |
| 1038 | Contains Diffie-Hellman groups used for DH-GEX. |
| 1039 | The file format is described in |
| 1040 | .Xr moduli 5 . |
Damien Miller | 3702396 | 2000-07-11 17:31:38 +1000 | [diff] [blame] | 1041 | .El |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 1042 | .Sh SEE ALSO |
| 1043 | .Xr ssh 1 , |
| 1044 | .Xr ssh-add 1 , |
Damien Miller | 2e8b1c8 | 1999-11-15 23:33:56 +1100 | [diff] [blame] | 1045 | .Xr ssh-agent 1 , |
Darren Tucker | 019cefe | 2003-08-02 22:40:07 +1000 | [diff] [blame] | 1046 | .Xr moduli 5 , |
Ben Lindstrom | 77788dc | 2001-02-10 23:10:33 +0000 | [diff] [blame] | 1047 | .Xr sshd 8 |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 1048 | .Rs |
Damien Miller | c0367fb | 2007-01-05 16:25:46 +1100 | [diff] [blame] | 1049 | .%R RFC 4716 |
| 1050 | .%T "The Secure Shell (SSH) Public Key File Format" |
| 1051 | .%D 2006 |
Ben Lindstrom | 5a70782 | 2001-04-22 17:15:46 +0000 | [diff] [blame] | 1052 | .Re |
Damien Miller | f1ce505 | 2003-06-11 22:04:39 +1000 | [diff] [blame] | 1053 | .Sh AUTHORS |
| 1054 | OpenSSH is a derivative of the original and free |
| 1055 | ssh 1.2.12 release by Tatu Ylonen. |
| 1056 | Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, |
| 1057 | Theo de Raadt and Dug Song |
| 1058 | removed many bugs, re-added newer features and |
| 1059 | created OpenSSH. |
| 1060 | Markus Friedl contributed the support for SSH |
| 1061 | protocol versions 1.5 and 2.0. |