From 84f9c2febcfaba04f84f22b862498f4f7fcbc494 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 27 Jan 2021 12:16:57 -0500 Subject: [PATCH 1/3] chore: Add env var based signing check for desktop client --- .../electron-app/config/forge.config.js | 38 +++++++++++++++++++ ui/desktop/electron-app/package.json | 29 +------------- 2 files changed, 39 insertions(+), 28 deletions(-) create mode 100644 ui/desktop/electron-app/config/forge.config.js diff --git a/ui/desktop/electron-app/config/forge.config.js b/ui/desktop/electron-app/config/forge.config.js new file mode 100644 index 000000000..2690c6028 --- /dev/null +++ b/ui/desktop/electron-app/config/forge.config.js @@ -0,0 +1,38 @@ +const process = require('process'); + +module.exports = { + hooks: { + prePackage: (forgeConfig) => { + if (process.env.BOUNDARY_DESKTOP_SIGNING_IDENTITY) { + forgeConfig.osxSign = { + identity: process.env.BOUNDARY_DESKTOP_SIGNING_IDENTITY, + hardenedRuntime: true, + "gatekeeper-assess": false, + entitlements: "config/macos/entitlements.plist", + "entitlements-inherit": "config/macos/entitlements.plist", + "signature-flags": "library" + } + } else { + console.warn('Could not find signing identity. Skipping signing.'); + } + } + }, + packagerConfig: { + ignore: [ + "/ember-test(/|$)", + "/tests(/|$)" + ], + name: "Boundary Desktop", + appBundleId: "com.electron.boundary", + appVersion: "0.0.1", + appCopyright: "Copyright © 2021 HashiCorp, Inc." + }, + makers: [ + { + name: "@electron-forge/maker-dmg", + config: { + name: "Boundary Desktop" + } + } + ] +} diff --git a/ui/desktop/electron-app/package.json b/ui/desktop/electron-app/package.json index 66fd2a81a..be09b0414 100644 --- a/ui/desktop/electron-app/package.json +++ b/ui/desktop/electron-app/package.json @@ -16,34 +16,7 @@ }, "keywords": [], "config": { - "forge": { - "packagerConfig": { - "ignore": [ - "/ember-test(/|$)", - "/tests(/|$)" - ], - "name": "Boundary Desktop", - "appBundleId": "com.electron.boundary", - "appVersion": "0.0.1", - "appCopyright": "Copyright © 2021 HashiCorp, Inc.", - "osxSign": { - "identity": "Developer ID Application: Hashicorp, Inc. (D38WU7D763)", - "hardenedRuntime": true, - "gatekeeper-assess": false, - "entitlements": "config/macos/entitlements.plist", - "entitlements-inherit": "config/macos/entitlements.plist", - "signature-flags": "library" - } - }, - "makers": [ - { - "name": "@electron-forge/maker-dmg", - "config": { - "name": "Boundary Desktop" - } - } - ] - } + "forge": "config/forge.config.js" }, "dependencies": { "axios": "^0.21.1", From a83e6dba26163829954b2587dc5e1117dea94296 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 27 Jan 2021 12:21:43 -0500 Subject: [PATCH 2/3] chore: Add signing check to make instead of package --- ui/desktop/electron-app/config/forge.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/desktop/electron-app/config/forge.config.js b/ui/desktop/electron-app/config/forge.config.js index 2690c6028..23d9ba10a 100644 --- a/ui/desktop/electron-app/config/forge.config.js +++ b/ui/desktop/electron-app/config/forge.config.js @@ -2,7 +2,7 @@ const process = require('process'); module.exports = { hooks: { - prePackage: (forgeConfig) => { + preMake: (forgeConfig) => { if (process.env.BOUNDARY_DESKTOP_SIGNING_IDENTITY) { forgeConfig.osxSign = { identity: process.env.BOUNDARY_DESKTOP_SIGNING_IDENTITY, From c86c5eaecc57a01b6312a343f95b696f85c38f08 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Fri, 29 Jan 2021 16:23:56 -0500 Subject: [PATCH 3/3] docs: Add BOUNDARY_DESKTOP_SIGNING_IDENTITY info to readme --- README.md | 3 +++ ui/desktop/README.md | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 732c7491f..af9ca0b99 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,9 @@ yarn install yarn build:ui:desktop ``` +To provide a signing identify for macOS build, use `BOUNDARY_DESKTOP_SIGNING_IDENTITY` +environment variable to set signing certificate name (e.g Developer ID Application: * (*)). + Assets are saved to `ui/desktop/electron-app/out/make/`. DMG packaged desktop UI is available at asset location as `Boundary Desktop.dmg`. diff --git a/ui/desktop/README.md b/ui/desktop/README.md index 45415803a..bd8215112 100644 --- a/ui/desktop/README.md +++ b/ui/desktop/README.md @@ -66,15 +66,17 @@ To run as a desktop app: Before executing a build, be sure to set any environment variables necessary for your target [environment](#environment-variables). To build this UI for -production, run the following commads from this folder: +production, run the following commands from this folder: ```bash yarn install yarn build ``` -The static production assets are saved into the `dist/` folder. +`BOUNDARY_DESKTOP_SIGNING_IDENTITY` environment variable must be provided +to codesign in production. +The static production assets are saved into the `dist/` folder. #### Environment Variables @@ -83,7 +85,7 @@ These environment variables may be used to customized the build. | Variable | Default Value | Description | | -------- | ------------- | ----------- | | `APP_NAME` | Application Name | The user-facing name of the application, appearing in titles, etc. | -| `API_HOST` | | The host of the API, if different than UI (e.g. https://example.net:1234). | +| `BOUNDARY_DESKTOP_SIGNING_IDENTITY` | | The name of the certificate to use when signing (e.g. Developer ID Application: * (*)). | ### Running Tests