diff --git a/@xen-orchestra/proxy/package.json b/@xen-orchestra/proxy/package.json index fd7471d45cf..1f024d8082c 100644 --- a/@xen-orchestra/proxy/package.json +++ b/@xen-orchestra/proxy/package.json @@ -61,7 +61,6 @@ "parse-pairs": "^1.0.0", "promise-toolbox": "^0.15.0", "pump": "^3.0.0", - "selfsigned": "^1.10.7", "source-map-support": "^0.5.16", "stoppable": "^1.0.6", "xdg-basedir": "^4.0.0", diff --git a/@xen-orchestra/proxy/src/_genSelfSignedCert.js b/@xen-orchestra/proxy/src/_genSelfSignedCert.js new file mode 100644 index 00000000000..7b4bf402bec --- /dev/null +++ b/@xen-orchestra/proxy/src/_genSelfSignedCert.js @@ -0,0 +1,25 @@ +import { execFile } from 'child_process' + +const openssl = (cmd, args, { input, ...opts } = {}) => + new Promise((resolve, reject) => { + const child = execFile('openssl', [cmd, ...args], opts, (error, stdout) => + error != null ? reject(error) : resolve(stdout) + ) + if (input !== undefined) { + child.stdin.end(input) + } + }) + +export async function genSelfSignedCert() { + const key = await openssl('genrsa', ['2048']) + return { + cert: await openssl( + 'req', + ['-batch', '-new', '-key', '-', '-x509', '-days', '360', '-nodes'], + { + input: key, + } + ), + key, + } +} diff --git a/yarn.lock b/yarn.lock index 8d04633b502..0c7735a87ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11629,11 +11629,6 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-forge@0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" - integrity sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ== - node-forge@^0.7.0: version "0.7.6" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.7.6.tgz#fdf3b418aee1f94f0ef642cd63486c77ca9724ac" @@ -14361,13 +14356,6 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" -selfsigned@^1.10.7: - version "1.10.7" - resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.7.tgz#da5819fd049d5574f28e88a9bcc6dbc6e6f3906b" - integrity sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA== - dependencies: - node-forge "0.9.0" - semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"