xref: /freebsd/crypto/openssh/ssh-keygen.1 (revision 47dd1d1b619cc035b82b49a91a25544309ff95ae)
1*47dd1d1bSDag-Erling Smørgrav.\"	$OpenBSD: ssh-keygen.1,v 1.147 2018/03/12 00:52:01 djm Exp $
21e8db6e2SBrian Feldman.\"
3511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5511b41d2SMark Murray.\"                    All rights reserved
6511b41d2SMark Murray.\"
7b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software
8b66f2d16SKris Kennaway.\" can be used freely for any purpose.  Any derived versions of this
9b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is
10b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be
11b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell".
12511b41d2SMark Murray.\"
13b66f2d16SKris Kennaway.\"
14b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
15b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
16b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
17b66f2d16SKris Kennaway.\"
18b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without
19b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions
20b66f2d16SKris Kennaway.\" are met:
21b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright
22b66f2d16SKris Kennaway.\"    notice, this list of conditions and the following disclaimer.
23b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright
24b66f2d16SKris Kennaway.\"    notice, this list of conditions and the following disclaimer in the
25b66f2d16SKris Kennaway.\"    documentation and/or other materials provided with the distribution.
26b66f2d16SKris Kennaway.\"
27b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37511b41d2SMark Murray.\"
38*47dd1d1bSDag-Erling Smørgrav.Dd $Mdocdate: March 12 2018 $
39511b41d2SMark Murray.Dt SSH-KEYGEN 1
40511b41d2SMark Murray.Os
41511b41d2SMark Murray.Sh NAME
42511b41d2SMark Murray.Nm ssh-keygen
431e8db6e2SBrian Feldman.Nd authentication key generation, management and conversion
44511b41d2SMark Murray.Sh SYNOPSIS
45d0c8c0bcSDag-Erling Smørgrav.Bk -words
46e2f6069cSDag-Erling Smørgrav.Nm ssh-keygen
471e8db6e2SBrian Feldman.Op Fl q
48511b41d2SMark Murray.Op Fl b Ar bits
494f52dfbbSDag-Erling Smørgrav.Op Fl t Cm dsa | ecdsa | ed25519 | rsa
50511b41d2SMark Murray.Op Fl N Ar new_passphrase
51511b41d2SMark Murray.Op Fl C Ar comment
52b66f2d16SKris Kennaway.Op Fl f Ar output_keyfile
53511b41d2SMark Murray.Nm ssh-keygen
54511b41d2SMark Murray.Fl p
55511b41d2SMark Murray.Op Fl P Ar old_passphrase
56511b41d2SMark Murray.Op Fl N Ar new_passphrase
57511b41d2SMark Murray.Op Fl f Ar keyfile
58511b41d2SMark Murray.Nm ssh-keygen
591e8db6e2SBrian Feldman.Fl i
60e2f6069cSDag-Erling Smørgrav.Op Fl m Ar key_format
61b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
62a04a10f8SKris Kennaway.Nm ssh-keygen
631e8db6e2SBrian Feldman.Fl e
64e2f6069cSDag-Erling Smørgrav.Op Fl m Ar key_format
65b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
66a04a10f8SKris Kennaway.Nm ssh-keygen
67a04a10f8SKris Kennaway.Fl y
68b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
69a04a10f8SKris Kennaway.Nm ssh-keygen
70511b41d2SMark Murray.Fl c
71511b41d2SMark Murray.Op Fl P Ar passphrase
72511b41d2SMark Murray.Op Fl C Ar comment
73511b41d2SMark Murray.Op Fl f Ar keyfile
74511b41d2SMark Murray.Nm ssh-keygen
75511b41d2SMark Murray.Fl l
76bc5531deSDag-Erling Smørgrav.Op Fl v
77bc5531deSDag-Erling Smørgrav.Op Fl E Ar fingerprint_hash
78b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile
79a04a10f8SKris Kennaway.Nm ssh-keygen
801e8db6e2SBrian Feldman.Fl B
811e8db6e2SBrian Feldman.Op Fl f Ar input_keyfile
82ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen
83b15c8340SDag-Erling Smørgrav.Fl D Ar pkcs11
84ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen
855e8dbd04SDag-Erling Smørgrav.Fl F Ar hostname
865e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file
87cce7d346SDag-Erling Smørgrav.Op Fl l
885e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen
895e8dbd04SDag-Erling Smørgrav.Fl H
905e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file
915e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen
925e8dbd04SDag-Erling Smørgrav.Fl R Ar hostname
935e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file
945e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen
95d95e11bfSDag-Erling Smørgrav.Fl r Ar hostname
96d95e11bfSDag-Erling Smørgrav.Op Fl f Ar input_keyfile
97d95e11bfSDag-Erling Smørgrav.Op Fl g
98d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen
99d95e11bfSDag-Erling Smørgrav.Fl G Ar output_file
100efcad6b7SDag-Erling Smørgrav.Op Fl v
101d95e11bfSDag-Erling Smørgrav.Op Fl b Ar bits
102d95e11bfSDag-Erling Smørgrav.Op Fl M Ar memory
103d95e11bfSDag-Erling Smørgrav.Op Fl S Ar start_point
104d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen
105d95e11bfSDag-Erling Smørgrav.Fl T Ar output_file
106d95e11bfSDag-Erling Smørgrav.Fl f Ar input_file
107efcad6b7SDag-Erling Smørgrav.Op Fl v
108f7167e0eSDag-Erling Smørgrav.Op Fl a Ar rounds
109462c32cbSDag-Erling Smørgrav.Op Fl J Ar num_lines
110462c32cbSDag-Erling Smørgrav.Op Fl j Ar start_line
111462c32cbSDag-Erling Smørgrav.Op Fl K Ar checkpt
112d95e11bfSDag-Erling Smørgrav.Op Fl W Ar generator
113b15c8340SDag-Erling Smørgrav.Nm ssh-keygen
114b15c8340SDag-Erling Smørgrav.Fl s Ar ca_key
115b15c8340SDag-Erling Smørgrav.Fl I Ar certificate_identity
116b15c8340SDag-Erling Smørgrav.Op Fl h
1174f52dfbbSDag-Erling Smørgrav.Op Fl U
1184f52dfbbSDag-Erling Smørgrav.Op Fl D Ar pkcs11_provider
119b15c8340SDag-Erling Smørgrav.Op Fl n Ar principals
120e2f6069cSDag-Erling Smørgrav.Op Fl O Ar option
121b15c8340SDag-Erling Smørgrav.Op Fl V Ar validity_interval
122e2f6069cSDag-Erling Smørgrav.Op Fl z Ar serial_number
123b15c8340SDag-Erling Smørgrav.Ar
124b15c8340SDag-Erling Smørgrav.Nm ssh-keygen
125b15c8340SDag-Erling Smørgrav.Fl L
126b15c8340SDag-Erling Smørgrav.Op Fl f Ar input_keyfile
127e146993eSDag-Erling Smørgrav.Nm ssh-keygen
128e146993eSDag-Erling Smørgrav.Fl A
1294f52dfbbSDag-Erling Smørgrav.Op Fl f Ar prefix_path
1306888a9beSDag-Erling Smørgrav.Nm ssh-keygen
1316888a9beSDag-Erling Smørgrav.Fl k
1326888a9beSDag-Erling Smørgrav.Fl f Ar krl_file
1336888a9beSDag-Erling Smørgrav.Op Fl u
1346888a9beSDag-Erling Smørgrav.Op Fl s Ar ca_public
1356888a9beSDag-Erling Smørgrav.Op Fl z Ar version_number
1366888a9beSDag-Erling Smørgrav.Ar
1376888a9beSDag-Erling Smørgrav.Nm ssh-keygen
1386888a9beSDag-Erling Smørgrav.Fl Q
1396888a9beSDag-Erling Smørgrav.Fl f Ar krl_file
1406888a9beSDag-Erling Smørgrav.Ar
141b15c8340SDag-Erling Smørgrav.Ek
142511b41d2SMark Murray.Sh DESCRIPTION
143511b41d2SMark Murray.Nm
1441e8db6e2SBrian Feldmangenerates, manages and converts authentication keys for
145511b41d2SMark Murray.Xr ssh 1 .
146a04a10f8SKris Kennaway.Nm
1474f52dfbbSDag-Erling Smørgravcan create keys for use by SSH protocol version 2.
148acc1a9efSDag-Erling Smørgrav.Pp
149d95e11bfSDag-Erling SmørgravThe type of key to be generated is specified with the
1501e8db6e2SBrian Feldman.Fl t
151ae1f160dSDag-Erling Smørgravoption.
152021d409fSDag-Erling SmørgravIf invoked without any arguments,
153021d409fSDag-Erling Smørgrav.Nm
1544f52dfbbSDag-Erling Smørgravwill generate an RSA key.
155a04a10f8SKris Kennaway.Pp
156d95e11bfSDag-Erling Smørgrav.Nm
157d95e11bfSDag-Erling Smørgravis also used to generate groups for use in Diffie-Hellman group
158d95e11bfSDag-Erling Smørgravexchange (DH-GEX).
159d95e11bfSDag-Erling SmørgravSee the
160d95e11bfSDag-Erling Smørgrav.Sx MODULI GENERATION
161d95e11bfSDag-Erling Smørgravsection for details.
162d95e11bfSDag-Erling Smørgrav.Pp
1636888a9beSDag-Erling SmørgravFinally,
1646888a9beSDag-Erling Smørgrav.Nm
1656888a9beSDag-Erling Smørgravcan be used to generate and update Key Revocation Lists, and to test whether
1666888a9beSDag-Erling Smørgravgiven keys have been revoked by one.
1676888a9beSDag-Erling SmørgravSee the
1686888a9beSDag-Erling Smørgrav.Sx KEY REVOCATION LISTS
1696888a9beSDag-Erling Smørgravsection for details.
1706888a9beSDag-Erling Smørgrav.Pp
171511b41d2SMark MurrayNormally each user wishing to use SSH
1724a421b63SDag-Erling Smørgravwith public key authentication runs this once to create the authentication
173511b41d2SMark Murraykey in
174f7167e0eSDag-Erling Smørgrav.Pa ~/.ssh/id_dsa ,
1754a421b63SDag-Erling Smørgrav.Pa ~/.ssh/id_ecdsa ,
176f7167e0eSDag-Erling Smørgrav.Pa ~/.ssh/id_ed25519
177a04a10f8SKris Kennawayor
178043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_rsa .
179a04a10f8SKris KennawayAdditionally, the system administrator may use this to generate host keys,
180a04a10f8SKris Kennawayas seen in
181a04a10f8SKris Kennaway.Pa /etc/rc .
182511b41d2SMark Murray.Pp
183511b41d2SMark MurrayNormally this program generates the key and asks for a file in which
184a8f6863aSKris Kennawayto store the private key.
185a8f6863aSKris KennawayThe public key is stored in a file with the same name but
186511b41d2SMark Murray.Dq .pub
187a8f6863aSKris Kennawayappended.
188a8f6863aSKris KennawayThe program also asks for a passphrase.
189a8f6863aSKris KennawayThe passphrase may be empty to indicate no passphrase
1901e8db6e2SBrian Feldman(host keys must have an empty passphrase), or it may be a string of
191a8f6863aSKris Kennawayarbitrary length.
192ae1f160dSDag-Erling SmørgravA passphrase is similar to a password, except it can be a phrase with a
193ae1f160dSDag-Erling Smørgravseries of words, punctuation, numbers, whitespace, or any string of
194ae1f160dSDag-Erling Smørgravcharacters you want.
195ae1f160dSDag-Erling SmørgravGood passphrases are 10-30 characters long, are
196511b41d2SMark Murraynot simple sentences or otherwise easily guessable (English
197ae1f160dSDag-Erling Smørgravprose has only 1-2 bits of entropy per character, and provides very bad
198ae1f160dSDag-Erling Smørgravpassphrases), and contain a mix of upper and lowercase letters,
199ae1f160dSDag-Erling Smørgravnumbers, and non-alphanumeric characters.
200a8f6863aSKris KennawayThe passphrase can be changed later by using the
201511b41d2SMark Murray.Fl p
202511b41d2SMark Murrayoption.
203511b41d2SMark Murray.Pp
204a8f6863aSKris KennawayThere is no way to recover a lost passphrase.
205e146993eSDag-Erling SmørgravIf the passphrase is lost or forgotten, a new key must be generated
206e146993eSDag-Erling Smørgravand the corresponding public key copied to other machines.
207511b41d2SMark Murray.Pp
2084f52dfbbSDag-Erling SmørgravFor keys stored in the newer OpenSSH format,
2091e8db6e2SBrian Feldmanthere is also a comment field in the key file that is only for
210a8f6863aSKris Kennawayconvenience to the user to help identify the key.
211a8f6863aSKris KennawayThe comment can tell what the key is for, or whatever is useful.
212a8f6863aSKris KennawayThe comment is initialized to
213511b41d2SMark Murray.Dq user@host
214511b41d2SMark Murraywhen the key is created, but can be changed using the
215511b41d2SMark Murray.Fl c
216511b41d2SMark Murrayoption.
217511b41d2SMark Murray.Pp
218a04a10f8SKris KennawayAfter a key is generated, instructions below detail where the keys
219a04a10f8SKris Kennawayshould be placed to be activated.
220a04a10f8SKris Kennaway.Pp
221511b41d2SMark MurrayThe options are as follows:
222511b41d2SMark Murray.Bl -tag -width Ds
223e146993eSDag-Erling Smørgrav.It Fl A
2244f52dfbbSDag-Erling SmørgravFor each of the key types (rsa, dsa, ecdsa and ed25519)
225f7167e0eSDag-Erling Smørgravfor which host keys
226e146993eSDag-Erling Smørgravdo not exist, generate the host keys with the default key file path,
227e146993eSDag-Erling Smørgravan empty passphrase, default bits for the key type, and default comment.
2284f52dfbbSDag-Erling SmørgravIf
2294f52dfbbSDag-Erling Smørgrav.Fl f
2304f52dfbbSDag-Erling Smørgravhas also been specified, its argument is used as a prefix to the
2314f52dfbbSDag-Erling Smørgravdefault path for the resulting host key files.
232e146993eSDag-Erling SmørgravThis is used by
233e146993eSDag-Erling Smørgrav.Pa /etc/rc
234e146993eSDag-Erling Smørgravto generate new host keys.
235f7167e0eSDag-Erling Smørgrav.It Fl a Ar rounds
2364f52dfbbSDag-Erling SmørgravWhen saving a new-format private key (i.e. an ed25519 key or when the
237f7167e0eSDag-Erling Smørgrav.Fl o
238f7167e0eSDag-Erling Smørgravflag is set), this option specifies the number of KDF (key derivation function)
239f7167e0eSDag-Erling Smørgravrounds used.
240f7167e0eSDag-Erling SmørgravHigher numbers result in slower passphrase verification and increased
241f7167e0eSDag-Erling Smørgravresistance to brute-force password cracking (should the keys be stolen).
242f7167e0eSDag-Erling Smørgrav.Pp
2434f52dfbbSDag-Erling SmørgravWhen screening DH-GEX candidates (using the
244d95e11bfSDag-Erling Smørgrav.Fl T
245f7167e0eSDag-Erling Smørgravcommand).
246f7167e0eSDag-Erling SmørgravThis option specifies the number of primality tests to perform.
2475e8dbd04SDag-Erling Smørgrav.It Fl B
2485e8dbd04SDag-Erling SmørgravShow the bubblebabble digest of specified private or public key file.
249511b41d2SMark Murray.It Fl b Ar bits
250a8f6863aSKris KennawaySpecifies the number of bits in the key to create.
251eccfee6eSDag-Erling SmørgravFor RSA keys, the minimum size is 1024 bits and the default is 2048 bits.
252043840dfSDag-Erling SmørgravGenerally, 2048 bits is considered sufficient.
253021d409fSDag-Erling SmørgravDSA keys must be exactly 1024 bits as specified by FIPS 186-2.
254e146993eSDag-Erling SmørgravFor ECDSA keys, the
255e146993eSDag-Erling Smørgrav.Fl b
256462c32cbSDag-Erling Smørgravflag determines the key length by selecting from one of three elliptic
257e146993eSDag-Erling Smørgravcurve sizes: 256, 384 or 521 bits.
258e146993eSDag-Erling SmørgravAttempting to use bit lengths other than these three values for ECDSA keys
259e146993eSDag-Erling Smørgravwill fail.
260bc5531deSDag-Erling SmørgravEd25519 keys have a fixed length and the
261f7167e0eSDag-Erling Smørgrav.Fl b
262f7167e0eSDag-Erling Smørgravflag will be ignored.
2635e8dbd04SDag-Erling Smørgrav.It Fl C Ar comment
2645e8dbd04SDag-Erling SmørgravProvides a new comment.
265511b41d2SMark Murray.It Fl c
266511b41d2SMark MurrayRequests changing the comment in the private and public key files.
2674f52dfbbSDag-Erling SmørgravThis operation is only supported for keys stored in the
268076ad2f8SDag-Erling Smørgravnewer OpenSSH format.
269511b41d2SMark MurrayThe program will prompt for the file containing the private keys, for
270ae1f160dSDag-Erling Smørgravthe passphrase if the key has one, and for the new comment.
271b15c8340SDag-Erling Smørgrav.It Fl D Ar pkcs11
272b15c8340SDag-Erling SmørgravDownload the RSA public keys provided by the PKCS#11 shared library
273b15c8340SDag-Erling Smørgrav.Ar pkcs11 .
274e2f6069cSDag-Erling SmørgravWhen used in combination with
275e2f6069cSDag-Erling Smørgrav.Fl s ,
276e2f6069cSDag-Erling Smørgravthis option indicates that a CA key resides in a PKCS#11 token (see the
277e2f6069cSDag-Erling Smørgrav.Sx CERTIFICATES
278e2f6069cSDag-Erling Smørgravsection for details).
279bc5531deSDag-Erling Smørgrav.It Fl E Ar fingerprint_hash
280bc5531deSDag-Erling SmørgravSpecifies the hash algorithm used when displaying key fingerprints.
281bc5531deSDag-Erling SmørgravValid options are:
282bc5531deSDag-Erling Smørgrav.Dq md5
283bc5531deSDag-Erling Smørgravand
284bc5531deSDag-Erling Smørgrav.Dq sha256 .
285bc5531deSDag-Erling SmørgravThe default is
286bc5531deSDag-Erling Smørgrav.Dq sha256 .
2871e8db6e2SBrian Feldman.It Fl e
2881e8db6e2SBrian FeldmanThis option will read a private or public OpenSSH key file and
289e2f6069cSDag-Erling Smørgravprint to stdout the key in one of the formats specified by the
290e2f6069cSDag-Erling Smørgrav.Fl m
291e2f6069cSDag-Erling Smørgravoption.
292e2f6069cSDag-Erling SmørgravThe default export format is
293e2f6069cSDag-Erling Smørgrav.Dq RFC4716 .
294e2f6069cSDag-Erling SmørgravThis option allows exporting OpenSSH keys for use by other programs, including
295e2f6069cSDag-Erling Smørgravseveral commercial SSH implementations.
2965e8dbd04SDag-Erling Smørgrav.It Fl F Ar hostname
2975e8dbd04SDag-Erling SmørgravSearch for the specified
2985e8dbd04SDag-Erling Smørgrav.Ar hostname
2995e8dbd04SDag-Erling Smørgravin a
3005e8dbd04SDag-Erling Smørgrav.Pa known_hosts
3015e8dbd04SDag-Erling Smørgravfile, listing any occurrences found.
3025e8dbd04SDag-Erling SmørgravThis option is useful to find hashed host names or addresses and may also be
3035e8dbd04SDag-Erling Smørgravused in conjunction with the
3045e8dbd04SDag-Erling Smørgrav.Fl H
3055e8dbd04SDag-Erling Smørgravoption to print found keys in a hashed format.
3065e8dbd04SDag-Erling Smørgrav.It Fl f Ar filename
3075e8dbd04SDag-Erling SmørgravSpecifies the filename of the key file.
3085e8dbd04SDag-Erling Smørgrav.It Fl G Ar output_file
3095e8dbd04SDag-Erling SmørgravGenerate candidate primes for DH-GEX.
3105e8dbd04SDag-Erling SmørgravThese primes must be screened for
3115e8dbd04SDag-Erling Smørgravsafety (using the
3125e8dbd04SDag-Erling Smørgrav.Fl T
3135e8dbd04SDag-Erling Smørgravoption) before use.
314d95e11bfSDag-Erling Smørgrav.It Fl g
315d74d50a8SDag-Erling SmørgravUse generic DNS format when printing fingerprint resource records using the
316d74d50a8SDag-Erling Smørgrav.Fl r
317d74d50a8SDag-Erling Smørgravcommand.
3185e8dbd04SDag-Erling Smørgrav.It Fl H
3195e8dbd04SDag-Erling SmørgravHash a
3205e8dbd04SDag-Erling Smørgrav.Pa known_hosts
3214518870cSDag-Erling Smørgravfile.
3224518870cSDag-Erling SmørgravThis replaces all hostnames and addresses with hashed representations
3234518870cSDag-Erling Smørgravwithin the specified file; the original content is moved to a file with
3244518870cSDag-Erling Smørgrava .old suffix.
3255e8dbd04SDag-Erling SmørgravThese hashes may be used normally by
3265e8dbd04SDag-Erling Smørgrav.Nm ssh
3275e8dbd04SDag-Erling Smørgravand
3285e8dbd04SDag-Erling Smørgrav.Nm sshd ,
3295e8dbd04SDag-Erling Smørgravbut they do not reveal identifying information should the file's contents
3305e8dbd04SDag-Erling Smørgravbe disclosed.
3315e8dbd04SDag-Erling SmørgravThis option will not modify existing hashed hostnames and is therefore safe
3325e8dbd04SDag-Erling Smørgravto use on files that mix hashed and non-hashed names.
333b15c8340SDag-Erling Smørgrav.It Fl h
334b15c8340SDag-Erling SmørgravWhen signing a key, create a host certificate instead of a user
335b15c8340SDag-Erling Smørgravcertificate.
336b15c8340SDag-Erling SmørgravPlease see the
337b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
338b15c8340SDag-Erling Smørgravsection for details.
339b15c8340SDag-Erling Smørgrav.It Fl I Ar certificate_identity
340b15c8340SDag-Erling SmørgravSpecify the key identity when signing a public key.
341b15c8340SDag-Erling SmørgravPlease see the
342b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
343b15c8340SDag-Erling Smørgravsection for details.
3441e8db6e2SBrian Feldman.It Fl i
3451e8db6e2SBrian FeldmanThis option will read an unencrypted private (or public) key file
346e2f6069cSDag-Erling Smørgravin the format specified by the
347e2f6069cSDag-Erling Smørgrav.Fl m
348e2f6069cSDag-Erling Smørgravoption and print an OpenSSH compatible private
3491e8db6e2SBrian Feldman(or public) key to stdout.
350a0ee8cc6SDag-Erling SmørgravThis option allows importing keys from other software, including several
351a0ee8cc6SDag-Erling Smørgravcommercial SSH implementations.
352a0ee8cc6SDag-Erling SmørgravThe default import format is
353a0ee8cc6SDag-Erling Smørgrav.Dq RFC4716 .
354462c32cbSDag-Erling Smørgrav.It Fl J Ar num_lines
355462c32cbSDag-Erling SmørgravExit after screening the specified number of lines
356462c32cbSDag-Erling Smørgravwhile performing DH candidate screening using the
357462c32cbSDag-Erling Smørgrav.Fl T
358462c32cbSDag-Erling Smørgravoption.
359462c32cbSDag-Erling Smørgrav.It Fl j Ar start_line
360462c32cbSDag-Erling SmørgravStart screening at the specified line number
361462c32cbSDag-Erling Smørgravwhile performing DH candidate screening using the
362462c32cbSDag-Erling Smørgrav.Fl T
363462c32cbSDag-Erling Smørgravoption.
364462c32cbSDag-Erling Smørgrav.It Fl K Ar checkpt
365462c32cbSDag-Erling SmørgravWrite the last line processed to the file
366462c32cbSDag-Erling Smørgrav.Ar checkpt
367462c32cbSDag-Erling Smørgravwhile performing DH candidate screening using the
368462c32cbSDag-Erling Smørgrav.Fl T
369462c32cbSDag-Erling Smørgravoption.
370462c32cbSDag-Erling SmørgravThis will be used to skip lines in the input file that have already been
371462c32cbSDag-Erling Smørgravprocessed if the job is restarted.
3726888a9beSDag-Erling Smørgrav.It Fl k
3736888a9beSDag-Erling SmørgravGenerate a KRL file.
3746888a9beSDag-Erling SmørgravIn this mode,
3756888a9beSDag-Erling Smørgrav.Nm
3766888a9beSDag-Erling Smørgravwill generate a KRL file at the location specified via the
3776888a9beSDag-Erling Smørgrav.Fl f
3786888a9beSDag-Erling Smørgravflag that revokes every key or certificate presented on the command line.
3796888a9beSDag-Erling SmørgravKeys/certificates to be revoked may be specified by public key file or
3806888a9beSDag-Erling Smørgravusing the format described in the
3816888a9beSDag-Erling Smørgrav.Sx KEY REVOCATION LISTS
3826888a9beSDag-Erling Smørgravsection.
383b15c8340SDag-Erling Smørgrav.It Fl L
384acc1a9efSDag-Erling SmørgravPrints the contents of one or more certificates.
385511b41d2SMark Murray.It Fl l
386ae1f160dSDag-Erling SmørgravShow fingerprint of specified public key file.
387ae1f160dSDag-Erling SmørgravFor RSA and DSA keys
388ae1f160dSDag-Erling Smørgrav.Nm
389ae1f160dSDag-Erling Smørgravtries to find the matching public key file and prints its fingerprint.
390d4af9e69SDag-Erling SmørgravIf combined with
391d4af9e69SDag-Erling Smørgrav.Fl v ,
392076ad2f8SDag-Erling Smørgrava visual ASCII art representation of the key is supplied with the
393076ad2f8SDag-Erling Smørgravfingerprint.
3945e8dbd04SDag-Erling Smørgrav.It Fl M Ar memory
3955e8dbd04SDag-Erling SmørgravSpecify the amount of memory to use (in megabytes) when generating
3965e8dbd04SDag-Erling Smørgravcandidate moduli for DH-GEX.
397e2f6069cSDag-Erling Smørgrav.It Fl m Ar key_format
398e2f6069cSDag-Erling SmørgravSpecify a key format for the
399e2f6069cSDag-Erling Smørgrav.Fl i
400e2f6069cSDag-Erling Smørgrav(import) or
401e2f6069cSDag-Erling Smørgrav.Fl e
402e2f6069cSDag-Erling Smørgrav(export) conversion options.
403e2f6069cSDag-Erling SmørgravThe supported key formats are:
404e2f6069cSDag-Erling Smørgrav.Dq RFC4716
405e2f6069cSDag-Erling Smørgrav(RFC 4716/SSH2 public or private key),
406e2f6069cSDag-Erling Smørgrav.Dq PKCS8
407e2f6069cSDag-Erling Smørgrav(PEM PKCS8 public key)
408e2f6069cSDag-Erling Smørgravor
409e2f6069cSDag-Erling Smørgrav.Dq PEM
410e2f6069cSDag-Erling Smørgrav(PEM public key).
411e2f6069cSDag-Erling SmørgravThe default conversion format is
412e2f6069cSDag-Erling Smørgrav.Dq RFC4716 .
4135e8dbd04SDag-Erling Smørgrav.It Fl N Ar new_passphrase
4145e8dbd04SDag-Erling SmørgravProvides the new passphrase.
415b15c8340SDag-Erling Smørgrav.It Fl n Ar principals
416b15c8340SDag-Erling SmørgravSpecify one or more principals (user or host names) to be included in
417b15c8340SDag-Erling Smørgrava certificate when signing a key.
418b15c8340SDag-Erling SmørgravMultiple principals may be specified, separated by commas.
419b15c8340SDag-Erling SmørgravPlease see the
420b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
421b15c8340SDag-Erling Smørgravsection for details.
422e2f6069cSDag-Erling Smørgrav.It Fl O Ar option
423e2f6069cSDag-Erling SmørgravSpecify a certificate option when signing a key.
424b15c8340SDag-Erling SmørgravThis option may be specified multiple times.
4254f52dfbbSDag-Erling SmørgravSee also the
426b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
4274f52dfbbSDag-Erling Smørgravsection for further details.
428*47dd1d1bSDag-Erling Smørgrav.Pp
429*47dd1d1bSDag-Erling SmørgravAt present, no standard options are valid for host keys.
430e2f6069cSDag-Erling SmørgravThe options that are valid for user certificates are:
4314f52dfbbSDag-Erling Smørgrav.Pp
4324f52dfbbSDag-Erling Smørgrav.Bl -tag -width Ds -compact
4338ad9b54aSDag-Erling Smørgrav.It Ic clear
4348ad9b54aSDag-Erling SmørgravClear all enabled permissions.
4358ad9b54aSDag-Erling SmørgravThis is useful for clearing the default set of permissions so permissions may
4368ad9b54aSDag-Erling Smørgravbe added individually.
4374f52dfbbSDag-Erling Smørgrav.Pp
4384f52dfbbSDag-Erling Smørgrav.It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents
4394f52dfbbSDag-Erling Smørgrav.It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents
4404f52dfbbSDag-Erling SmørgravIncludes an arbitrary certificate critical option or extension.
4414f52dfbbSDag-Erling SmørgravThe specified
4424f52dfbbSDag-Erling Smørgrav.Ar name
4434f52dfbbSDag-Erling Smørgravshould include a domain suffix, e.g.\&
4444f52dfbbSDag-Erling Smørgrav.Dq name@example.com .
4454f52dfbbSDag-Erling SmørgravIf
4464f52dfbbSDag-Erling Smørgrav.Ar contents
4474f52dfbbSDag-Erling Smørgravis specified then it is included as the contents of the extension/option
4484f52dfbbSDag-Erling Smørgravencoded as a string, otherwise the extension/option is created with no
4494f52dfbbSDag-Erling Smørgravcontents (usually indicating a flag).
4504f52dfbbSDag-Erling SmørgravExtensions may be ignored by a client or server that does not recognise them,
4514f52dfbbSDag-Erling Smørgravwhereas unknown critical options will cause the certificate to be refused.
4524f52dfbbSDag-Erling Smørgrav.Pp
4538ad9b54aSDag-Erling Smørgrav.It Ic force-command Ns = Ns Ar command
4548ad9b54aSDag-Erling SmørgravForces the execution of
4558ad9b54aSDag-Erling Smørgrav.Ar command
4568ad9b54aSDag-Erling Smørgravinstead of any shell or command specified by the user when
4578ad9b54aSDag-Erling Smørgravthe certificate is used for authentication.
4584f52dfbbSDag-Erling Smørgrav.Pp
459b15c8340SDag-Erling Smørgrav.It Ic no-agent-forwarding
460b15c8340SDag-Erling SmørgravDisable
461b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1
462b15c8340SDag-Erling Smørgravforwarding (permitted by default).
4634f52dfbbSDag-Erling Smørgrav.Pp
464b15c8340SDag-Erling Smørgrav.It Ic no-port-forwarding
465b15c8340SDag-Erling SmørgravDisable port forwarding (permitted by default).
4664f52dfbbSDag-Erling Smørgrav.Pp
467b15c8340SDag-Erling Smørgrav.It Ic no-pty
468b15c8340SDag-Erling SmørgravDisable PTY allocation (permitted by default).
4694f52dfbbSDag-Erling Smørgrav.Pp
470b15c8340SDag-Erling Smørgrav.It Ic no-user-rc
471b15c8340SDag-Erling SmørgravDisable execution of
472b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc
473b15c8340SDag-Erling Smørgravby
474b15c8340SDag-Erling Smørgrav.Xr sshd 8
475b15c8340SDag-Erling Smørgrav(permitted by default).
4764f52dfbbSDag-Erling Smørgrav.Pp
4778ad9b54aSDag-Erling Smørgrav.It Ic no-x11-forwarding
4788ad9b54aSDag-Erling SmørgravDisable X11 forwarding (permitted by default).
4794f52dfbbSDag-Erling Smørgrav.Pp
480b15c8340SDag-Erling Smørgrav.It Ic permit-agent-forwarding
481b15c8340SDag-Erling SmørgravAllows
482b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1
483b15c8340SDag-Erling Smørgravforwarding.
4844f52dfbbSDag-Erling Smørgrav.Pp
485b15c8340SDag-Erling Smørgrav.It Ic permit-port-forwarding
486b15c8340SDag-Erling SmørgravAllows port forwarding.
4874f52dfbbSDag-Erling Smørgrav.Pp
488b15c8340SDag-Erling Smørgrav.It Ic permit-pty
489b15c8340SDag-Erling SmørgravAllows PTY allocation.
4904f52dfbbSDag-Erling Smørgrav.Pp
491b15c8340SDag-Erling Smørgrav.It Ic permit-user-rc
492b15c8340SDag-Erling SmørgravAllows execution of
493b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc
494b15c8340SDag-Erling Smørgravby
495b15c8340SDag-Erling Smørgrav.Xr sshd 8 .
4964f52dfbbSDag-Erling Smørgrav.Pp
497*47dd1d1bSDag-Erling Smørgrav.It Ic permit-X11-forwarding
4988ad9b54aSDag-Erling SmørgravAllows X11 forwarding.
4994f52dfbbSDag-Erling Smørgrav.Pp
5008ad9b54aSDag-Erling Smørgrav.It Ic source-address Ns = Ns Ar address_list
5018ad9b54aSDag-Erling SmørgravRestrict the source addresses from which the certificate is considered valid.
502b15c8340SDag-Erling SmørgravThe
503b15c8340SDag-Erling Smørgrav.Ar address_list
504b15c8340SDag-Erling Smørgravis a comma-separated list of one or more address/netmask pairs in CIDR
505b15c8340SDag-Erling Smørgravformat.
506b15c8340SDag-Erling Smørgrav.El
507f7167e0eSDag-Erling Smørgrav.It Fl o
508f7167e0eSDag-Erling SmørgravCauses
509f7167e0eSDag-Erling Smørgrav.Nm
510acc1a9efSDag-Erling Smørgravto save private keys using the new OpenSSH format rather than
511f7167e0eSDag-Erling Smørgravthe more compatible PEM format.
512f7167e0eSDag-Erling SmørgravThe new format has increased resistance to brute-force password cracking
513f7167e0eSDag-Erling Smørgravbut is not supported by versions of OpenSSH prior to 6.5.
514f7167e0eSDag-Erling SmørgravEd25519 keys always use the new private key format.
5155e8dbd04SDag-Erling Smørgrav.It Fl P Ar passphrase
5165e8dbd04SDag-Erling SmørgravProvides the (old) passphrase.
517511b41d2SMark Murray.It Fl p
518511b41d2SMark MurrayRequests changing the passphrase of a private key file instead of
519a8f6863aSKris Kennawaycreating a new private key.
520a8f6863aSKris KennawayThe program will prompt for the file
521511b41d2SMark Murraycontaining the private key, for the old passphrase, and twice for the
522511b41d2SMark Murraynew passphrase.
5236888a9beSDag-Erling Smørgrav.It Fl Q
5246888a9beSDag-Erling SmørgravTest whether keys have been revoked in a KRL.
525511b41d2SMark Murray.It Fl q
526511b41d2SMark MurraySilence
527511b41d2SMark Murray.Nm ssh-keygen .
5285e8dbd04SDag-Erling Smørgrav.It Fl R Ar hostname
5295e8dbd04SDag-Erling SmørgravRemoves all keys belonging to
5305e8dbd04SDag-Erling Smørgrav.Ar hostname
5315e8dbd04SDag-Erling Smørgravfrom a
5325e8dbd04SDag-Erling Smørgrav.Pa known_hosts
5335e8dbd04SDag-Erling Smørgravfile.
5345e8dbd04SDag-Erling SmørgravThis option is useful to delete hashed hosts (see the
5355e8dbd04SDag-Erling Smørgrav.Fl H
5365e8dbd04SDag-Erling Smørgravoption above).
5375e8dbd04SDag-Erling Smørgrav.It Fl r Ar hostname
5385e8dbd04SDag-Erling SmørgravPrint the SSHFP fingerprint resource record named
5395e8dbd04SDag-Erling Smørgrav.Ar hostname
5405e8dbd04SDag-Erling Smørgravfor the specified public key file.
5415e8dbd04SDag-Erling Smørgrav.It Fl S Ar start
5425e8dbd04SDag-Erling SmørgravSpecify start point (in hex) when generating candidate moduli for DH-GEX.
543b15c8340SDag-Erling Smørgrav.It Fl s Ar ca_key
544b15c8340SDag-Erling SmørgravCertify (sign) a public key using the specified CA key.
545b15c8340SDag-Erling SmørgravPlease see the
546b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES
547b15c8340SDag-Erling Smørgravsection for details.
5486888a9beSDag-Erling Smørgrav.Pp
5496888a9beSDag-Erling SmørgravWhen generating a KRL,
5506888a9beSDag-Erling Smørgrav.Fl s
5516888a9beSDag-Erling Smørgravspecifies a path to a CA public key file used to revoke certificates directly
5526888a9beSDag-Erling Smørgravby key ID or serial number.
5536888a9beSDag-Erling SmørgravSee the
5546888a9beSDag-Erling Smørgrav.Sx KEY REVOCATION LISTS
5556888a9beSDag-Erling Smørgravsection for details.
5565e8dbd04SDag-Erling Smørgrav.It Fl T Ar output_file
5575e8dbd04SDag-Erling SmørgravTest DH group exchange candidate primes (generated using the
5585e8dbd04SDag-Erling Smørgrav.Fl G
5595e8dbd04SDag-Erling Smørgravoption) for safety.
5604f52dfbbSDag-Erling Smørgrav.It Fl t Cm dsa | ecdsa | ed25519 | rsa
5615e8dbd04SDag-Erling SmørgravSpecifies the type of key to create.
5621e8db6e2SBrian FeldmanThe possible values are
5634a421b63SDag-Erling Smørgrav.Dq dsa ,
564f7167e0eSDag-Erling Smørgrav.Dq ecdsa ,
565f7167e0eSDag-Erling Smørgrav.Dq ed25519 ,
5661e8db6e2SBrian Feldmanor
5674f52dfbbSDag-Erling Smørgrav.Dq rsa .
5684f52dfbbSDag-Erling Smørgrav.It Fl U
5694f52dfbbSDag-Erling SmørgravWhen used in combination with
5704f52dfbbSDag-Erling Smørgrav.Fl s ,
5714f52dfbbSDag-Erling Smørgravthis option indicates that a CA key resides in a
5724f52dfbbSDag-Erling Smørgrav.Xr ssh-agent 1 .
5734f52dfbbSDag-Erling SmørgravSee the
5744f52dfbbSDag-Erling Smørgrav.Sx CERTIFICATES
5754f52dfbbSDag-Erling Smørgravsection for more information.
5766888a9beSDag-Erling Smørgrav.It Fl u
5776888a9beSDag-Erling SmørgravUpdate a KRL.
5786888a9beSDag-Erling SmørgravWhen specified with
5796888a9beSDag-Erling Smørgrav.Fl k ,
5806888a9beSDag-Erling Smørgravkeys listed via the command line are added to the existing KRL rather than
5816888a9beSDag-Erling Smørgrava new KRL being created.
582b15c8340SDag-Erling Smørgrav.It Fl V Ar validity_interval
583b15c8340SDag-Erling SmørgravSpecify a validity interval when signing a certificate.
584b15c8340SDag-Erling SmørgravA validity interval may consist of a single time, indicating that the
585b15c8340SDag-Erling Smørgravcertificate is valid beginning now and expiring at that time, or may consist
586b15c8340SDag-Erling Smørgravof two times separated by a colon to indicate an explicit time interval.
587*47dd1d1bSDag-Erling Smørgrav.Pp
588*47dd1d1bSDag-Erling SmørgravThe start time may be specified as the string
589*47dd1d1bSDag-Erling Smørgrav.Dq always
590*47dd1d1bSDag-Erling Smørgravto indicate the certificate has no specified start time,
591*47dd1d1bSDag-Erling Smørgrava date in YYYYMMDD format, a time in YYYYMMDDHHMM[SS] format,
592*47dd1d1bSDag-Erling Smørgrava relative time (to the current time) consisting of a minus sign followed by
593*47dd1d1bSDag-Erling Smørgravan interval in the format described in the
594e4a9863fSDag-Erling SmørgravTIME FORMATS section of
5958ad9b54aSDag-Erling Smørgrav.Xr sshd_config 5 .
596*47dd1d1bSDag-Erling Smørgrav.Pp
597*47dd1d1bSDag-Erling SmørgravThe end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMM[SS] time,
598*47dd1d1bSDag-Erling Smørgrava relative time starting with a plus character or the string
599*47dd1d1bSDag-Erling Smørgrav.Dq forever
600*47dd1d1bSDag-Erling Smørgravto indicate that the certificate has no expirty date.
601b15c8340SDag-Erling Smørgrav.Pp
602b15c8340SDag-Erling SmørgravFor example:
603b15c8340SDag-Erling Smørgrav.Dq +52w1d
604b15c8340SDag-Erling Smørgrav(valid from now to 52 weeks and one day from now),
605b15c8340SDag-Erling Smørgrav.Dq -4w:+4w
606b15c8340SDag-Erling Smørgrav(valid from four weeks ago to four weeks from now),
607b15c8340SDag-Erling Smørgrav.Dq 20100101123000:20110101123000
608b15c8340SDag-Erling Smørgrav(valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011),
609b15c8340SDag-Erling Smørgrav.Dq -1d:20110101
610b15c8340SDag-Erling Smørgrav(valid from yesterday to midnight, January 1st, 2011).
611*47dd1d1bSDag-Erling Smørgrav.Dq -1m:forever
612*47dd1d1bSDag-Erling Smørgrav(valid from one minute ago and never expiring).
613efcad6b7SDag-Erling Smørgrav.It Fl v
614efcad6b7SDag-Erling SmørgravVerbose mode.
615efcad6b7SDag-Erling SmørgravCauses
616efcad6b7SDag-Erling Smørgrav.Nm
617efcad6b7SDag-Erling Smørgravto print debugging messages about its progress.
618efcad6b7SDag-Erling SmørgravThis is helpful for debugging moduli generation.
619efcad6b7SDag-Erling SmørgravMultiple
620efcad6b7SDag-Erling Smørgrav.Fl v
621efcad6b7SDag-Erling Smørgravoptions increase the verbosity.
622efcad6b7SDag-Erling SmørgravThe maximum is 3.
6235e8dbd04SDag-Erling Smørgrav.It Fl W Ar generator
6245e8dbd04SDag-Erling SmørgravSpecify desired generator when testing candidate moduli for DH-GEX.
6255e8dbd04SDag-Erling Smørgrav.It Fl y
6265e8dbd04SDag-Erling SmørgravThis option will read a private
6275e8dbd04SDag-Erling SmørgravOpenSSH format file and print an OpenSSH public key to stdout.
628e2f6069cSDag-Erling Smørgrav.It Fl z Ar serial_number
629e2f6069cSDag-Erling SmørgravSpecifies a serial number to be embedded in the certificate to distinguish
630e2f6069cSDag-Erling Smørgravthis certificate from others from the same CA.
631e2f6069cSDag-Erling SmørgravThe default serial number is zero.
6326888a9beSDag-Erling Smørgrav.Pp
6336888a9beSDag-Erling SmørgravWhen generating a KRL, the
6346888a9beSDag-Erling Smørgrav.Fl z
6356888a9beSDag-Erling Smørgravflag is used to specify a KRL version number.
636511b41d2SMark Murray.El
637d95e11bfSDag-Erling Smørgrav.Sh MODULI GENERATION
638d95e11bfSDag-Erling Smørgrav.Nm
639d95e11bfSDag-Erling Smørgravmay be used to generate groups for the Diffie-Hellman Group Exchange
640d95e11bfSDag-Erling Smørgrav(DH-GEX) protocol.
641d95e11bfSDag-Erling SmørgravGenerating these groups is a two-step process: first, candidate
642d95e11bfSDag-Erling Smørgravprimes are generated using a fast, but memory intensive process.
643d95e11bfSDag-Erling SmørgravThese candidate primes are then tested for suitability (a CPU-intensive
644d95e11bfSDag-Erling Smørgravprocess).
645d95e11bfSDag-Erling Smørgrav.Pp
646d95e11bfSDag-Erling SmørgravGeneration of primes is performed using the
647d95e11bfSDag-Erling Smørgrav.Fl G
648d95e11bfSDag-Erling Smørgravoption.
649d95e11bfSDag-Erling SmørgravThe desired length of the primes may be specified by the
650d95e11bfSDag-Erling Smørgrav.Fl b
651d95e11bfSDag-Erling Smørgravoption.
652d95e11bfSDag-Erling SmørgravFor example:
653d95e11bfSDag-Erling Smørgrav.Pp
6545e8dbd04SDag-Erling Smørgrav.Dl # ssh-keygen -G moduli-2048.candidates -b 2048
655d95e11bfSDag-Erling Smørgrav.Pp
656d95e11bfSDag-Erling SmørgravBy default, the search for primes begins at a random point in the
657d95e11bfSDag-Erling Smørgravdesired length range.
658d95e11bfSDag-Erling SmørgravThis may be overridden using the
659d95e11bfSDag-Erling Smørgrav.Fl S
660d95e11bfSDag-Erling Smørgravoption, which specifies a different start point (in hex).
661d95e11bfSDag-Erling Smørgrav.Pp
662462c32cbSDag-Erling SmørgravOnce a set of candidates have been generated, they must be screened for
663d95e11bfSDag-Erling Smørgravsuitability.
664d95e11bfSDag-Erling SmørgravThis may be performed using the
665d95e11bfSDag-Erling Smørgrav.Fl T
666d95e11bfSDag-Erling Smørgravoption.
667d95e11bfSDag-Erling SmørgravIn this mode
668d95e11bfSDag-Erling Smørgrav.Nm
669d95e11bfSDag-Erling Smørgravwill read candidates from standard input (or a file specified using the
670d95e11bfSDag-Erling Smørgrav.Fl f
671d95e11bfSDag-Erling Smørgravoption).
672d95e11bfSDag-Erling SmørgravFor example:
673d95e11bfSDag-Erling Smørgrav.Pp
6745e8dbd04SDag-Erling Smørgrav.Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates
675d95e11bfSDag-Erling Smørgrav.Pp
676d95e11bfSDag-Erling SmørgravBy default, each candidate will be subjected to 100 primality tests.
677d95e11bfSDag-Erling SmørgravThis may be overridden using the
678d95e11bfSDag-Erling Smørgrav.Fl a
679d95e11bfSDag-Erling Smørgravoption.
680d95e11bfSDag-Erling SmørgravThe DH generator value will be chosen automatically for the
681d95e11bfSDag-Erling Smørgravprime under consideration.
682d95e11bfSDag-Erling SmørgravIf a specific generator is desired, it may be requested using the
683d95e11bfSDag-Erling Smørgrav.Fl W
684d95e11bfSDag-Erling Smørgravoption.
6855e8dbd04SDag-Erling SmørgravValid generator values are 2, 3, and 5.
686d95e11bfSDag-Erling Smørgrav.Pp
687d95e11bfSDag-Erling SmørgravScreened DH groups may be installed in
688d95e11bfSDag-Erling Smørgrav.Pa /etc/moduli .
689d95e11bfSDag-Erling SmørgravIt is important that this file contains moduli of a range of bit lengths and
690d95e11bfSDag-Erling Smørgravthat both ends of a connection share common moduli.
691b15c8340SDag-Erling Smørgrav.Sh CERTIFICATES
692b15c8340SDag-Erling Smørgrav.Nm
693b15c8340SDag-Erling Smørgravsupports signing of keys to produce certificates that may be used for
694b15c8340SDag-Erling Smørgravuser or host authentication.
695b15c8340SDag-Erling SmørgravCertificates consist of a public key, some identity information, zero or
696e2f6069cSDag-Erling Smørgravmore principal (user or host) names and a set of options that
697b15c8340SDag-Erling Smørgravare signed by a Certification Authority (CA) key.
698b15c8340SDag-Erling SmørgravClients or servers may then trust only the CA key and verify its signature
699b15c8340SDag-Erling Smørgravon a certificate rather than trusting many user/host keys.
700b15c8340SDag-Erling SmørgravNote that OpenSSH certificates are a different, and much simpler, format to
701b15c8340SDag-Erling Smørgravthe X.509 certificates used in
702b15c8340SDag-Erling Smørgrav.Xr ssl 8 .
703b15c8340SDag-Erling Smørgrav.Pp
704b15c8340SDag-Erling Smørgrav.Nm
705b15c8340SDag-Erling Smørgravsupports two types of certificates: user and host.
706b15c8340SDag-Erling SmørgravUser certificates authenticate users to servers, whereas host certificates
707b15c8340SDag-Erling Smørgravauthenticate server hosts to users.
708b15c8340SDag-Erling SmørgravTo generate a user certificate:
709b15c8340SDag-Erling Smørgrav.Pp
710b15c8340SDag-Erling Smørgrav.Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
711b15c8340SDag-Erling Smørgrav.Pp
712b15c8340SDag-Erling SmørgravThe resultant certificate will be placed in
7138ad9b54aSDag-Erling Smørgrav.Pa /path/to/user_key-cert.pub .
714b15c8340SDag-Erling SmørgravA host certificate requires the
715b15c8340SDag-Erling Smørgrav.Fl h
716b15c8340SDag-Erling Smørgravoption:
717b15c8340SDag-Erling Smørgrav.Pp
718b15c8340SDag-Erling Smørgrav.Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub
719b15c8340SDag-Erling Smørgrav.Pp
720b15c8340SDag-Erling SmørgravThe host certificate will be output to
7218ad9b54aSDag-Erling Smørgrav.Pa /path/to/host_key-cert.pub .
722e2f6069cSDag-Erling Smørgrav.Pp
723e2f6069cSDag-Erling SmørgravIt is possible to sign using a CA key stored in a PKCS#11 token by
724e2f6069cSDag-Erling Smørgravproviding the token library using
725e2f6069cSDag-Erling Smørgrav.Fl D
726e2f6069cSDag-Erling Smørgravand identifying the CA key by providing its public half as an argument
727e2f6069cSDag-Erling Smørgravto
728e2f6069cSDag-Erling Smørgrav.Fl s :
729e2f6069cSDag-Erling Smørgrav.Pp
730fc1ba28aSDag-Erling Smørgrav.Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub
731e2f6069cSDag-Erling Smørgrav.Pp
7324f52dfbbSDag-Erling SmørgravSimilarly, it is possible for the CA key to be hosted in a
7334f52dfbbSDag-Erling Smørgrav.Xr ssh-agent 1 .
7344f52dfbbSDag-Erling SmørgravThis is indicated by the
7354f52dfbbSDag-Erling Smørgrav.Fl U
7364f52dfbbSDag-Erling Smørgravflag and, again, the CA key must be identified by its public half.
7374f52dfbbSDag-Erling Smørgrav.Pp
7384f52dfbbSDag-Erling Smørgrav.Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub
7394f52dfbbSDag-Erling Smørgrav.Pp
740e2f6069cSDag-Erling SmørgravIn all cases,
741b15c8340SDag-Erling Smørgrav.Ar key_id
742b15c8340SDag-Erling Smørgravis a "key identifier" that is logged by the server when the certificate
743b15c8340SDag-Erling Smørgravis used for authentication.
744b15c8340SDag-Erling Smørgrav.Pp
745b15c8340SDag-Erling SmørgravCertificates may be limited to be valid for a set of principal (user/host)
746b15c8340SDag-Erling Smørgravnames.
747b15c8340SDag-Erling SmørgravBy default, generated certificates are valid for all users or hosts.
748b15c8340SDag-Erling SmørgravTo generate a certificate for a specified set of principals:
749b15c8340SDag-Erling Smørgrav.Pp
750b15c8340SDag-Erling Smørgrav.Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
751fc1ba28aSDag-Erling Smørgrav.Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub"
752b15c8340SDag-Erling Smørgrav.Pp
753b15c8340SDag-Erling SmørgravAdditional limitations on the validity and use of user certificates may
754e2f6069cSDag-Erling Smørgravbe specified through certificate options.
755e2f6069cSDag-Erling SmørgravA certificate option may disable features of the SSH session, may be
756b15c8340SDag-Erling Smørgravvalid only when presented from particular source addresses or may
757b15c8340SDag-Erling Smørgravforce the use of a specific command.
758e2f6069cSDag-Erling SmørgravFor a list of valid certificate options, see the documentation for the
759b15c8340SDag-Erling Smørgrav.Fl O
760b15c8340SDag-Erling Smørgravoption above.
761b15c8340SDag-Erling Smørgrav.Pp
762b15c8340SDag-Erling SmørgravFinally, certificates may be defined with a validity lifetime.
763b15c8340SDag-Erling SmørgravThe
764b15c8340SDag-Erling Smørgrav.Fl V
765b15c8340SDag-Erling Smørgravoption allows specification of certificate start and end times.
766b15c8340SDag-Erling SmørgravA certificate that is presented at a time outside this range will not be
767b15c8340SDag-Erling Smørgravconsidered valid.
7686888a9beSDag-Erling SmørgravBy default, certificates are valid from
7696888a9beSDag-Erling Smørgrav.Ux
7706888a9beSDag-Erling SmørgravEpoch to the distant future.
771b15c8340SDag-Erling Smørgrav.Pp
772b15c8340SDag-Erling SmørgravFor certificates to be used for user or host authentication, the CA
773b15c8340SDag-Erling Smørgravpublic key must be trusted by
774b15c8340SDag-Erling Smørgrav.Xr sshd 8
775b15c8340SDag-Erling Smørgravor
776b15c8340SDag-Erling Smørgrav.Xr ssh 1 .
777b15c8340SDag-Erling SmørgravPlease refer to those manual pages for details.
7786888a9beSDag-Erling Smørgrav.Sh KEY REVOCATION LISTS
7796888a9beSDag-Erling Smørgrav.Nm
7806888a9beSDag-Erling Smørgravis able to manage OpenSSH format Key Revocation Lists (KRLs).
7816888a9beSDag-Erling SmørgravThese binary files specify keys or certificates to be revoked using a
782f7167e0eSDag-Erling Smørgravcompact format, taking as little as one bit per certificate if they are being
7836888a9beSDag-Erling Smørgravrevoked by serial number.
7846888a9beSDag-Erling Smørgrav.Pp
7856888a9beSDag-Erling SmørgravKRLs may be generated using the
7866888a9beSDag-Erling Smørgrav.Fl k
7876888a9beSDag-Erling Smørgravflag.
7886888a9beSDag-Erling SmørgravThis option reads one or more files from the command line and generates a new
7896888a9beSDag-Erling SmørgravKRL.
7906888a9beSDag-Erling SmørgravThe files may either contain a KRL specification (see below) or public keys,
7916888a9beSDag-Erling Smørgravlisted one per line.
7926888a9beSDag-Erling SmørgravPlain public keys are revoked by listing their hash or contents in the KRL and
7936888a9beSDag-Erling Smørgravcertificates revoked by serial number or key ID (if the serial is zero or
7946888a9beSDag-Erling Smørgravnot available).
7956888a9beSDag-Erling Smørgrav.Pp
7966888a9beSDag-Erling SmørgravRevoking keys using a KRL specification offers explicit control over the
7976888a9beSDag-Erling Smørgravtypes of record used to revoke keys and may be used to directly revoke
7986888a9beSDag-Erling Smørgravcertificates by serial number or key ID without having the complete original
7996888a9beSDag-Erling Smørgravcertificate on hand.
8006888a9beSDag-Erling SmørgravA KRL specification consists of lines containing one of the following directives
8016888a9beSDag-Erling Smørgravfollowed by a colon and some directive-specific information.
8026888a9beSDag-Erling Smørgrav.Bl -tag -width Ds
8036888a9beSDag-Erling Smørgrav.It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number
8046888a9beSDag-Erling SmørgravRevokes a certificate with the specified serial number.
8056888a9beSDag-Erling SmørgravSerial numbers are 64-bit values, not including zero and may be expressed
8066888a9beSDag-Erling Smørgravin decimal, hex or octal.
8076888a9beSDag-Erling SmørgravIf two serial numbers are specified separated by a hyphen, then the range
8086888a9beSDag-Erling Smørgravof serial numbers including and between each is revoked.
8096888a9beSDag-Erling SmørgravThe CA key must have been specified on the
8106888a9beSDag-Erling Smørgrav.Nm
8116888a9beSDag-Erling Smørgravcommand line using the
8126888a9beSDag-Erling Smørgrav.Fl s
8136888a9beSDag-Erling Smørgravoption.
8146888a9beSDag-Erling Smørgrav.It Cm id : Ar key_id
8156888a9beSDag-Erling SmørgravRevokes a certificate with the specified key ID string.
8166888a9beSDag-Erling SmørgravThe CA key must have been specified on the
8176888a9beSDag-Erling Smørgrav.Nm
8186888a9beSDag-Erling Smørgravcommand line using the
8196888a9beSDag-Erling Smørgrav.Fl s
8206888a9beSDag-Erling Smørgravoption.
8216888a9beSDag-Erling Smørgrav.It Cm key : Ar public_key
8226888a9beSDag-Erling SmørgravRevokes the specified key.
8236888a9beSDag-Erling SmørgravIf a certificate is listed, then it is revoked as a plain public key.
8246888a9beSDag-Erling Smørgrav.It Cm sha1 : Ar public_key
8256888a9beSDag-Erling SmørgravRevokes the specified key by its SHA1 hash.
8266888a9beSDag-Erling Smørgrav.El
8276888a9beSDag-Erling Smørgrav.Pp
8286888a9beSDag-Erling SmørgravKRLs may be updated using the
8296888a9beSDag-Erling Smørgrav.Fl u
8306888a9beSDag-Erling Smørgravflag in addition to
8316888a9beSDag-Erling Smørgrav.Fl k .
8326888a9beSDag-Erling SmørgravWhen this option is specified, keys listed via the command line are merged into
8336888a9beSDag-Erling Smørgravthe KRL, adding to those already there.
8346888a9beSDag-Erling Smørgrav.Pp
8356888a9beSDag-Erling SmørgravIt is also possible, given a KRL, to test whether it revokes a particular key
8366888a9beSDag-Erling Smørgrav(or keys).
8376888a9beSDag-Erling SmørgravThe
8386888a9beSDag-Erling Smørgrav.Fl Q
8396888a9beSDag-Erling Smørgravflag will query an existing KRL, testing each key specified on the command line.
8406888a9beSDag-Erling SmørgravIf any key listed on the command line has been revoked (or an error encountered)
8416888a9beSDag-Erling Smørgravthen
8426888a9beSDag-Erling Smørgrav.Nm
8436888a9beSDag-Erling Smørgravwill exit with a non-zero exit status.
8446888a9beSDag-Erling SmørgravA zero exit status will only be returned if no key was revoked.
845511b41d2SMark Murray.Sh FILES
8464a421b63SDag-Erling Smørgrav.Bl -tag -width Ds -compact
847043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa
8484a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa
849f7167e0eSDag-Erling Smørgrav.It Pa ~/.ssh/id_ed25519
850043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa
8514f52dfbbSDag-Erling SmørgravContains the DSA, ECDSA, Ed25519 or RSA
852f7167e0eSDag-Erling Smørgravauthentication identity of the user.
8531e8db6e2SBrian FeldmanThis file should not be readable by anyone but the user.
8541e8db6e2SBrian FeldmanIt is possible to
8551e8db6e2SBrian Feldmanspecify a passphrase when generating the key; that passphrase will be
856b15c8340SDag-Erling Smørgravused to encrypt the private part of this file using 128-bit AES.
8571e8db6e2SBrian FeldmanThis file is not automatically accessed by
8581e8db6e2SBrian Feldman.Nm
8591e8db6e2SBrian Feldmanbut it is offered as the default file for the private key.
860ae1f160dSDag-Erling Smørgrav.Xr ssh 1
8611e8db6e2SBrian Feldmanwill read this file when a login attempt is made.
8624a421b63SDag-Erling Smørgrav.Pp
8634a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa.pub
8644a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa.pub
865f7167e0eSDag-Erling Smørgrav.It Pa ~/.ssh/id_ed25519.pub
866043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa.pub
8674f52dfbbSDag-Erling SmørgravContains the DSA, ECDSA, Ed25519 or RSA
868f7167e0eSDag-Erling Smørgravpublic key for authentication.
8691e8db6e2SBrian FeldmanThe contents of this file should be added to
870043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys
8711e8db6e2SBrian Feldmanon all machines
872ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication.
873a04a10f8SKris KennawayThere is no need to keep the contents of this file secret.
8744a421b63SDag-Erling Smørgrav.Pp
875d95e11bfSDag-Erling Smørgrav.It Pa /etc/moduli
876d95e11bfSDag-Erling SmørgravContains Diffie-Hellman groups used for DH-GEX.
877d95e11bfSDag-Erling SmørgravThe file format is described in
878d95e11bfSDag-Erling Smørgrav.Xr moduli 5 .
879b66f2d16SKris Kennaway.El
880511b41d2SMark Murray.Sh SEE ALSO
881511b41d2SMark Murray.Xr ssh 1 ,
882511b41d2SMark Murray.Xr ssh-add 1 ,
883511b41d2SMark Murray.Xr ssh-agent 1 ,
884d95e11bfSDag-Erling Smørgrav.Xr moduli 5 ,
8851e8db6e2SBrian Feldman.Xr sshd 8
8861e8db6e2SBrian Feldman.Rs
887d4af9e69SDag-Erling Smørgrav.%R RFC 4716
888d4af9e69SDag-Erling Smørgrav.%T "The Secure Shell (SSH) Public Key File Format"
889d4af9e69SDag-Erling Smørgrav.%D 2006
8901e8db6e2SBrian Feldman.Re
891d95e11bfSDag-Erling Smørgrav.Sh AUTHORS
892d95e11bfSDag-Erling SmørgravOpenSSH is a derivative of the original and free
893d95e11bfSDag-Erling Smørgravssh 1.2.12 release by Tatu Ylonen.
894d95e11bfSDag-Erling SmørgravAaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
895d95e11bfSDag-Erling SmørgravTheo de Raadt and Dug Song
896d95e11bfSDag-Erling Smørgravremoved many bugs, re-added newer features and
897d95e11bfSDag-Erling Smørgravcreated OpenSSH.
898d95e11bfSDag-Erling SmørgravMarkus Friedl contributed the support for SSH
899d95e11bfSDag-Erling Smørgravprotocol versions 1.5 and 2.0.
900