summaryrefslogtreecommitdiff
path: root/ssh-keygen.1
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.1')
-rw-r--r--ssh-keygen.1210
1 files changed, 194 insertions, 16 deletions
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 3596cc174..6557f9336 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keygen.1,v 1.79 2008/07/24 23:55:30 sthen Exp $ 1.\" $OpenBSD: ssh-keygen.1,v 1.88 2010/03/08 00:28:55 djm Exp $
2.\" 2.\"
3.\" -*- nroff -*- 3.\" -*- nroff -*-
4.\" 4.\"
@@ -37,7 +37,7 @@
37.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 37.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
38.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39.\" 39.\"
40.Dd $Mdocdate: July 24 2008 $ 40.Dd $Mdocdate: March 8 2010 $
41.Dt SSH-KEYGEN 1 41.Dt SSH-KEYGEN 1
42.Os 42.Os
43.Sh NAME 43.Sh NAME
@@ -52,7 +52,6 @@
52.Op Fl N Ar new_passphrase 52.Op Fl N Ar new_passphrase
53.Op Fl C Ar comment 53.Op Fl C Ar comment
54.Op Fl f Ar output_keyfile 54.Op Fl f Ar output_keyfile
55.Ek
56.Nm ssh-keygen 55.Nm ssh-keygen
57.Fl p 56.Fl p
58.Op Fl P Ar old_passphrase 57.Op Fl P Ar old_passphrase
@@ -79,7 +78,7 @@
79.Fl B 78.Fl B
80.Op Fl f Ar input_keyfile 79.Op Fl f Ar input_keyfile
81.Nm ssh-keygen 80.Nm ssh-keygen
82.Fl D Ar reader 81.Fl D Ar pkcs11
83.Nm ssh-keygen 82.Nm ssh-keygen
84.Fl F Ar hostname 83.Fl F Ar hostname
85.Op Fl f Ar known_hosts_file 84.Op Fl f Ar known_hosts_file
@@ -91,9 +90,6 @@
91.Fl R Ar hostname 90.Fl R Ar hostname
92.Op Fl f Ar known_hosts_file 91.Op Fl f Ar known_hosts_file
93.Nm ssh-keygen 92.Nm ssh-keygen
94.Fl U Ar reader
95.Op Fl f Ar input_keyfile
96.Nm ssh-keygen
97.Fl r Ar hostname 93.Fl r Ar hostname
98.Op Fl f Ar input_keyfile 94.Op Fl f Ar input_keyfile
99.Op Fl g 95.Op Fl g
@@ -109,6 +105,18 @@
109.Op Fl v 105.Op Fl v
110.Op Fl a Ar num_trials 106.Op Fl a Ar num_trials
111.Op Fl W Ar generator 107.Op Fl W Ar generator
108.Nm ssh-keygen
109.Fl s Ar ca_key
110.Fl I Ar certificate_identity
111.Op Fl h
112.Op Fl n Ar principals
113.Op Fl O Ar constraint
114.Op Fl V Ar validity_interval
115.Ar
116.Nm ssh-keygen
117.Fl L
118.Op Fl f Ar input_keyfile
119.Ek
112.Sh DESCRIPTION 120.Sh DESCRIPTION
113.Nm 121.Nm
114generates, manages and converts authentication keys for 122generates, manages and converts authentication keys for
@@ -201,9 +209,9 @@ Requests changing the comment in the private and public key files.
201This operation is only supported for RSA1 keys. 209This operation is only supported for RSA1 keys.
202The program will prompt for the file containing the private keys, for 210The program will prompt for the file containing the private keys, for
203the passphrase if the key has one, and for the new comment. 211the passphrase if the key has one, and for the new comment.
204.It Fl D Ar reader 212.It Fl D Ar pkcs11
205Download the RSA public key stored in the smartcard in 213Download the RSA public keys provided by the PKCS#11 shared library
206.Ar reader . 214.Ar pkcs11 .
207.It Fl e 215.It Fl e
208This option will read a private or public OpenSSH key file and 216This option will read a private or public OpenSSH key file and
209print the key in 217print the key in
@@ -248,6 +256,17 @@ but they do not reveal identifying information should the file's contents
248be disclosed. 256be disclosed.
249This option will not modify existing hashed hostnames and is therefore safe 257This option will not modify existing hashed hostnames and is therefore safe
250to use on files that mix hashed and non-hashed names. 258to use on files that mix hashed and non-hashed names.
259.It Fl h
260When signing a key, create a host certificate instead of a user
261certificate.
262Please see the
263.Sx CERTIFICATES
264section for details.
265.It Fl I Ar certificate_identity
266Specify the key identity when signing a public key.
267Please see the
268.Sx CERTIFICATES
269section for details.
251.It Fl i 270.It Fl i
252This option will read an unencrypted private (or public) key file 271This option will read an unencrypted private (or public) key file
253in SSH2-compatible format and print an OpenSSH compatible private 272in SSH2-compatible format and print an OpenSSH compatible private
@@ -257,6 +276,8 @@ also reads the
257RFC 4716 SSH Public Key File Format. 276RFC 4716 SSH Public Key File Format.
258This option allows importing keys from several commercial 277This option allows importing keys from several commercial
259SSH implementations. 278SSH implementations.
279.It Fl L
280Prints the contents of a certificate.
260.It Fl l 281.It Fl l
261Show fingerprint of specified public key file. 282Show fingerprint of specified public key file.
262Private RSA1 keys are also supported. 283Private RSA1 keys are also supported.
@@ -271,6 +292,71 @@ Specify the amount of memory to use (in megabytes) when generating
271candidate moduli for DH-GEX. 292candidate moduli for DH-GEX.
272.It Fl N Ar new_passphrase 293.It Fl N Ar new_passphrase
273Provides the new passphrase. 294Provides the new passphrase.
295.It Fl n Ar principals
296Specify one or more principals (user or host names) to be included in
297a certificate when signing a key.
298Multiple principals may be specified, separated by commas.
299Please see the
300.Sx CERTIFICATES
301section for details.
302.It Fl O Ar constraint
303Specify a certificate constraint when signing a key.
304This option may be specified multiple times.
305Please see the
306.Sx CERTIFICATES
307section for details.
308The constraints that are valid for user certificates are:
309.Bl -tag -width Ds
310.It Ic no-x11-forwarding
311Disable X11 forwarding (permitted by default).
312.It Ic no-agent-forwarding
313Disable
314.Xr ssh-agent 1
315forwarding (permitted by default).
316.It Ic no-port-forwarding
317Disable port forwarding (permitted by default).
318.It Ic no-pty
319Disable PTY allocation (permitted by default).
320.It Ic no-user-rc
321Disable execution of
322.Pa ~/.ssh/rc
323by
324.Xr sshd 8
325(permitted by default).
326.It Ic clear
327Clear all enabled permissions.
328This is useful for clearing the default set of permissions so permissions may
329be added individually.
330.It Ic permit-x11-forwarding
331Allows X11 forwarding.
332.It Ic permit-agent-forwarding
333Allows
334.Xr ssh-agent 1
335forwarding.
336.It Ic permit-port-forwarding
337Allows port forwarding.
338.It Ic permit-pty
339Allows PTY allocation.
340.It Ic permit-user-rc
341Allows execution of
342.Pa ~/.ssh/rc
343by
344.Xr sshd 8 .
345.It Ic force-command=command
346Forces the execution of
347.Ar command
348instead of any shell or command specified by the user when
349the certificate is used for authentication.
350.It Ic source-address=address_list
351Restrict the source addresses from which the certificate is considered valid
352from.
353The
354.Ar address_list
355is a comma-separated list of one or more address/netmask pairs in CIDR
356format.
357.El
358.Pp
359At present, no constraints are valid for host keys.
274.It Fl P Ar passphrase 360.It Fl P Ar passphrase
275Provides the (old) passphrase. 361Provides the (old) passphrase.
276.It Fl p 362.It Fl p
@@ -300,6 +386,11 @@ Print the SSHFP fingerprint resource record named
300for the specified public key file. 386for the specified public key file.
301.It Fl S Ar start 387.It Fl S Ar start
302Specify start point (in hex) when generating candidate moduli for DH-GEX. 388Specify start point (in hex) when generating candidate moduli for DH-GEX.
389.It Fl s Ar ca_key
390Certify (sign) a public key using the specified CA key.
391Please see the
392.Sx CERTIFICATES
393section for details.
303.It Fl T Ar output_file 394.It Fl T Ar output_file
304Test DH group exchange candidate primes (generated using the 395Test DH group exchange candidate primes (generated using the
305.Fl G 396.Fl G
@@ -313,9 +404,29 @@ for protocol version 1 and
313or 404or
314.Dq dsa 405.Dq dsa
315for protocol version 2. 406for protocol version 2.
316.It Fl U Ar reader 407.It Fl V Ar validity_interval
317Upload an existing RSA private key into the smartcard in 408Specify a validity interval when signing a certificate.
318.Ar reader . 409A validity interval may consist of a single time, indicating that the
410certificate is valid beginning now and expiring at that time, or may consist
411of two times separated by a colon to indicate an explicit time interval.
412The start time may be specified as a date in YYYYMMDD format, a time
413in YYYYMMDDHHMMSS format or a relative time (to the current time) consisting
414of a minus sign followed by a relative time in the format described in the
415.Sx TIME FORMATS
416section of
417.Xr ssh_config 5 .
418The end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMMSS time or
419a relative time starting with a plus character.
420.Pp
421For example:
422.Dq +52w1d
423(valid from now to 52 weeks and one day from now),
424.Dq -4w:+4w
425(valid from four weeks ago to four weeks from now),
426.Dq 20100101123000:20110101123000
427(valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011),
428.Dq -1d:20110101
429(valid from yesterday to midnight, January 1st, 2011).
319.It Fl v 430.It Fl v
320Verbose mode. 431Verbose mode.
321Causes 432Causes
@@ -386,6 +497,73 @@ Screened DH groups may be installed in
386.Pa /etc/moduli . 497.Pa /etc/moduli .
387It is important that this file contains moduli of a range of bit lengths and 498It is important that this file contains moduli of a range of bit lengths and
388that both ends of a connection share common moduli. 499that both ends of a connection share common moduli.
500.Sh CERTIFICATES
501.Nm
502supports signing of keys to produce certificates that may be used for
503user or host authentication.
504Certificates consist of a public key, some identity information, zero or
505more principal (user or host) names and an optional set of constraints that
506are signed by a Certification Authority (CA) key.
507Clients or servers may then trust only the CA key and verify its signature
508on a certificate rather than trusting many user/host keys.
509Note that OpenSSH certificates are a different, and much simpler, format to
510the X.509 certificates used in
511.Xr ssl 8 .
512.Pp
513.Nm
514supports two types of certificates: user and host.
515User certificates authenticate users to servers, whereas host certificates
516authenticate server hosts to users.
517To generate a user certificate:
518.Pp
519.Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
520.Pp
521The resultant certificate will be placed in
522.Pa /path/to/user_key_cert.pub .
523A host certificate requires the
524.Fl h
525option:
526.Pp
527.Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub
528.Pp
529The host certificate will be output to
530.Pa /path/to/host_key_cert.pub .
531In both cases,
532.Ar key_id
533is a "key identifier" that is logged by the server when the certificate
534is used for authentication.
535.Pp
536Certificates may be limited to be valid for a set of principal (user/host)
537names.
538By default, generated certificates are valid for all users or hosts.
539To generate a certificate for a specified set of principals:
540.Pp
541.Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
542.Dl $ ssh-keygen -s ca_key -I key_id -h -n host.domain user_key.pub
543.Pp
544Additional limitations on the validity and use of user certificates may
545be specified through certificate constraints.
546A constrained certificate may disable features of the SSH session, may be
547valid only when presented from particular source addresses or may
548force the use of a specific command.
549For a list of valid certificate constraints, see the documentation for the
550.Fl O
551option above.
552.Pp
553Finally, certificates may be defined with a validity lifetime.
554The
555.Fl V
556option allows specification of certificate start and end times.
557A certificate that is presented at a time outside this range will not be
558considered valid.
559By default, certificates have a maximum validity interval.
560.Pp
561For certificates to be used for user or host authentication, the CA
562public key must be trusted by
563.Xr sshd 8
564or
565.Xr ssh 1 .
566Please refer to those manual pages for details.
389.Sh FILES 567.Sh FILES
390.Bl -tag -width Ds 568.Bl -tag -width Ds
391.It Pa ~/.ssh/identity 569.It Pa ~/.ssh/identity
@@ -393,7 +571,7 @@ Contains the protocol version 1 RSA authentication identity of the user.
393This file should not be readable by anyone but the user. 571This file should not be readable by anyone but the user.
394It is possible to 572It is possible to
395specify a passphrase when generating the key; that passphrase will be 573specify a passphrase when generating the key; that passphrase will be
396used to encrypt the private part of this file using 3DES. 574used to encrypt the private part of this file using 128-bit AES.
397This file is not automatically accessed by 575This file is not automatically accessed by
398.Nm 576.Nm
399but it is offered as the default file for the private key. 577but it is offered as the default file for the private key.
@@ -411,7 +589,7 @@ Contains the protocol version 2 DSA authentication identity of the user.
411This file should not be readable by anyone but the user. 589This file should not be readable by anyone but the user.
412It is possible to 590It is possible to
413specify a passphrase when generating the key; that passphrase will be 591specify a passphrase when generating the key; that passphrase will be
414used to encrypt the private part of this file using 3DES. 592used to encrypt the private part of this file using 128-bit AES.
415This file is not automatically accessed by 593This file is not automatically accessed by
416.Nm 594.Nm
417but it is offered as the default file for the private key. 595but it is offered as the default file for the private key.
@@ -429,7 +607,7 @@ Contains the protocol version 2 RSA authentication identity of the user.
429This file should not be readable by anyone but the user. 607This file should not be readable by anyone but the user.
430It is possible to 608It is possible to
431specify a passphrase when generating the key; that passphrase will be 609specify a passphrase when generating the key; that passphrase will be
432used to encrypt the private part of this file using 3DES. 610used to encrypt the private part of this file using 128-bit AES.
433This file is not automatically accessed by 611This file is not automatically accessed by
434.Nm 612.Nm
435but it is offered as the default file for the private key. 613but it is offered as the default file for the private key.