summaryrefslogtreecommitdiff
path: root/ssh-keygen.1
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.1')
-rw-r--r--ssh-keygen.1194
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
146generates, manages and converts authentication keys for 159generates, manages and converts authentication keys for
@@ -243,21 +256,21 @@ has also been specified, its argument is used as a prefix to the
243default path for the resulting host key files. 256default path for the resulting host key files.
244This is used by system administration scripts to generate new host keys. 257This is used by system administration scripts to generate new host keys.
245.It Fl a Ar rounds 258.It Fl a Ar rounds
246When saving a private key this option specifies the number of KDF 259When saving a private key, this option specifies the number of KDF
247(key derivation function) rounds used. 260(key derivation function) rounds used.
248Higher numbers result in slower passphrase verification and increased 261Higher numbers result in slower passphrase verification and increased
249resistance to brute-force password cracking (should the keys be stolen). 262resistance to brute-force password cracking (should the keys be stolen).
250.Pp 263.Pp
251When screening DH-GEX candidates (using the 264When screening DH-GEX candidates (using the
252.Fl T 265.Fl T
253command). 266command),
254This option specifies the number of primality tests to perform. 267this option specifies the number of primality tests to perform.
255.It Fl B 268.It Fl B
256Show the bubblebabble digest of specified private or public key file. 269Show the bubblebabble digest of specified private or public key file.
257.It Fl b Ar bits 270.It Fl b Ar bits
258Specifies the number of bits in the key to create. 271Specifies the number of bits in the key to create.
259For RSA keys, the minimum size is 1024 bits and the default is 2048 bits. 272For RSA keys, the minimum size is 1024 bits and the default is 3072 bits.
260Generally, 2048 bits is considered sufficient. 273Generally, 3072 bits is considered sufficient.
261DSA keys must be exactly 1024 bits as specified by FIPS 186-2. 274DSA keys must be exactly 1024 bits as specified by FIPS 186-2.
262For ECDSA keys, the 275For 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)
419or 432or
420.Dq PEM 433.Dq PEM
421(PEM public key). 434(PEM public key).
422The default conversion format is 435By default OpenSSH will write newly-generated private keys in its own
436format, but when converting public keys for export the default format is
423.Dq RFC4716 . 437.Dq RFC4716 .
424Setting a format of 438Setting a format of
425.Dq PEM 439.Dq PEM
@@ -573,6 +587,16 @@ The possible values are
573.Dq ed25519 , 587.Dq ed25519 ,
574or 588or
575.Dq rsa . 589.Dq rsa .
590.Pp
591This flag may also be used to specify the desired signature type when
592signing certificates using an RSA CA key.
593The available RSA signature variants are
594.Dq ssh-rsa
595(SHA1 signatures, not recommended),
596.Dq rsa-sha2-256 ,
597and
598.Dq rsa-sha2-512
599(the default).
576.It Fl U 600.It Fl U
577When used in combination with 601When 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
634This option will read a private 658This option will read a private
635OpenSSH format file and print an OpenSSH public key to stdout. 659OpenSSH format file and print an OpenSSH public key to stdout.
660.It Fl Y Cm sign
661Cryptographically sign a file or some data using a SSH key.
662When signing,
663.Nm
664accepts zero or more files to sign on the command-line - if no files
665are specified then
666.Nm
667will sign data presented on standard input.
668Signatures are written to the path of the input file with
669.Dq .sig
670appended, or to standard output if the message to be signed was read from
671standard input.
672.Pp
673The key used for signing is specified using the
674.Fl f
675option and may refer to either a private key, or a public key with the private
676half available via
677.Xr ssh-agent 1 .
678An additional signature namespace, used to prevent signature confusion across
679different domains of use (e.g. file signing vs email signing) must be provided
680via the
681.Fl n
682flag.
683Namespaces are arbitrary strings, and may include:
684.Dq file
685for file signing,
686.Dq email
687for email signing.
688For custom uses, it is recommended to use names following a
689NAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces.
690.It Fl Y Cm verify
691Request to verify a signature generated using
692.Nm
693.Fl Y Cm sign
694as described above.
695When verifying a signature,
696.Nm
697accepts a message on standard input and a signature namespace using
698.Fl n .
699A file containing the corresponding signature must also be supplied using the
700.Fl s
701flag, along with the identity of the signer using
702.Fl I
703and a list of allowed signers via the
704.Fl f
705flag.
706The format of the allowed signers file is documented in the
707.Sx ALLOWED SIGNERS
708section below.
709A file containing revoked keys can be passed using the
710.Fl r
711flag.
712The revocation file may be a KRL or a one-per-line list of public keys.
713Successful verification by an authorized signer is signalled by
714.Nm
715.It Fl Y Cm check-novalidate
716Checks that a signature generated using
717.Nm
718.Fl Y Cm sign
719has a valid structure.
720This does not validate if a signature comes from an authorized signer.
721When testing a signature,
722.Nm
723accepts a message on standard input and a signature namespace using
724.Fl n .
725A file containing the corresponding signature must also be supplied using the
726.Fl s
727flag.
728Successful testing of the signature is signalled by
729.Nm
730returning a zero exit status.
636.It Fl z Ar serial_number 731.It Fl z Ar serial_number
637Specifies a serial number to be embedded in the certificate to distinguish 732Specifies a serial number to be embedded in the certificate to distinguish
638this certificate from others from the same CA. 733this certificate from others from the same CA.
@@ -869,6 +964,57 @@ then
869.Nm 964.Nm
870will exit with a non-zero exit status. 965will exit with a non-zero exit status.
871A zero exit status will only be returned if no key was revoked. 966A zero exit status will only be returned if no key was revoked.
967.Sh ALLOWED SIGNERS
968When verifying signatures,
969.Nm
970uses a simple list of identities and keys to determine whether a signature
971comes from an authorized source.
972This "allowed signers" file uses a format patterned after the
973AUTHORIZED_KEYS FILE FORMAT described in
974.Xr sshd 8 .
975Each line of the file contains the following space-separated fields:
976principals, options, keytype, base64-encoded key.
977Empty lines and lines starting with a
978.Ql #
979are ignored as comments.
980.Pp
981The principals field is a pattern-list (See PATTERNS in
982.Xr ssh_config 5 )
983consisting of one or more comma-separated USER@DOMAIN identity patterns
984that are accepted for signing.
985When verifying, the identity presented via the
986.Fl I option
987must match a principals pattern in order for the corresponding key to be
988considered acceptable for verification.
989.Pp
990The options (if present) consist of comma-separated option specifications.
991No spaces are permitted, except within double quotes.
992The following option specifications are supported (note that option keywords
993are case-insensitive):
994.Bl -tag -width Ds
995.It Cm cert-authority
996Indicates that this key is accepted as a certificate authority (CA) and
997that certificates signed by this CA may be accepted for verification.
998.It Cm namespaces="namespace-list"
999Specifies a pattern-list of namespaces that are accepted for this key.
1000If this option is present, the signature namespace embedded in the
1001signature object and presented on the verification command-line must
1002match the specified list before the key will be considered acceptable.
1003.El
1004.Pp
1005When verifying signatures made by certificates, the expected principal
1006name must match both the principals pattern in the allowed signers file and
1007the principals embedded in the certificate itself.
1008.Pp
1009An example allowed signers file:
1010.Bd -literal -offset 3n
1011# Comments allowed at start of line
1012user1@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.
1016user2@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