-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathssh-keygen.ts
445 lines (442 loc) · 11.1 KB
/
ssh-keygen.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
const allOptions = [
"-A",
"-a",
"-B",
"-b",
"-C",
"-c",
"-D",
"-E",
"-e",
"-F",
"-f",
"-g",
"-H",
"-h",
"-I",
"-i",
"-K",
"-k",
"-L",
"-l",
"-M",
"-m",
"-N",
"-n",
"-O",
"-P",
"-p",
"-Q",
"-q",
"-R",
"-r",
"-s",
"-t",
"-U",
"-u",
"-V",
"-v",
"-w",
"-Y",
"-y",
"-Z",
"-z",
];
const completionSpec: Fig.Spec = {
name: "ssh-keygen",
description: "Generates, manages and converts authentication keys for ssh",
options: [
{
name: "-A",
description:
"For each of the key types (rsa, dsa, ecdsa and ed25519) for which host keys do not exist, generate the host keys with the default key file path, an empty passphrase, default bits for the key type, and default comment",
exclusiveOn: allOptions.filter(
(option) => option !== "-a" && option !== "-f"
),
},
{
name: "-a",
description:
"When saving a private key, this option specifies the number of KDF",
args: {
name: "rounds",
description: "Number of rounds being used",
default: "16",
isOptional: true,
suggestions: ["16"],
},
},
{
name: "-B",
description:
"Show the bubblebabble digest of specified private or public key file",
exclusiveOn: allOptions.filter((option) => option !== "-f"),
},
{
name: "-b",
description: "Specifies the number of bits in the key to create",
args: {
name: "bits",
description: "Number of bits in the key",
default: "3072",
suggestions: ["3072"],
},
},
{
name: "-C",
description: "Provides a new comment",
args: {
name: "comment",
description: "New comment value",
},
},
{
name: "-c",
description:
"Requests changing the comment in the private and public key files",
exclusiveOn: allOptions.filter(
(option) =>
option !== "-a" &&
option !== "-C" &&
option !== "-f" &&
option !== "-P"
),
},
{
name: "-D",
description: "Download the public keys provided by the PKCS#11",
args: {
name: "pkcs11",
description: "PKCS#11 public keys",
},
exclusiveOn: allOptions,
},
{
name: "-E",
description: "Specifies the hash algorithm used",
args: {
name: "fingerprint_hash",
description: "Hash algorithm value",
default: "sha256",
suggestions: [{ name: "md5" }, { name: "sha256" }],
},
},
{
name: "-e",
description: "Read a OpenSSH key file and print to stdout",
exclusiveOn: allOptions.filter(
(option) => option !== "-f" && option !== "-m"
),
},
{
name: "-F",
description:
"Search for the specified hostname (with optional port number)",
args: {
name: "hostname",
description: "Hostname with optional port number",
},
exclusiveOn: allOptions.filter(
(option) => option !== "-l" && option !== "-v" && option !== "-f"
),
},
{
name: "-f",
description: "Specifies the filename of the key file",
args: {
name: "filename",
description: "Filename of the key file",
template: "filepaths",
suggestCurrentToken: true,
},
},
{
name: "-g",
description:
"Use generic DNS format when printing fingerprint resource records",
},
{
name: "-H",
description: "Hash a known_hosts file",
exclusiveOn: allOptions.filter((option) => option !== "-f"),
},
{
name: "-h",
description: "Create a host certificate instead of a user",
},
{
name: "-I",
description: "Specify the key identity when signing a public key",
args: {
name: "certificate_identity",
description: "Key identity value",
template: "filepaths",
},
exclusiveOn: allOptions.filter(
(option) =>
option !== "-s" &&
option !== "-h" &&
option !== "-U" &&
option !== "-D"
),
},
{
name: "-i",
description: "Read an unencrypted private (or public) key file",
exclusiveOn: allOptions.filter(
(option) => option !== "-f" && option !== "-m"
),
},
{
name: "-K",
description: "Download resident keys from a FIDO authenticator",
exclusiveOn: allOptions.filter(
(option) => option !== "-a" && option !== "-w"
),
},
{
name: "-k",
description: "Generate a KRL file",
dependsOn: ["-f"],
exclusiveOn: allOptions.filter(
(option) =>
option !== "-f" &&
option !== "-u" &&
option !== "-s" &&
option !== "-z"
),
},
{
name: "-L",
description: "Generate a KRL file",
exclusiveOn: allOptions.filter((option) => option !== "-f"),
},
{
name: "-l",
description: "Show fingerprint of specified public key file",
exclusiveOn: allOptions.filter(
(option) => option !== "-v" && option !== "-E" && option !== "-f"
),
},
{
name: "-M",
description: "Use for Moduli generation",
args: {
name: "command",
description: "Use generate or screen",
suggestions: [{ name: "generate" }, { name: "screen" }],
},
exclusiveOn: allOptions.filter(
(option) => option !== "-f" && option !== "-O"
),
},
{
name: "-m",
description: "Specify a key format for key generation",
args: {
name: "key_format",
description: "Key format for key generation",
},
},
{
name: "-N",
description: "Provides the new passphrase",
args: {
name: "new_passphrase",
description: "New passphrase value",
},
},
{
name: "-n",
description:
"Specify one or more principals (user or host names) to be included in a certificate when signing a key",
args: {
name: "principals",
description:
"Principals to be included in a certificate when signing a key",
},
},
{
name: "-O",
description: "Specify a key/value option",
isRepeatable: true,
args: {
name: "option",
description: "Value for option",
},
},
{
name: "-P",
description: "Provides the (old) passphrase",
args: {
name: "passphrase",
description: "(Old) passphrase value",
},
},
{
name: "-p",
description:
"Requests changing the passphrase of a private key file instead of creating a new private key",
exclusiveOn: allOptions.filter(
(option) =>
option !== "-a" &&
option !== "-f" &&
option !== "-m" &&
option !== "-N"
),
},
{
name: "-Q",
description: "Test whether keys have been revoked in a KRL",
exclusiveOn: allOptions.filter(
(option) => option !== "-l" && option !== "-f"
),
},
{
name: "-q",
description: "Silence ssh-keygen",
},
{
name: "-R",
description: "Removes all keys belonging to hostname",
args: {
name: "hostname",
description: "Hostname to remove keys from a known_hosts file",
},
exclusiveOn: allOptions.filter((option) => option !== "-f"),
},
{
name: "-r",
description:
"Print the SSHFP fingerprint resource record named hostname for the specified public key file",
args: {
name: "hostname",
description: "Hostname for the specified public key file",
},
exclusiveOn: allOptions.filter(
(option) => option !== "-g" && option !== "-f"
),
},
{
name: "-s",
description: "Certify (sign) a public key using the specified CA key",
args: {
name: "ca_key",
description: "Hostname for the specified public key file",
},
},
{
name: "-t",
description: "Specifies the type of key to create",
args: {
name: "command",
suggestions: [
{ name: "dsa" },
{ name: "ecdsa-sk" },
{ name: "ed25519" },
{ name: "ed25519-sk" },
{ name: "rsa" },
],
},
},
{
name: "-U",
description:
"When used in combination with -s, this option indicates that a CA key resides in a ssh-agent(1)",
},
{
name: "-u",
description: "Update a KRL",
},
{
name: "-V",
description: "Specify a validity interval when signing a certificate",
args: {
name: "validity_interval",
description: "Value for validity interval",
},
},
{
name: "-v",
description: "Verbose mode",
isRepeatable: 3,
},
{
name: "-w",
description:
"Specifies a path to a library that will be used when creating FIDO authenticator-hosted keys",
args: {
name: "provider",
description:
"Path to library to be used when creating FIDO authenticator-hosted keys",
},
},
{
name: "-Y",
description:
"Multiple functions: find principals, match principals, check novalidate, sign, verify",
args: {
name: "command",
suggestions: [
{
name: "find-principals",
description:
"Find the principal(s) associated with the public key of a signature",
},
{
name: "check-novalidate",
description:
"Checks that a signature generated using ssh-keygen -Y sign has a valid structure",
},
{
name: "sign",
description:
"Cryptographically sign a file or some data using a SSH key",
},
{
name: "verify",
description:
"Request to verify a signature generated using ssh-keygen -Y",
},
],
isVariadic: true,
},
exclusiveOn: allOptions.filter(
(option) =>
option !== "-s" &&
option !== "-f" &&
option !== "-n" &&
option !== "-r"
),
},
{
name: "-y",
description:
"Read a private OpenSSH format file and print an OpenSSH public key to stdout",
exclusiveOn: allOptions.filter((option) => option !== "-f"),
},
{
name: "-Z",
description:
"Specifies the cipher to use for encryption when writing an OpenSSH-format private key file",
args: {
name: "cipher",
description: "Cipher to use for encryption",
default: "aes256-ctr",
},
},
{
name: "-z",
description:
"Specifies a serial number to be embedded in the certificate to distinguish this certificate from others from the same CA",
args: {
name: "serial_number",
description: "Serial number to distinguish this certificate",
default: "aes256-ctr",
},
},
],
// Only uncomment if ssh-keygen takes an argument
// args: {}
};
export default completionSpec;