nixos-config/pkgs/incus-ui/ui-canonical-0003-Update-certificate-generation.patch

195 lines
8.3 KiB
Diff

From 767dff6c01f0c8195f4044beb3059533a814212a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 22 Nov 2023 23:03:33 +0000
Subject: [PATCH 3/8] Update certificate generation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
src/pages/login/BrowserImport.tsx | 18 +++++++++---------
src/pages/login/CertificateAdd.tsx | 4 ++--
src/pages/login/CertificateGenerate.tsx | 12 ++++++------
src/util/certificate.tsx | 4 ++--
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/pages/login/BrowserImport.tsx b/src/pages/login/BrowserImport.tsx
index cc9c87a..d8ff1a4 100644
--- a/src/pages/login/BrowserImport.tsx
+++ b/src/pages/login/BrowserImport.tsx
@@ -25,7 +25,7 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
<>
<li className="p-list__item">
This opens a certificate management dialog. Click <code>Import...</code>
- then <code>Next</code> and select the <code>lxd-ui.pfx</code> file you
+ then <code>Next</code> and select the <code>incus-ui.pfx</code> file you
just downloaded. Enter your password, or leave the field empty if you
have not set one. Click <code>Next</code>.
</li>
@@ -34,14 +34,14 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
<code>Next</code>, then click <code>Finish</code>.
</li>
<li className="p-list__item">
- Restart the browser and open LXD-UI. Select the LXD-UI certificate.
+ Restart the browser and open Incus-UI. Select the Incus-UI certificate.
</li>
</>
);
const downloadPfx = (
<li className="p-list__item u-clearfix">
- Download <code>lxd-ui.pfx</code>
+ Download <code>incus-ui.pfx</code>
{sendPfx && (
<div className="u-float-right--large">
<Button onClick={sendPfx}>Download pfx</Button>
@@ -82,12 +82,12 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
<code>Import</code>.
</li>
<li className="p-list__item">
- Select the <code>lxd-ui.pfx</code> file you just downloaded.
+ Select the <code>incus-ui.pfx</code> file you just downloaded.
Enter your password, or leave the field empty if you have not
set one.
</li>
<li className="p-list__item">
- Restart the browser and open LXD-UI. Select the LXD-UI
+ Restart the browser and open Incus-UI. Select the Incus-UI
certificate.
</li>
</ul>
@@ -108,11 +108,11 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
</li>
<li className="p-list__item">
Click the <code>Import</code> button and select the{" "}
- <code>lxd-ui.pfx</code> file you just downloaded. Enter your
+ <code>incus-ui.pfx</code> file you just downloaded. Enter your
password, or leave the field empty if you have not set one.
</li>
<li className="p-list__item">
- Restart the browser and open LXD-UI. Select the LXD-UI
+ Restart the browser and open Incus-UI. Select the Incus-UI
certificate.
</li>
</ul>
@@ -179,7 +179,7 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
keychain.
</li>
<li className="p-list__item">
- Drag the <code>lxd-ui.pfx</code> file onto the Keychain Access
+ Drag the <code>incus-ui.pfx</code> file onto the Keychain Access
app.
</li>
<li className="p-list__item">
@@ -187,7 +187,7 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
and password for an administrator user on this computer.
</li>
<li className="p-list__item">
- Restart the browser and open LXD-UI. Select the LXD-UI
+ Restart the browser and open Incus-UI. Select the Incus-UI
certificate.
</li>
</ul>
diff --git a/src/pages/login/CertificateAdd.tsx b/src/pages/login/CertificateAdd.tsx
index 0e86797..9d227e5 100644
--- a/src/pages/login/CertificateAdd.tsx
+++ b/src/pages/login/CertificateAdd.tsx
@@ -52,7 +52,7 @@ const CertificateAdd: FC = () => {
<p>Generate a token on the command line</p>
<div className="p-code-snippet">
<pre className="p-code-snippet__block--icon">
- <code>lxc config trust add --name lxd-ui</code>
+ <code>incus config trust add incus-ui</code>
</pre>
</div>
</div>
@@ -78,7 +78,7 @@ const CertificateAdd: FC = () => {
</Col>
<Col size={6}>
<div className="p-stepped-list__content">
- <p>Enjoy LXD UI.</p>
+ <p>Enjoy Incus UI.</p>
</div>
</Col>
</Row>
diff --git a/src/pages/login/CertificateGenerate.tsx b/src/pages/login/CertificateGenerate.tsx
index 2ea99de..39dce9f 100644
--- a/src/pages/login/CertificateGenerate.tsx
+++ b/src/pages/login/CertificateGenerate.tsx
@@ -82,7 +82,7 @@ const CertificateGenerate: FC = () => {
mainClassName="certificate-generate"
header={
<div className="p-panel__header is-sticky">
- <h1 className="p-panel__title">Setup LXD UI</h1>
+ <h1 className="p-panel__title">Setup Incus UI</h1>
</div>
}
>
@@ -137,12 +137,12 @@ const CertificateGenerate: FC = () => {
<Col size={6}>
<div className="p-stepped-list__content">
<p>
- Download <code>lxd-ui.crt</code> and add it to the LXD
+ Download <code>incus-ui.crt</code> and add it to the Incus
trust store
</p>
<div className="p-code-snippet">
<pre className="p-code-snippet__block--icon">
- <code>lxc config trust add Downloads/lxd-ui.crt</code>
+ <code>incus config trust add-certificate Downloads/incus-ui.crt</code>
</pre>
</div>
</div>
@@ -152,7 +152,7 @@ const CertificateGenerate: FC = () => {
<Button
onClick={() =>
downloadText(
- `lxd-ui-${location.hostname}.crt`,
+ `incus-ui.crt`,
certs.crt,
)
}
@@ -174,7 +174,7 @@ const CertificateGenerate: FC = () => {
certs
? () =>
downloadBase64(
- `lxd-ui-${location.hostname}.pfx`,
+ `incus-ui.pfx`,
certs.pfx,
)
: undefined
@@ -190,7 +190,7 @@ const CertificateGenerate: FC = () => {
</Col>
<Col size={6}>
<div className="p-stepped-list__content">
- <p>Enjoy LXD UI.</p>
+ <p>Enjoy Incus UI.</p>
</div>
</Col>
</Row>
diff --git a/src/util/certificate.tsx b/src/util/certificate.tsx
index b409147..a802f5d 100644
--- a/src/util/certificate.tsx
+++ b/src/util/certificate.tsx
@@ -26,7 +26,7 @@ const details = [
},
{
name: "organizationName",
- value: `LXD UI ${location.hostname} (Browser Generated)`,
+ value: `Incus UI ${location.hostname} (Browser Generated)`,
},
];
@@ -51,7 +51,7 @@ const generateCert = (password: string) => {
const asn1 = forge.pkcs12.toPkcs12Asn1(keys.privateKey, [cert], password, {
algorithm: "3des", // would like to use aes, but macOS keychain only supports 3des
generateLocalKeyId: true,
- friendlyName: "LXD-UI",
+ friendlyName: "Incus-UI",
});
const der = forge.asn1.toDer(asn1).getBytes();
const pfx = forge.util.encode64(der);
--
2.34.1