diff --git a/package-lock.json b/package-lock.json index f09da6c..5f13efb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "!win32" ], "dependencies": { + "@small-tech/syswide-cas": "^6.0.2", "bluebird": "^3.7.2", "core-js": "^3.12.1", "dompurify": "=3.0.1", @@ -2037,6 +2038,14 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/@small-tech/syswide-cas": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@small-tech/syswide-cas/-/syswide-cas-6.0.2.tgz", + "integrity": "sha512-G7BbARFvdSEUei6J4sKKrxNZz5xlsV2pV3hU5J+/yF7j7DLesuATBurPLe4pX3HAnVptmUFWykc36OoTv18tmw==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@types/bluebird": { "version": "3.5.42", "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.42.tgz", diff --git a/package.json b/package.json index 82be018..a5a8927 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "services/run-js-service", "services/startup.sh", "services/jumpstart.sh", - "services/elevate-service" + "services/elevate-service", + "services/isrg-roots-x1-x2.pem" ], "styles": [ "frontend/views/DetailsPanel.css" @@ -83,6 +84,7 @@ "webpack-shebang-plugin": "^1.1.8" }, "dependencies": { + "@small-tech/syswide-cas": "^6.0.2", "bluebird": "^3.7.2", "core-js": "^3.12.1", "dompurify": "=3.0.1", diff --git a/services/isrg-roots-x1-x2.pem b/services/isrg-roots-x1-x2.pem new file mode 100644 index 0000000..e93e63b --- /dev/null +++ b/services/isrg-roots-x1-x2.pem @@ -0,0 +1,62 @@ +# ISRG Root Certificates +# (used for Let's Encrypt) + +# Distributed under section 9.5 of the +# Internet Security Research Group (ISRG) +# Combined Certificate Policy and Certification Practice Statement +# version 5.1, 2023-05-16: +# "ISRG grants permission to reproduce and distribute certificates on a +# non-exclusive and royalty-free basis, provided that they are reproduced +# and distributed in full." +# https://letsencrypt.org/documents/isrg-cp-cps-v5.1/ + +# ISRG Root X1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mVzZWFyY2gg +R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 +MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT +ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw +EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW ++1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 +ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI +zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW +tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 +/q4AaOeMSQ+2b1tbFfLn +-----END CERTIFICATE----- diff --git a/services/service.ts b/services/service.ts index b83e30a..848e294 100644 --- a/services/service.ts +++ b/services/service.ts @@ -10,6 +10,8 @@ import child_process from 'child_process'; import { Promise } from 'bluebird'; // eslint-disable-line @typescript-eslint/no-redeclare import progress from 'progress-stream'; import Service, { Message } from 'webos-service'; +import syswideCas from '@small-tech/syswide-cas'; + import fetch from 'node-fetch'; import { asyncStat, @@ -401,6 +403,8 @@ function tryRespond>(runner: (message: Message) => } function runService(): void { + syswideCas.addCAs([path.join(__dirname, 'isrg-roots-x1-x2.pem'), '/etc/ssl/certs']); + const service = new Service(serviceInfo.id, undefined, { idleTimer: 30 }); const serviceRemote = new ServiceRemote(); diff --git a/services/syswide-cas.d.ts b/services/syswide-cas.d.ts new file mode 100644 index 0000000..56a8bc3 --- /dev/null +++ b/services/syswide-cas.d.ts @@ -0,0 +1,3 @@ +declare module '@small-tech/syswide-cas' { + function addCAs(dirs: readonly string[]): void; +}