diff options
Diffstat (limited to 'ssh-keygen.1')
-rw-r--r-- | ssh-keygen.1 | 194 |
1 files changed, 170 insertions, 24 deletions
diff --git a/ssh-keygen.1 b/ssh-keygen.1 index 9b877b860..143a2349f 100644 --- a/ssh-keygen.1 +++ b/ssh-keygen.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-keygen.1,v 1.157 2019/03/05 16:17:12 naddy Exp $ | 1 | .\" $OpenBSD: ssh-keygen.1,v 1.171 2019/10/03 17:07:50 jmc Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,44 +35,43 @@ | |||
35 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 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. | 36 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
37 | .\" | 37 | .\" |
38 | .Dd $Mdocdate: March 5 2019 $ | 38 | .Dd $Mdocdate: October 3 2019 $ |
39 | .Dt SSH-KEYGEN 1 | 39 | .Dt SSH-KEYGEN 1 |
40 | .Os | 40 | .Os |
41 | .Sh NAME | 41 | .Sh NAME |
42 | .Nm ssh-keygen | 42 | .Nm ssh-keygen |
43 | .Nd authentication key generation, management and conversion | 43 | .Nd authentication key generation, management and conversion |
44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
45 | .Bk -words | ||
46 | .Nm ssh-keygen | 45 | .Nm ssh-keygen |
47 | .Op Fl q | 46 | .Op Fl q |
48 | .Op Fl b Ar bits | 47 | .Op Fl b Ar bits |
49 | .Op Fl t Cm dsa | ecdsa | ed25519 | rsa | ||
50 | .Op Fl N Ar new_passphrase | ||
51 | .Op Fl C Ar comment | 48 | .Op Fl C Ar comment |
52 | .Op Fl f Ar output_keyfile | 49 | .Op Fl f Ar output_keyfile |
53 | .Op Fl m Ar format | 50 | .Op Fl m Ar format |
51 | .Op Fl N Ar new_passphrase | ||
52 | .Op Fl t Cm dsa | ecdsa | ed25519 | rsa | ||
54 | .Nm ssh-keygen | 53 | .Nm ssh-keygen |
55 | .Fl p | 54 | .Fl p |
56 | .Op Fl P Ar old_passphrase | ||
57 | .Op Fl N Ar new_passphrase | ||
58 | .Op Fl f Ar keyfile | 55 | .Op Fl f Ar keyfile |
59 | .Op Fl m Ar format | 56 | .Op Fl m Ar format |
57 | .Op Fl N Ar new_passphrase | ||
58 | .Op Fl P Ar old_passphrase | ||
60 | .Nm ssh-keygen | 59 | .Nm ssh-keygen |
61 | .Fl i | 60 | .Fl i |
62 | .Op Fl m Ar key_format | ||
63 | .Op Fl f Ar input_keyfile | 61 | .Op Fl f Ar input_keyfile |
62 | .Op Fl m Ar key_format | ||
64 | .Nm ssh-keygen | 63 | .Nm ssh-keygen |
65 | .Fl e | 64 | .Fl e |
66 | .Op Fl m Ar key_format | ||
67 | .Op Fl f Ar input_keyfile | 65 | .Op Fl f Ar input_keyfile |
66 | .Op Fl m Ar key_format | ||
68 | .Nm ssh-keygen | 67 | .Nm ssh-keygen |
69 | .Fl y | 68 | .Fl y |
70 | .Op Fl f Ar input_keyfile | 69 | .Op Fl f Ar input_keyfile |
71 | .Nm ssh-keygen | 70 | .Nm ssh-keygen |
72 | .Fl c | 71 | .Fl c |
73 | .Op Fl P Ar passphrase | ||
74 | .Op Fl C Ar comment | 72 | .Op Fl C Ar comment |
75 | .Op Fl f Ar keyfile | 73 | .Op Fl f Ar keyfile |
74 | .Op Fl P Ar passphrase | ||
76 | .Nm ssh-keygen | 75 | .Nm ssh-keygen |
77 | .Fl l | 76 | .Fl l |
78 | .Op Fl v | 77 | .Op Fl v |
@@ -85,8 +84,8 @@ | |||
85 | .Fl D Ar pkcs11 | 84 | .Fl D Ar pkcs11 |
86 | .Nm ssh-keygen | 85 | .Nm ssh-keygen |
87 | .Fl F Ar hostname | 86 | .Fl F Ar hostname |
87 | .Op Fl lv | ||
88 | .Op Fl f Ar known_hosts_file | 88 | .Op Fl f Ar known_hosts_file |
89 | .Op Fl l | ||
90 | .Nm ssh-keygen | 89 | .Nm ssh-keygen |
91 | .Fl H | 90 | .Fl H |
92 | .Op Fl f Ar known_hosts_file | 91 | .Op Fl f Ar known_hosts_file |
@@ -95,8 +94,8 @@ | |||
95 | .Op Fl f Ar known_hosts_file | 94 | .Op Fl f Ar known_hosts_file |
96 | .Nm ssh-keygen | 95 | .Nm ssh-keygen |
97 | .Fl r Ar hostname | 96 | .Fl r Ar hostname |
98 | .Op Fl f Ar input_keyfile | ||
99 | .Op Fl g | 97 | .Op Fl g |
98 | .Op Fl f Ar input_keyfile | ||
100 | .Nm ssh-keygen | 99 | .Nm ssh-keygen |
101 | .Fl G Ar output_file | 100 | .Fl G Ar output_file |
102 | .Op Fl v | 101 | .Op Fl v |
@@ -104,8 +103,8 @@ | |||
104 | .Op Fl M Ar memory | 103 | .Op Fl M Ar memory |
105 | .Op Fl S Ar start_point | 104 | .Op Fl S Ar start_point |
106 | .Nm ssh-keygen | 105 | .Nm ssh-keygen |
107 | .Fl T Ar output_file | ||
108 | .Fl f Ar input_file | 106 | .Fl f Ar input_file |
107 | .Fl T Ar output_file | ||
109 | .Op Fl v | 108 | .Op Fl v |
110 | .Op Fl a Ar rounds | 109 | .Op Fl a Ar rounds |
111 | .Op Fl J Ar num_lines | 110 | .Op Fl J Ar num_lines |
@@ -113,10 +112,9 @@ | |||
113 | .Op Fl K Ar checkpt | 112 | .Op Fl K Ar checkpt |
114 | .Op Fl W Ar generator | 113 | .Op Fl W Ar generator |
115 | .Nm ssh-keygen | 114 | .Nm ssh-keygen |
116 | .Fl s Ar ca_key | ||
117 | .Fl I Ar certificate_identity | 115 | .Fl I Ar certificate_identity |
118 | .Op Fl h | 116 | .Fl s Ar ca_key |
119 | .Op Fl U | 117 | .Op Fl hU |
120 | .Op Fl D Ar pkcs11_provider | 118 | .Op Fl D Ar pkcs11_provider |
121 | .Op Fl n Ar principals | 119 | .Op Fl n Ar principals |
122 | .Op Fl O Ar option | 120 | .Op Fl O Ar option |
@@ -140,7 +138,22 @@ | |||
140 | .Fl Q | 138 | .Fl Q |
141 | .Fl f Ar krl_file | 139 | .Fl f Ar krl_file |
142 | .Ar | 140 | .Ar |
143 | .Ek | 141 | .Nm ssh-keygen |
142 | .Fl Y Cm check-novalidate | ||
143 | .Fl n Ar namespace | ||
144 | .Fl s Ar signature_file | ||
145 | .Nm ssh-keygen | ||
146 | .Fl Y Cm sign | ||
147 | .Fl f Ar key_file | ||
148 | .Fl n Ar namespace | ||
149 | .Ar | ||
150 | .Nm ssh-keygen | ||
151 | .Fl Y Cm verify | ||
152 | .Fl f Ar allowed_signers_file | ||
153 | .Fl I Ar signer_identity | ||
154 | .Fl n Ar namespace | ||
155 | .Fl s Ar signature_file | ||
156 | .Op Fl r Ar revocation_file | ||
144 | .Sh DESCRIPTION | 157 | .Sh DESCRIPTION |
145 | .Nm | 158 | .Nm |
146 | generates, manages and converts authentication keys for | 159 | generates, manages and converts authentication keys for |
@@ -243,21 +256,21 @@ has also been specified, its argument is used as a prefix to the | |||
243 | default path for the resulting host key files. | 256 | default path for the resulting host key files. |
244 | This is used by system administration scripts to generate new host keys. | 257 | This is used by system administration scripts to generate new host keys. |
245 | .It Fl a Ar rounds | 258 | .It Fl a Ar rounds |
246 | When saving a private key this option specifies the number of KDF | 259 | When saving a private key, this option specifies the number of KDF |
247 | (key derivation function) rounds used. | 260 | (key derivation function) rounds used. |
248 | Higher numbers result in slower passphrase verification and increased | 261 | Higher numbers result in slower passphrase verification and increased |
249 | resistance to brute-force password cracking (should the keys be stolen). | 262 | resistance to brute-force password cracking (should the keys be stolen). |
250 | .Pp | 263 | .Pp |
251 | When screening DH-GEX candidates (using the | 264 | When screening DH-GEX candidates (using the |
252 | .Fl T | 265 | .Fl T |
253 | command). | 266 | command), |
254 | This option specifies the number of primality tests to perform. | 267 | this option specifies the number of primality tests to perform. |
255 | .It Fl B | 268 | .It Fl B |
256 | Show the bubblebabble digest of specified private or public key file. | 269 | Show the bubblebabble digest of specified private or public key file. |
257 | .It Fl b Ar bits | 270 | .It Fl b Ar bits |
258 | Specifies the number of bits in the key to create. | 271 | Specifies the number of bits in the key to create. |
259 | For RSA keys, the minimum size is 1024 bits and the default is 2048 bits. | 272 | For RSA keys, the minimum size is 1024 bits and the default is 3072 bits. |
260 | Generally, 2048 bits is considered sufficient. | 273 | Generally, 3072 bits is considered sufficient. |
261 | DSA keys must be exactly 1024 bits as specified by FIPS 186-2. | 274 | DSA keys must be exactly 1024 bits as specified by FIPS 186-2. |
262 | For ECDSA keys, the | 275 | For ECDSA keys, the |
263 | .Fl b | 276 | .Fl b |
@@ -415,11 +428,12 @@ The supported key formats are: | |||
415 | .Dq RFC4716 | 428 | .Dq RFC4716 |
416 | (RFC 4716/SSH2 public or private key), | 429 | (RFC 4716/SSH2 public or private key), |
417 | .Dq PKCS8 | 430 | .Dq PKCS8 |
418 | (PEM PKCS8 public key) | 431 | (PKCS8 public or private key) |
419 | or | 432 | or |
420 | .Dq PEM | 433 | .Dq PEM |
421 | (PEM public key). | 434 | (PEM public key). |
422 | The default conversion format is | 435 | By default OpenSSH will write newly-generated private keys in its own |
436 | format, but when converting public keys for export the default format is | ||
423 | .Dq RFC4716 . | 437 | .Dq RFC4716 . |
424 | Setting a format of | 438 | Setting a format of |
425 | .Dq PEM | 439 | .Dq PEM |
@@ -573,6 +587,16 @@ The possible values are | |||
573 | .Dq ed25519 , | 587 | .Dq ed25519 , |
574 | or | 588 | or |
575 | .Dq rsa . | 589 | .Dq rsa . |
590 | .Pp | ||
591 | This flag may also be used to specify the desired signature type when | ||
592 | signing certificates using an RSA CA key. | ||
593 | The available RSA signature variants are | ||
594 | .Dq ssh-rsa | ||
595 | (SHA1 signatures, not recommended), | ||
596 | .Dq rsa-sha2-256 , | ||
597 | and | ||
598 | .Dq rsa-sha2-512 | ||
599 | (the default). | ||
576 | .It Fl U | 600 | .It Fl U |
577 | When used in combination with | 601 | When used in combination with |
578 | .Fl s , | 602 | .Fl s , |
@@ -633,6 +657,77 @@ Specify desired generator when testing candidate moduli for DH-GEX. | |||
633 | .It Fl y | 657 | .It Fl y |
634 | This option will read a private | 658 | This option will read a private |
635 | OpenSSH format file and print an OpenSSH public key to stdout. | 659 | OpenSSH format file and print an OpenSSH public key to stdout. |
660 | .It Fl Y Cm sign | ||
661 | Cryptographically sign a file or some data using a SSH key. | ||
662 | When signing, | ||
663 | .Nm | ||
664 | accepts zero or more files to sign on the command-line - if no files | ||
665 | are specified then | ||
666 | .Nm | ||
667 | will sign data presented on standard input. | ||
668 | Signatures are written to the path of the input file with | ||
669 | .Dq .sig | ||
670 | appended, or to standard output if the message to be signed was read from | ||
671 | standard input. | ||
672 | .Pp | ||
673 | The key used for signing is specified using the | ||
674 | .Fl f | ||
675 | option and may refer to either a private key, or a public key with the private | ||
676 | half available via | ||
677 | .Xr ssh-agent 1 . | ||
678 | An additional signature namespace, used to prevent signature confusion across | ||
679 | different domains of use (e.g. file signing vs email signing) must be provided | ||
680 | via the | ||
681 | .Fl n | ||
682 | flag. | ||
683 | Namespaces are arbitrary strings, and may include: | ||
684 | .Dq file | ||
685 | for file signing, | ||
686 | .Dq email | ||
687 | for email signing. | ||
688 | For custom uses, it is recommended to use names following a | ||
689 | NAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces. | ||
690 | .It Fl Y Cm verify | ||
691 | Request to verify a signature generated using | ||
692 | .Nm | ||
693 | .Fl Y Cm sign | ||
694 | as described above. | ||
695 | When verifying a signature, | ||
696 | .Nm | ||
697 | accepts a message on standard input and a signature namespace using | ||
698 | .Fl n . | ||
699 | A file containing the corresponding signature must also be supplied using the | ||
700 | .Fl s | ||
701 | flag, along with the identity of the signer using | ||
702 | .Fl I | ||
703 | and a list of allowed signers via the | ||
704 | .Fl f | ||
705 | flag. | ||
706 | The format of the allowed signers file is documented in the | ||
707 | .Sx ALLOWED SIGNERS | ||
708 | section below. | ||
709 | A file containing revoked keys can be passed using the | ||
710 | .Fl r | ||
711 | flag. | ||
712 | The revocation file may be a KRL or a one-per-line list of public keys. | ||
713 | Successful verification by an authorized signer is signalled by | ||
714 | .Nm | ||
715 | .It Fl Y Cm check-novalidate | ||
716 | Checks that a signature generated using | ||
717 | .Nm | ||
718 | .Fl Y Cm sign | ||
719 | has a valid structure. | ||
720 | This does not validate if a signature comes from an authorized signer. | ||
721 | When testing a signature, | ||
722 | .Nm | ||
723 | accepts a message on standard input and a signature namespace using | ||
724 | .Fl n . | ||
725 | A file containing the corresponding signature must also be supplied using the | ||
726 | .Fl s | ||
727 | flag. | ||
728 | Successful testing of the signature is signalled by | ||
729 | .Nm | ||
730 | returning a zero exit status. | ||
636 | .It Fl z Ar serial_number | 731 | .It Fl z Ar serial_number |
637 | Specifies a serial number to be embedded in the certificate to distinguish | 732 | Specifies a serial number to be embedded in the certificate to distinguish |
638 | this certificate from others from the same CA. | 733 | this certificate from others from the same CA. |
@@ -869,6 +964,57 @@ then | |||
869 | .Nm | 964 | .Nm |
870 | will exit with a non-zero exit status. | 965 | will exit with a non-zero exit status. |
871 | A zero exit status will only be returned if no key was revoked. | 966 | A zero exit status will only be returned if no key was revoked. |
967 | .Sh ALLOWED SIGNERS | ||
968 | When verifying signatures, | ||
969 | .Nm | ||
970 | uses a simple list of identities and keys to determine whether a signature | ||
971 | comes from an authorized source. | ||
972 | This "allowed signers" file uses a format patterned after the | ||
973 | AUTHORIZED_KEYS FILE FORMAT described in | ||
974 | .Xr sshd 8 . | ||
975 | Each line of the file contains the following space-separated fields: | ||
976 | principals, options, keytype, base64-encoded key. | ||
977 | Empty lines and lines starting with a | ||
978 | .Ql # | ||
979 | are ignored as comments. | ||
980 | .Pp | ||
981 | The principals field is a pattern-list (See PATTERNS in | ||
982 | .Xr ssh_config 5 ) | ||
983 | consisting of one or more comma-separated USER@DOMAIN identity patterns | ||
984 | that are accepted for signing. | ||
985 | When verifying, the identity presented via the | ||
986 | .Fl I option | ||
987 | must match a principals pattern in order for the corresponding key to be | ||
988 | considered acceptable for verification. | ||
989 | .Pp | ||
990 | The options (if present) consist of comma-separated option specifications. | ||
991 | No spaces are permitted, except within double quotes. | ||
992 | The following option specifications are supported (note that option keywords | ||
993 | are case-insensitive): | ||
994 | .Bl -tag -width Ds | ||
995 | .It Cm cert-authority | ||
996 | Indicates that this key is accepted as a certificate authority (CA) and | ||
997 | that certificates signed by this CA may be accepted for verification. | ||
998 | .It Cm namespaces="namespace-list" | ||
999 | Specifies a pattern-list of namespaces that are accepted for this key. | ||
1000 | If this option is present, the signature namespace embedded in the | ||
1001 | signature object and presented on the verification command-line must | ||
1002 | match the specified list before the key will be considered acceptable. | ||
1003 | .El | ||
1004 | .Pp | ||
1005 | When verifying signatures made by certificates, the expected principal | ||
1006 | name must match both the principals pattern in the allowed signers file and | ||
1007 | the principals embedded in the certificate itself. | ||
1008 | .Pp | ||
1009 | An example allowed signers file: | ||
1010 | .Bd -literal -offset 3n | ||
1011 | # Comments allowed at start of line | ||
1012 | user1@example.com,user2@example.com ssh-rsa AAAAX1... | ||
1013 | # A certificate authority, trusted for all principals in a domain. | ||
1014 | *@example.com cert-authority ssh-ed25519 AAAB4... | ||
1015 | # A key that is accepted only for file signing. | ||
1016 | user2@example.com namespaces="file" ssh-ed25519 AAA41... | ||
1017 | .Ed | ||
872 | .Sh FILES | 1018 | .Sh FILES |
873 | .Bl -tag -width Ds -compact | 1019 | .Bl -tag -width Ds -compact |
874 | .It Pa ~/.ssh/id_dsa | 1020 | .It Pa ~/.ssh/id_dsa |