@andrewheberle/serverless-ssh-ca 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -1
- package/dist/api/operations.d.ts +50 -0
- package/dist/api/operations.d.ts.map +1 -0
- package/dist/api/operations.js +264 -0
- package/dist/api/operations.js.map +1 -0
- package/dist/api/schema.d.ts +72 -0
- package/dist/api/schema.d.ts.map +1 -0
- package/dist/api/schema.js +114 -0
- package/dist/api/schema.js.map +1 -0
- package/dist/api/v3/index.d.ts.map +1 -1
- package/dist/api/v3/index.js +13 -202
- package/dist/api/v3/index.js.map +1 -1
- package/dist/api/v3/schema.d.ts +23 -68
- package/dist/api/v3/schema.d.ts.map +1 -1
- package/dist/api/v3/schema.js +18 -104
- package/dist/api/v3/schema.js.map +1 -1
- package/dist/api/v4/index.d.ts +8 -0
- package/dist/api/v4/index.d.ts.map +1 -0
- package/dist/api/v4/index.js +155 -0
- package/dist/api/v4/index.js.map +1 -0
- package/dist/api/v4/schema.d.ts +268 -0
- package/dist/api/v4/schema.d.ts.map +1 -0
- package/dist/api/v4/schema.js +186 -0
- package/dist/api/v4/schema.js.map +1 -0
- package/dist/certificate.d.ts +9 -6
- package/dist/certificate.d.ts.map +1 -1
- package/dist/certificate.js +55 -99
- package/dist/certificate.js.map +1 -1
- package/dist/db/index.d.ts +68 -9
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +165 -49
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations/0003_krl_revision.d.ts +3 -0
- package/dist/db/migrations/0003_krl_revision.d.ts.map +1 -0
- package/dist/db/migrations/0003_krl_revision.js +14 -0
- package/dist/db/migrations/0003_krl_revision.js.map +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +2 -0
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/db/types.d.ts +2 -0
- package/dist/db/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/krl.d.ts +3 -2
- package/dist/krl.d.ts.map +1 -1
- package/dist/krl.js +12 -165
- package/dist/krl.js.map +1 -1
- package/dist/node/cache.d.ts +21 -0
- package/dist/node/cache.d.ts.map +1 -0
- package/dist/node/cache.js +49 -0
- package/dist/node/cache.js.map +1 -0
- package/dist/node/env.d.ts +6 -3
- package/dist/node/env.d.ts.map +1 -1
- package/dist/node/env.js +4 -3
- package/dist/node/env.js.map +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/proof.d.ts +36 -7
- package/dist/proof.d.ts.map +1 -1
- package/dist/proof.js +53 -21
- package/dist/proof.js.map +1 -1
- package/dist/router.d.ts +25 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +41 -2
- package/dist/router.js.map +1 -1
- package/dist/ssh/certificate.d.ts +93 -0
- package/dist/ssh/certificate.d.ts.map +1 -0
- package/dist/ssh/certificate.js +178 -0
- package/dist/ssh/certificate.js.map +1 -0
- package/dist/ssh/encoding.d.ts +41 -0
- package/dist/ssh/encoding.d.ts.map +1 -0
- package/dist/ssh/encoding.js +70 -0
- package/dist/ssh/encoding.js.map +1 -0
- package/dist/ssh/keys.d.ts +92 -0
- package/dist/ssh/keys.d.ts.map +1 -0
- package/dist/ssh/keys.js +277 -0
- package/dist/ssh/keys.js.map +1 -0
- package/dist/ssh/signer.d.ts +35 -0
- package/dist/ssh/signer.d.ts.map +1 -0
- package/dist/ssh/signer.js +99 -0
- package/dist/ssh/signer.js.map +1 -0
- package/dist/types.d.ts +64 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +107 -21
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +251 -65
- package/dist/utils.js.map +1 -1
- package/dist/verify.d.ts +17 -5
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +47 -9
- package/dist/verify.js.map +1 -1
- package/openapi.json +1942 -1
- package/package.json +4 -3
- package/src/api/operations.ts +314 -0
- package/src/api/schema.ts +146 -0
- package/src/api/v3/index.ts +21 -248
- package/src/api/v3/schema.ts +36 -128
- package/src/api/v4/index.ts +266 -0
- package/src/api/v4/schema.ts +241 -0
- package/src/certificate.ts +62 -123
- package/src/db/index.ts +196 -56
- package/src/db/migrations/0003_krl_revision.ts +15 -0
- package/src/db/migrations/index.ts +2 -0
- package/src/db/types.ts +2 -0
- package/src/index.ts +6 -4
- package/src/krl.ts +13 -197
- package/src/node/cache.ts +62 -0
- package/src/node/env.ts +6 -5
- package/src/node/index.ts +1 -0
- package/src/proof.ts +65 -31
- package/src/router.ts +67 -3
- package/src/ssh/certificate.ts +236 -0
- package/src/ssh/encoding.ts +81 -0
- package/src/ssh/keys.ts +327 -0
- package/src/ssh/signer.ts +129 -0
- package/src/types.ts +60 -20
- package/src/utils.ts +285 -81
- package/src/verify.ts +54 -14
package/dist/ssh/keys.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
2
|
+
import { base64, base64nopad, base64urlnopad } from "@scure/base";
|
|
3
|
+
import * as P from "micro-packed";
|
|
4
|
+
import { toFixedWidth } from "../sshsig/sig_parser.js";
|
|
5
|
+
import { decodePublicKey, SSHBytes, SSHText } from "./encoding.js";
|
|
6
|
+
/**
|
|
7
|
+
* Thrown when a key cannot be parsed
|
|
8
|
+
*/
|
|
9
|
+
export class KeyParseError extends Error {
|
|
10
|
+
constructor(message, cause) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "KeyParseError";
|
|
13
|
+
this.cause = cause;
|
|
14
|
+
Object.setPrototypeOf(this, KeyParseError.prototype);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when a private key is of a type that cannot be used to sign
|
|
19
|
+
*/
|
|
20
|
+
export class UnsupportedKeyError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "UnsupportedKeyError";
|
|
24
|
+
Object.setPrototypeOf(this, UnsupportedKeyError.prototype);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const equalBytes = (a, b) => {
|
|
28
|
+
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* An SSH public key
|
|
32
|
+
*/
|
|
33
|
+
export class PublicKey {
|
|
34
|
+
/** The key type, for example "ssh-ed25519" */
|
|
35
|
+
type;
|
|
36
|
+
/** The wire encoding of the key (RFC 4253 section 6.6) */
|
|
37
|
+
blob;
|
|
38
|
+
/** The comment of the key, if any */
|
|
39
|
+
comment;
|
|
40
|
+
/**
|
|
41
|
+
* @param blob The wire encoding of the key
|
|
42
|
+
* @param comment The comment of the key
|
|
43
|
+
* @throws {@link KeyParseError} when the key cannot be decoded or its type is not supported
|
|
44
|
+
*/
|
|
45
|
+
constructor(blob, comment) {
|
|
46
|
+
try {
|
|
47
|
+
this.type = decodePublicKey(blob).type;
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
throw new KeyParseError(err instanceof Error ? err.message : "public key could not be decoded", err);
|
|
51
|
+
}
|
|
52
|
+
this.blob = blob;
|
|
53
|
+
this.comment = comment === "" ? undefined : comment;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parses a public key in OpenSSH format, `${type} ${base64}[ ${comment}]`
|
|
57
|
+
*
|
|
58
|
+
* @param text The public key
|
|
59
|
+
* @throws {@link KeyParseError} when the key cannot be parsed or its type is not supported
|
|
60
|
+
*/
|
|
61
|
+
static parse(text) {
|
|
62
|
+
const [type, data, ...comment] = text.trim().split(/\s+/);
|
|
63
|
+
if (type === undefined || type === "" || data === undefined) {
|
|
64
|
+
throw new KeyParseError("public key was not in OpenSSH format");
|
|
65
|
+
}
|
|
66
|
+
let blob;
|
|
67
|
+
try {
|
|
68
|
+
blob = base64.decode(data);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
throw new KeyParseError("public key was not valid base64", err);
|
|
72
|
+
}
|
|
73
|
+
const key = new PublicKey(blob, comment.join(" "));
|
|
74
|
+
if (key.type !== type) {
|
|
75
|
+
throw new KeyParseError(`public key type ${type} did not match encoded type ${key.type}`);
|
|
76
|
+
}
|
|
77
|
+
return key;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the SHA256 fingerprint of the key, as shown by `ssh-keygen -l`,
|
|
81
|
+
* for example "SHA256:79mq0wtpQMTvS4+Of8VzLN0qmYWNUyTXYmqKwhEgSLs"
|
|
82
|
+
*/
|
|
83
|
+
fingerprint() {
|
|
84
|
+
return `SHA256:${base64nopad.encode(sha256(this.blob))}`;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns whether this is the same key as another, ignoring comments
|
|
88
|
+
*/
|
|
89
|
+
equals(other) {
|
|
90
|
+
return equalBytes(this.blob, other.blob);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Returns a copy of the key with a different comment
|
|
94
|
+
*/
|
|
95
|
+
withComment(comment) {
|
|
96
|
+
return new PublicKey(this.blob, comment);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns the key in OpenSSH format, `${type} ${base64}[ ${comment}]`
|
|
100
|
+
*/
|
|
101
|
+
toString() {
|
|
102
|
+
const key = `${this.type} ${base64.encode(this.blob)}`;
|
|
103
|
+
return this.comment === undefined ? key : `${key} ${this.comment}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The smallest RSA key, in bits, that the CA will issue a certificate for.
|
|
108
|
+
* This matches the minimum accepted by ssh-ca-client.
|
|
109
|
+
*/
|
|
110
|
+
export const MinimumRsaKeyBits = 2048;
|
|
111
|
+
/**
|
|
112
|
+
* Returns the size in bits of the modulus of an RSA public key, or undefined
|
|
113
|
+
* if the key is not an RSA key.
|
|
114
|
+
*
|
|
115
|
+
* @param key The public key
|
|
116
|
+
*/
|
|
117
|
+
export const rsaKeyBits = (key) => {
|
|
118
|
+
if (key.type !== "ssh-rsa") {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
// the fields of an RSA key are the exponent and the modulus, an mpint
|
|
122
|
+
// that may have a leading zero byte to keep it positive
|
|
123
|
+
const modulus = decodePublicKey(key.blob).fields[1];
|
|
124
|
+
if (modulus === undefined) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const start = modulus.findIndex((byte) => byte !== 0);
|
|
128
|
+
const first = modulus[start];
|
|
129
|
+
if (start === -1 || first === undefined) {
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
return (modulus.length - start - 1) * 8 + first.toString(2).length;
|
|
133
|
+
};
|
|
134
|
+
const EcdsaCurves = {
|
|
135
|
+
nistp256: { namedCurve: "P-256", size: 32 },
|
|
136
|
+
nistp384: { namedCurve: "P-384", size: 48 },
|
|
137
|
+
nistp521: { namedCurve: "P-521", size: 66 },
|
|
138
|
+
};
|
|
139
|
+
// "openssh-key-v1\0"
|
|
140
|
+
const AUTH_MAGIC = new TextEncoder().encode("openssh-key-v1\0");
|
|
141
|
+
/** The container of an OpenSSH private key (PROTOCOL.key) */
|
|
142
|
+
const OpenSshPrivateKey = P.struct({
|
|
143
|
+
magic: P.magicBytes(AUTH_MAGIC),
|
|
144
|
+
cipherName: SSHText,
|
|
145
|
+
kdfName: SSHText,
|
|
146
|
+
kdfOptions: SSHBytes,
|
|
147
|
+
publicKeys: P.array(P.U32BE, SSHBytes),
|
|
148
|
+
privateKeys: SSHBytes,
|
|
149
|
+
});
|
|
150
|
+
/** The start of the (decrypted) private section of an OpenSSH private key */
|
|
151
|
+
const PrivateSectionStart = P.struct({
|
|
152
|
+
check1: P.U32BE,
|
|
153
|
+
check2: P.U32BE,
|
|
154
|
+
type: SSHText,
|
|
155
|
+
});
|
|
156
|
+
const Ed25519PrivateKey = P.struct({
|
|
157
|
+
check1: P.U32BE,
|
|
158
|
+
check2: P.U32BE,
|
|
159
|
+
type: SSHText,
|
|
160
|
+
publicKey: SSHBytes,
|
|
161
|
+
// the seed followed by the public key
|
|
162
|
+
privateKey: SSHBytes,
|
|
163
|
+
comment: SSHText,
|
|
164
|
+
});
|
|
165
|
+
const EcdsaPrivateKey = P.struct({
|
|
166
|
+
check1: P.U32BE,
|
|
167
|
+
check2: P.U32BE,
|
|
168
|
+
type: SSHText,
|
|
169
|
+
curve: SSHText,
|
|
170
|
+
publicKey: SSHBytes,
|
|
171
|
+
// an mpint
|
|
172
|
+
privateKey: SSHBytes,
|
|
173
|
+
comment: SSHText,
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* Returns a short name for the type of a key, for example "rsa" for "ssh-rsa"
|
|
177
|
+
*/
|
|
178
|
+
const keyTypeName = (type) => {
|
|
179
|
+
return type.replace(/^ssh-/, "").replace(/^ecdsa-sha2-.*$/, "ecdsa");
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Parses an unencrypted Ed25519 or ECDSA private key in OpenSSH format, as
|
|
183
|
+
* created by `ssh-keygen`
|
|
184
|
+
*
|
|
185
|
+
* @param text The private key, starting with `-----BEGIN OPENSSH PRIVATE KEY-----`
|
|
186
|
+
* @returns The private key
|
|
187
|
+
* @throws {@link KeyParseError} when the key cannot be parsed or is encrypted
|
|
188
|
+
* @throws {@link UnsupportedKeyError} when the key is not an Ed25519 or ECDSA key
|
|
189
|
+
*/
|
|
190
|
+
export const parsePrivateKey = (text) => {
|
|
191
|
+
const match = /-----BEGIN OPENSSH PRIVATE KEY-----([\s\S]*?)-----END OPENSSH PRIVATE KEY-----/.exec(text);
|
|
192
|
+
if (match === null) {
|
|
193
|
+
throw new KeyParseError("private key was not in OpenSSH format, as created by ssh-keygen (starting with -----BEGIN OPENSSH PRIVATE KEY-----)");
|
|
194
|
+
}
|
|
195
|
+
let container;
|
|
196
|
+
try {
|
|
197
|
+
container = OpenSshPrivateKey.decode(base64.decode(match[1].replace(/\s+/g, "")));
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
throw new KeyParseError("private key could not be decoded", err);
|
|
201
|
+
}
|
|
202
|
+
if (container.cipherName !== "none" || container.kdfName !== "none") {
|
|
203
|
+
throw new KeyParseError("encrypted private keys are not supported");
|
|
204
|
+
}
|
|
205
|
+
if (container.publicKeys.length !== 1) {
|
|
206
|
+
throw new KeyParseError(`private key must contain one key, not ${container.publicKeys.length}`);
|
|
207
|
+
}
|
|
208
|
+
// the private section is padded to a block size, so may have trailing bytes
|
|
209
|
+
const options = { allowUnreadBytes: true };
|
|
210
|
+
let start;
|
|
211
|
+
try {
|
|
212
|
+
start = PrivateSectionStart.decode(container.privateKeys, options);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
throw new KeyParseError("private key could not be decoded", err);
|
|
216
|
+
}
|
|
217
|
+
if (start.check1 !== start.check2) {
|
|
218
|
+
throw new KeyParseError("private key check values did not match");
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
if (start.type === "ssh-ed25519") {
|
|
222
|
+
const key = Ed25519PrivateKey.decode(container.privateKeys, options);
|
|
223
|
+
if (key.publicKey.length !== 32 || key.privateKey.length !== 64) {
|
|
224
|
+
throw new KeyParseError("Ed25519 private key was an unexpected length");
|
|
225
|
+
}
|
|
226
|
+
const publicKey = new PublicKey(container.publicKeys[0], key.comment);
|
|
227
|
+
if (!equalBytes(P.struct({ type: SSHText, key: SSHBytes }).encode({ type: start.type, key: key.publicKey }), publicKey.blob)) {
|
|
228
|
+
throw new KeyParseError("private key did not match its public key");
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
type: "ed25519",
|
|
232
|
+
publicKey,
|
|
233
|
+
jwk: {
|
|
234
|
+
kty: "OKP",
|
|
235
|
+
crv: "Ed25519",
|
|
236
|
+
d: base64urlnopad.encode(key.privateKey.subarray(0, 32)),
|
|
237
|
+
x: base64urlnopad.encode(key.publicKey),
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (start.type.startsWith("ecdsa-sha2-")) {
|
|
242
|
+
const key = EcdsaPrivateKey.decode(container.privateKeys, options);
|
|
243
|
+
const curve = EcdsaCurves[key.curve];
|
|
244
|
+
if (curve === undefined || start.type !== `ecdsa-sha2-${key.curve}`) {
|
|
245
|
+
throw new UnsupportedKeyError(`ECDSA curve ${key.curve} is not supported`);
|
|
246
|
+
}
|
|
247
|
+
if (key.publicKey.length !== 1 + curve.size * 2 || key.publicKey[0] !== 0x04) {
|
|
248
|
+
throw new KeyParseError(`unexpected ECDSA public key encoding for ${key.curve}`);
|
|
249
|
+
}
|
|
250
|
+
const publicKey = new PublicKey(container.publicKeys[0], key.comment);
|
|
251
|
+
if (!equalBytes(P.struct({ type: SSHText, curve: SSHText, key: SSHBytes }).encode({ type: start.type, curve: key.curve, key: key.publicKey }), publicKey.blob)) {
|
|
252
|
+
throw new KeyParseError("private key did not match its public key");
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
type: "ecdsa",
|
|
256
|
+
curve: key.curve,
|
|
257
|
+
publicKey,
|
|
258
|
+
jwk: {
|
|
259
|
+
kty: "EC",
|
|
260
|
+
crv: curve.namedCurve,
|
|
261
|
+
// d is an mpint, so may be short or have a leading sign byte
|
|
262
|
+
d: base64urlnopad.encode(toFixedWidth(key.privateKey, curve.size)),
|
|
263
|
+
x: base64urlnopad.encode(key.publicKey.subarray(1, 1 + curve.size)),
|
|
264
|
+
y: base64urlnopad.encode(key.publicKey.subarray(1 + curve.size)),
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
if (err instanceof KeyParseError || err instanceof UnsupportedKeyError) {
|
|
271
|
+
throw err;
|
|
272
|
+
}
|
|
273
|
+
throw new KeyParseError("private key could not be decoded", err);
|
|
274
|
+
}
|
|
275
|
+
throw new UnsupportedKeyError(`CA key type ${keyTypeName(start.type)} is not supported, the CA key must be Ed25519 or ECDSA`);
|
|
276
|
+
};
|
|
277
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/ssh/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAElE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACvC,YAAY,OAAe,EAAE,KAAe;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAElB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;IACrD,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;QAEjC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAA;IAC3D,CAAC;CACD;AAED,MAAM,UAAU,GAAG,CAAC,CAAa,EAAE,CAAa,EAAW,EAAE;IAC5D,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAA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,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;oBACnE,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;iBAChE;aACD,CAAA;QACF,CAAC;IACF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,YAAY,aAAa,IAAI,GAAG,YAAY,mBAAmB,EAAE,CAAC;YACxE,MAAM,GAAG,CAAA;QACV,CAAC;QACD,MAAM,IAAI,aAAa,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,IAAI,mBAAmB,CAAC,eAAe,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;AAC9H,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PrivateKey, PublicKey } from "./keys.js";
|
|
2
|
+
/**
|
|
3
|
+
* Signs data with a CA key using WebCrypto, returning signatures in the SSH
|
|
4
|
+
* wire format
|
|
5
|
+
*/
|
|
6
|
+
export interface Signer {
|
|
7
|
+
/** The wire encoding of the public key of the signer */
|
|
8
|
+
readonly publicKey: Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* Signs data
|
|
11
|
+
*
|
|
12
|
+
* @param data The data to sign
|
|
13
|
+
* @returns The signature in the SSH wire format (RFC 4253 section 6.6)
|
|
14
|
+
*/
|
|
15
|
+
sign(data: Uint8Array<ArrayBuffer>): Promise<Uint8Array>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a {@link Signer} for an Ed25519 or ECDSA (P-256, P-384 or P-521)
|
|
19
|
+
* private key
|
|
20
|
+
*
|
|
21
|
+
* @param key The private key to sign with
|
|
22
|
+
* @returns The signer
|
|
23
|
+
*/
|
|
24
|
+
export declare const createSigner: (key: PrivateKey) => Promise<Signer>;
|
|
25
|
+
/**
|
|
26
|
+
* Verifies a signature in the SSH wire format made with an Ed25519 or ECDSA
|
|
27
|
+
* key
|
|
28
|
+
*
|
|
29
|
+
* @param publicKey The key the signature must have been made with
|
|
30
|
+
* @param signature The signature in the SSH wire format
|
|
31
|
+
* @param data The data that was signed
|
|
32
|
+
* @returns true if the signature is valid, false if it is not or the key type is not supported
|
|
33
|
+
*/
|
|
34
|
+
export declare const verify: (publicKey: PublicKey, signature: Uint8Array, data: Uint8Array<ArrayBuffer>) => Promise<boolean>;
|
|
35
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/ssh/signer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAElE;;;GAGG;AACH,MAAM,WAAW,MAAM;IACtB,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CACxD;AAuBD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,QAAe,UAAU,KAAG,OAAO,CAAC,MAAM,CAmClE,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,cAAqB,SAAS,aAAa,UAAU,QAAQ,UAAU,CAAC,WAAW,CAAC,KAAG,OAAO,CAAC,OAAO,CAiCxH,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as P from "micro-packed";
|
|
2
|
+
import { toFixedWidth } from "../sshsig/sig_parser.js";
|
|
3
|
+
import { decodePublicKey, SSHBytes, SSHText, SSHUnsignedMpint } from "./encoding.js";
|
|
4
|
+
/** An Ed25519 signature: string algorithm, string signature */
|
|
5
|
+
const Ed25519Signature = P.struct({
|
|
6
|
+
algorithm: SSHText,
|
|
7
|
+
signature: SSHBytes,
|
|
8
|
+
});
|
|
9
|
+
/** An ECDSA signature: string algorithm, string (mpint r, mpint s) */
|
|
10
|
+
const EcdsaSignature = P.struct({
|
|
11
|
+
algorithm: SSHText,
|
|
12
|
+
signature: P.prefix(P.U32BE, P.struct({
|
|
13
|
+
r: SSHUnsignedMpint,
|
|
14
|
+
s: SSHUnsignedMpint,
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
17
|
+
const EcdsaCurves = {
|
|
18
|
+
nistp256: { namedCurve: "P-256", hash: "SHA-256", size: 32 },
|
|
19
|
+
nistp384: { namedCurve: "P-384", hash: "SHA-384", size: 48 },
|
|
20
|
+
nistp521: { namedCurve: "P-521", hash: "SHA-512", size: 66 },
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Creates a {@link Signer} for an Ed25519 or ECDSA (P-256, P-384 or P-521)
|
|
24
|
+
* private key
|
|
25
|
+
*
|
|
26
|
+
* @param key The private key to sign with
|
|
27
|
+
* @returns The signer
|
|
28
|
+
*/
|
|
29
|
+
export const createSigner = async (key) => {
|
|
30
|
+
const publicKey = key.publicKey.blob;
|
|
31
|
+
if (key.type === "ed25519") {
|
|
32
|
+
const cryptoKey = await crypto.subtle.importKey("jwk", key.jwk, { name: "Ed25519" }, false, ["sign"]);
|
|
33
|
+
return {
|
|
34
|
+
publicKey,
|
|
35
|
+
sign: async (data) => Ed25519Signature.encode({
|
|
36
|
+
algorithm: "ssh-ed25519",
|
|
37
|
+
signature: new Uint8Array(await crypto.subtle.sign({ name: "Ed25519" }, cryptoKey, data)),
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const curve = EcdsaCurves[key.curve];
|
|
42
|
+
const cryptoKey = await crypto.subtle.importKey("jwk", key.jwk, { name: "ECDSA", namedCurve: curve.namedCurve }, false, ["sign"]);
|
|
43
|
+
return {
|
|
44
|
+
publicKey,
|
|
45
|
+
sign: async (data) => {
|
|
46
|
+
// WebCrypto returns r || s, each the size of the curve
|
|
47
|
+
const signature = new Uint8Array(await crypto.subtle.sign({ name: "ECDSA", hash: { name: curve.hash } }, cryptoKey, data));
|
|
48
|
+
return EcdsaSignature.encode({
|
|
49
|
+
// the algorithm is named for the curve of the key, never
|
|
50
|
+
// worked out from the signature
|
|
51
|
+
algorithm: `ecdsa-sha2-${key.curve}`,
|
|
52
|
+
signature: {
|
|
53
|
+
r: signature.subarray(0, curve.size),
|
|
54
|
+
s: signature.subarray(curve.size),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Verifies a signature in the SSH wire format made with an Ed25519 or ECDSA
|
|
62
|
+
* key
|
|
63
|
+
*
|
|
64
|
+
* @param publicKey The key the signature must have been made with
|
|
65
|
+
* @param signature The signature in the SSH wire format
|
|
66
|
+
* @param data The data that was signed
|
|
67
|
+
* @returns true if the signature is valid, false if it is not or the key type is not supported
|
|
68
|
+
*/
|
|
69
|
+
export const verify = async (publicKey, signature, data) => {
|
|
70
|
+
try {
|
|
71
|
+
const { type, fields } = decodePublicKey(publicKey.blob);
|
|
72
|
+
if (type === "ssh-ed25519") {
|
|
73
|
+
const { algorithm, signature: raw } = Ed25519Signature.decode(signature);
|
|
74
|
+
if (algorithm !== type) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const cryptoKey = await crypto.subtle.importKey("raw", new Uint8Array(fields[0]), { name: "Ed25519" }, false, ["verify"]);
|
|
78
|
+
return await crypto.subtle.verify({ name: "Ed25519" }, cryptoKey, new Uint8Array(raw), data);
|
|
79
|
+
}
|
|
80
|
+
const curveName = type.replace(/^ecdsa-sha2-/, "");
|
|
81
|
+
const curve = EcdsaCurves[curveName];
|
|
82
|
+
if (curve !== undefined && type === `ecdsa-sha2-${curveName}`) {
|
|
83
|
+
const { algorithm, signature: { r, s } } = EcdsaSignature.decode(signature);
|
|
84
|
+
if (algorithm !== type || r.length > curve.size || s.length > curve.size) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
// fields are the curve name and the public point
|
|
88
|
+
const cryptoKey = await crypto.subtle.importKey("raw", new Uint8Array(fields[1]), { name: "ECDSA", namedCurve: curve.namedCurve }, false, ["verify"]);
|
|
89
|
+
const raw = P.utils.concatBytes(toFixedWidth(r, curve.size), toFixedWidth(s, curve.size));
|
|
90
|
+
return await crypto.subtle.verify({ name: "ECDSA", hash: { name: curve.hash } }, cryptoKey, new Uint8Array(raw), data);
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// a signature or key that cannot be decoded or imported is not valid
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/ssh/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAmBpF,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,QAAQ;CACnB,CAAC,CAAA;AAEF,sEAAsE;AACtE,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACrC,CAAC,EAAE,gBAAgB;QACnB,CAAC,EAAE,gBAAgB;KACnB,CAAC,CAAC;CACH,CAAC,CAAA;AAEF,MAAM,WAAW,GAAqF;IACrG,QAAQ,E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AEzF,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;QACvH,CAAC;QAED,OAAO,KAAK,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACR,qEAAqE;QACrE,OAAO,KAAK,CAAA;IACb,CAAC;AACF,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -14,11 +14,6 @@ export type CertificateRequestJWTPayload = {
|
|
|
14
14
|
sub: string;
|
|
15
15
|
[key: string]: string | string[];
|
|
16
16
|
} & JWTPayload;
|
|
17
|
-
export type SSHExtension = {
|
|
18
|
-
critical: boolean;
|
|
19
|
-
name: string;
|
|
20
|
-
data: Buffer<ArrayBuffer>;
|
|
21
|
-
};
|
|
22
17
|
/**
|
|
23
18
|
* The result of executing a statement via {@link CaPreparedStatement.run} or
|
|
24
19
|
* {@link CaDatabase.batch}, modelled on a Cloudflare D1 result.
|
|
@@ -83,28 +78,78 @@ export interface CaSecret {
|
|
|
83
78
|
get(): Promise<string>;
|
|
84
79
|
}
|
|
85
80
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
81
|
+
* A rate limiter, with the same shape as a Cloudflare Workers rate limit
|
|
82
|
+
* binding.
|
|
83
|
+
*
|
|
84
|
+
* A Workers `RateLimit` binding satisfies this structurally. On other
|
|
85
|
+
* runtimes any limiter with the same shape may be used.
|
|
86
|
+
*/
|
|
87
|
+
export interface CaRateLimiter {
|
|
88
|
+
/**
|
|
89
|
+
* Counts a request against the limit for a key
|
|
90
|
+
*
|
|
91
|
+
* @param options The key the request is counted against, for example the client IP address
|
|
92
|
+
* @returns Whether the request is within the limit
|
|
93
|
+
*/
|
|
94
|
+
limit(options: {
|
|
95
|
+
key: string;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A key-value cache, with the subset of a Cloudflare Workers KV namespace
|
|
102
|
+
* binding used by the CA.
|
|
103
|
+
*
|
|
104
|
+
* A Workers `KVNamespace` binding satisfies this structurally. On other
|
|
105
|
+
* runtimes any cache with the same shape may be used, such as the in-memory
|
|
106
|
+
* cache returned by `cacheInMemory` from `@andrewheberle/serverless-ssh-ca/node`.
|
|
107
|
+
*/
|
|
108
|
+
export interface CaCache {
|
|
109
|
+
/** Returns the value for a key, or null if there is none */
|
|
110
|
+
get(key: string): Promise<string | null>;
|
|
111
|
+
/** Sets the value for a key, which may expire after `expirationTtl` seconds */
|
|
112
|
+
put(key: string, value: string, options?: {
|
|
113
|
+
expirationTtl?: number;
|
|
114
|
+
}): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The bindings (environment) the CA expects, see {@link CaDatabase},
|
|
118
|
+
* {@link CaSecret}, {@link CaRateLimiter} and {@link CaCache} for the non-string
|
|
119
|
+
* bindings.
|
|
88
120
|
*/
|
|
89
121
|
export interface SshCaBindings {
|
|
90
|
-
|
|
122
|
+
CERTIFICATE_REQUEST_TIME_SKEW_MAX: string;
|
|
123
|
+
JWT_ALGORITHMS: string | string[];
|
|
124
|
+
/** The audience the identity token, and unless {@link SshCaBindings.JWT_ACCESS_TOKEN_AUD} is set the access token, must be issued for */
|
|
125
|
+
JWT_AUD: string | string[];
|
|
126
|
+
/** The audience the access token must be issued for, when it differs from {@link SshCaBindings.JWT_AUD} */
|
|
127
|
+
JWT_ACCESS_TOKEN_AUD?: string | string[];
|
|
128
|
+
JWT_ISSUER: string;
|
|
129
|
+
JWT_JWKS_URL: string;
|
|
130
|
+
JWT_SSH_CERTIFICATE_PRINCIPALS_CLAIM: string;
|
|
131
|
+
LOG_LEVEL?: string;
|
|
91
132
|
DB_CERTIFICATE_RETENTION: string;
|
|
133
|
+
DB: CaDatabase;
|
|
134
|
+
ISSUER_DN: string;
|
|
92
135
|
PRIVATE_KEY: CaSecret;
|
|
136
|
+
/**
|
|
137
|
+
* Limits requests to issue, renew and revoke certificates, see
|
|
138
|
+
* {@link CaRateLimiter}. Requests are not limited when this is not set.
|
|
139
|
+
*/
|
|
140
|
+
RATE_LIMITER?: CaRateLimiter;
|
|
141
|
+
/**
|
|
142
|
+
* Caches KRLs until a certificate is revoked, see {@link CaCache}. KRLs
|
|
143
|
+
* are generated for every request when this is not set.
|
|
144
|
+
*/
|
|
145
|
+
CACHE?: CaCache;
|
|
93
146
|
SSH_CERTIFICATE_EXTENSIONS: string;
|
|
94
|
-
SSH_CERTIFICATE_LIFETIME: string;
|
|
95
|
-
SSH_CERTIFICATE_INCLUDE_SELF?: string | boolean;
|
|
96
147
|
SSH_CERTIFICATE_INCLUDE_SELF_EMAIL?: string | boolean;
|
|
148
|
+
SSH_CERTIFICATE_INCLUDE_SELF?: string | boolean;
|
|
149
|
+
SSH_CERTIFICATE_LIFETIME: string;
|
|
97
150
|
SSH_CERTIFICATE_PRINCIPALS?: string | string[];
|
|
98
|
-
SSH_HOST_CERTIFICATE_LIFETIME: string;
|
|
99
151
|
SSH_HOST_CERTIFICATE_ALLOWED_EMAILS?: string | string[];
|
|
100
152
|
SSH_HOST_CERTIFICATE_ALLOWED_ROLES?: string | string[];
|
|
101
|
-
|
|
102
|
-
JWT_JWKS_URL: string;
|
|
103
|
-
JWT_AUD?: string | string[];
|
|
104
|
-
JWT_ISSUER: string;
|
|
105
|
-
JWT_ALGORITHMS: string | string[];
|
|
106
|
-
JWT_SSH_CERTIFICATE_PRINCIPALS_CLAIM: string;
|
|
107
|
-
CERTIFICATE_REQUEST_TIME_SKEW_MAX: string;
|
|
108
|
-
LOG_LEVEL?: string;
|
|
153
|
+
SSH_HOST_CERTIFICATE_LIFETIME: string;
|
|
109
154
|
}
|
|
110
155
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGjC,MAAM,MAAM,wBAAwB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACpC,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAGD,MAAM,MAAM,4BAA4B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;CACnC,GAAG,UAAU,CAAA;AAEd
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGjC,MAAM,MAAM,wBAAwB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACpC,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAGD,MAAM,MAAM,4BAA4B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;CACnC,GAAG,UAAU,CAAA;AAEd;;;GAGG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