-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make TPM-based encryption more explicit #995
Changes from all commits
1229d95
49c9806
a884db0
d5a6fcf
58bfe78
77e8339
25260c6
c4819a1
432b5b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) [2022-2023] SUSE LLC | ||
* Copyright (c) [2022-2024] SUSE LLC | ||
* | ||
* All Rights Reserved. | ||
* | ||
|
@@ -46,6 +46,17 @@ const ZFCP_CONTROLLER_IFACE = "org.opensuse.Agama.Storage1.ZFCP.Controller"; | |
const ZFCP_DISKS_NAMESPACE = "/org/opensuse/Agama/Storage1/zfcp_disks"; | ||
const ZFCP_DISK_IFACE = "org.opensuse.Agama.Storage1.ZFCP.Disk"; | ||
|
||
/** | ||
* Enum for the encryption method values | ||
* | ||
* @readonly | ||
* @enum { string } | ||
*/ | ||
const EncryptionMethods = Object.freeze({ | ||
LUKS2: "luks2", | ||
TPM: "tpm_fde" | ||
}); | ||
|
||
Comment on lines
+49
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I wrote in the commit message, following here the same approac as the current network code. We could, however, goes for what we did with client/phase or client/status instead and move it to a client/storage-encryption-methods.js or client/storage/encryption-methods.js export const LUKS2 = "luks2";
export const TPM = "tpm_fde";
export default {
LUKS2,
TPM
}; and then import needed values import { TPM } from "~/client/storage/encryption-methods" import * as EncriptionMethods from "~/client/storage/encryption-methods" No strong/clear opinion. Something to think about for future enhancements. |
||
/** | ||
* Removes properties with undefined value | ||
* | ||
|
@@ -227,6 +238,7 @@ class ProposalManager { | |
* @typedef {object} ProposalSettings | ||
* @property {string} bootDevice | ||
* @property {string} encryptionPassword | ||
* @property {string} encryptionMethod | ||
* @property {boolean} lvm | ||
* @property {string} spacePolicy | ||
* @property {string[]} systemVGDevices | ||
|
@@ -283,6 +295,16 @@ class ProposalManager { | |
return proxy.ProductMountPoints; | ||
} | ||
|
||
/** | ||
* Gets the list of encryption methods accepted by the proposal | ||
* | ||
* @returns {Promise<string[]>} | ||
*/ | ||
async getEncryptionMethods() { | ||
const proxy = await this.proxies.proposalCalculator; | ||
return proxy.EncryptionMethods; | ||
} | ||
|
||
/** | ||
* Obtains the default volume for the given mount path | ||
* | ||
|
@@ -345,6 +367,7 @@ class ProposalManager { | |
spacePolicy: proxy.SpacePolicy, | ||
systemVGDevices: proxy.SystemVGDevices, | ||
encryptionPassword: proxy.EncryptionPassword, | ||
encryptionMethod: proxy.EncryptionMethod, | ||
volumes: proxy.Volumes.map(this.buildVolume), | ||
// NOTE: strictly speaking, installation devices does not belong to the settings. It | ||
// should be a separate method instead of an attribute in the settings object. | ||
|
@@ -365,7 +388,7 @@ class ProposalManager { | |
* @param {ProposalSettings} settings | ||
* @returns {Promise<number>} 0 on success, 1 on failure | ||
*/ | ||
async calculate({ bootDevice, encryptionPassword, lvm, spacePolicy, systemVGDevices, volumes }) { | ||
async calculate({ bootDevice, encryptionPassword, encryptionMethod, lvm, spacePolicy, systemVGDevices, volumes }) { | ||
const dbusVolume = (volume) => { | ||
return removeUndefinedCockpitProperties({ | ||
MountPath: { t: "s", v: volume.mountPath }, | ||
|
@@ -381,6 +404,7 @@ class ProposalManager { | |
const settings = removeUndefinedCockpitProperties({ | ||
BootDevice: { t: "s", v: bootDevice }, | ||
EncryptionPassword: { t: "s", v: encryptionPassword }, | ||
EncryptionMethod: { t: "s", v: encryptionMethod }, | ||
LVM: { t: "b", v: lvm }, | ||
SpacePolicy: { t: "s", v: spacePolicy }, | ||
SystemVGDevices: { t: "as", v: systemVGDevices }, | ||
|
@@ -1420,4 +1444,4 @@ class StorageClient extends WithIssues( | |
), STORAGE_OBJECT | ||
) { } | ||
|
||
export { StorageClient }; | ||
export { StorageClient, EncryptionMethods }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NP: this condition should be already covered by
#include?
.