summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-08-08 01:16:01 +0000
committerDamien Miller <djm@mindrot.org>2018-08-08 11:18:05 +1000
commited7bd5d93fe14c7bd90febd29b858ea985d14d45 (patch)
treed33efae6fa03d1242f851b3d2f21b808809cde37
parent967226a1bdde59ea137e8f0df871854ff7b91366 (diff)
upstream: Use new private key format by default. This format is
suported by OpenSSH >= 6.5 (released January 2014), so it should be supported by most OpenSSH versions in active use. It is possible to convert new-format private keys to the older format using "ssh-keygen -f /path/key -pm PEM". ok deraadt dtucker OpenBSD-Commit-ID: e3bd4f2509a2103bfa2f710733426af3ad6d8ab8
-rw-r--r--ssh-keygen.124
-rw-r--r--ssh-keygen.c7
2 files changed, 12 insertions, 19 deletions
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 3525d7d17..dd6e7e5a8 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keygen.1,v 1.147 2018/03/12 00:52:01 djm Exp $ 1.\" $OpenBSD: ssh-keygen.1,v 1.148 2018/08/08 01:16:01 djm 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,7 +35,7 @@
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 12 2018 $ 38.Dd $Mdocdate: August 8 2018 $
39.Dt SSH-KEYGEN 1 39.Dt SSH-KEYGEN 1
40.Os 40.Os
41.Sh NAME 41.Sh NAME
@@ -233,10 +233,8 @@ This is used by
233.Pa /etc/rc 233.Pa /etc/rc
234to generate new host keys. 234to generate new host keys.
235.It Fl a Ar rounds 235.It Fl a Ar rounds
236When saving a new-format private key (i.e. an ed25519 key or when the 236When saving a private key this option specifies the number of KDF
237.Fl o 237(key derivation function) rounds used.
238flag is set), this option specifies the number of KDF (key derivation function)
239rounds used.
240Higher numbers result in slower passphrase verification and increased 238Higher numbers result in slower passphrase verification and increased
241resistance to brute-force password cracking (should the keys be stolen). 239resistance to brute-force password cracking (should the keys be stolen).
242.Pp 240.Pp
@@ -264,8 +262,6 @@ flag will be ignored.
264Provides a new comment. 262Provides a new comment.
265.It Fl c 263.It Fl c
266Requests changing the comment in the private and public key files. 264Requests changing the comment in the private and public key files.
267This operation is only supported for keys stored in the
268newer OpenSSH format.
269The program will prompt for the file containing the private keys, for 265The program will prompt for the file containing the private keys, for
270the passphrase if the key has one, and for the new comment. 266the passphrase if the key has one, and for the new comment.
271.It Fl D Ar pkcs11 267.It Fl D Ar pkcs11
@@ -410,6 +406,10 @@ or
410(PEM public key). 406(PEM public key).
411The default conversion format is 407The default conversion format is
412.Dq RFC4716 . 408.Dq RFC4716 .
409Setting a format of
410.Dq PEM
411when generating or updating a supported private key type will cause the
412key to be stored in the legacy PEM private key format.
413.It Fl N Ar new_passphrase 413.It Fl N Ar new_passphrase
414Provides the new passphrase. 414Provides the new passphrase.
415.It Fl n Ar principals 415.It Fl n Ar principals
@@ -504,14 +504,6 @@ The
504is a comma-separated list of one or more address/netmask pairs in CIDR 504is a comma-separated list of one or more address/netmask pairs in CIDR
505format. 505format.
506.El 506.El
507.It Fl o
508Causes
509.Nm
510to save private keys using the new OpenSSH format rather than
511the more compatible PEM format.
512The new format has increased resistance to brute-force password cracking
513but is not supported by versions of OpenSSH prior to 6.5.
514Ed25519 keys always use the new private key format.
515.It Fl P Ar passphrase 507.It Fl P Ar passphrase
516Provides the (old) passphrase. 508Provides the (old) passphrase.
517.It Fl p 509.It Fl p
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 3c9677057..22860ad90 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.318 2018/07/09 21:59:10 markus Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.319 2018/08/08 01:16:01 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -179,7 +179,7 @@ char *key_type_name = NULL;
179char *pkcs11provider = NULL; 179char *pkcs11provider = NULL;
180 180
181/* Use new OpenSSH private key format when writing SSH2 keys instead of PEM */ 181/* Use new OpenSSH private key format when writing SSH2 keys instead of PEM */
182int use_new_format = 0; 182int use_new_format = 1;
183 183
184/* Cipher for new-format private keys */ 184/* Cipher for new-format private keys */
185char *new_format_cipher = NULL; 185char *new_format_cipher = NULL;
@@ -2434,6 +2434,7 @@ main(int argc, char **argv)
2434 } 2434 }
2435 if (strcasecmp(optarg, "PEM") == 0) { 2435 if (strcasecmp(optarg, "PEM") == 0) {
2436 convert_format = FMT_PEM; 2436 convert_format = FMT_PEM;
2437 use_new_format = 0;
2437 break; 2438 break;
2438 } 2439 }
2439 fatal("Unsupported conversion format \"%s\"", optarg); 2440 fatal("Unsupported conversion format \"%s\"", optarg);
@@ -2441,7 +2442,7 @@ main(int argc, char **argv)
2441 cert_principals = optarg; 2442 cert_principals = optarg;
2442 break; 2443 break;
2443 case 'o': 2444 case 'o':
2444 use_new_format = 1; 2445 /* no-op; new format is already the default */
2445 break; 2446 break;
2446 case 'p': 2447 case 'p':
2447 change_passphrase = 1; 2448 change_passphrase = 1;