Skip to content
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

improve robustness of the initrd sdk #884

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

Rozzii
Copy link
Member

@Rozzii Rozzii commented Oct 28, 2024

This commit:

  • Implements LUKS and TPM2 tool chain checks and enforcement in order to
    avoid issues originating from uninitialized hardware and driver modules.

  • Improves the "testability" of the code

  • Changes the configuration workflow of the unlock-mount-luks.sh to
    rely on a config file instead of positional cmdline arguments in order
    to make configuration more explicit and easier to debug.

  • Ads script used for tpm2.0 persistent secret unsealing

  • Ads a config file with value presets intended for testing

  • Implements support for disks where only the root partition need decryption
    by the unlock-mount-luks.sh

  • Implements auto discovery for root partition based on GPT partition label

  • Implements auto discovery for config drive partition based on GPT partition
    label

  • Implement support for environments where only the config-drive is
    encrypted

  • Reorganizes and updates comments

  • Fixes evaluation bug of the "key_command"

  • the key script is now executed once after the preparation stage and the
    LUKS key file is stored in memory until the root switching happens

  • LUKS key file is accessible via a persistent file descriptor instead of an
    ephemeral file descriptor for stability reasons

  • Typo fixes

  • Exclude .swp files via .gitignore

  • Fix incorrect config drive partition name generation in relation to disks
    types that doesn't use partition prefixes

  • Introduce config option to skip the preparation "phase" intended for testing

  • Add support for use-case where encryption is not present and the tool chain
    is also missing

  • The verify script will mount /sys,/dev,/proc and /run FS before unblocking
    the root switching in order to make the switching more controlled

  • Implements a configurable timeout mechanism for the verify script

  • unseal-and-open-luks service have been moved closer to the root switching in the systemd unit "boot" order in order to minimize the possibility of conflicts with other mounts,device operations and services

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2024
@Rozzii Rozzii force-pushed the improve_initrd_sdk_robustness branch from 3094a0d to 3f0be83 Compare October 28, 2024 06:55
Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitting.

jenkins/image_building/initrd_sdk/tpm2-unseal-key.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/tpm2-unseal-key.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/tpm2-unseal-key.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/unlock-mount-luks.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/unlock-mount-luks.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/unlock-mount-luks.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/unlock-mount-luks.sh Outdated Show resolved Hide resolved
jenkins/image_building/initrd_sdk/unlock-mount-luks.sh Outdated Show resolved Hide resolved
@Rozzii Rozzii force-pushed the improve_initrd_sdk_robustness branch 3 times, most recently from 14e8ec7 to ece938f Compare October 28, 2024 11:41
@Rozzii Rozzii requested a review from tuminoid October 28, 2024 11:42
@Rozzii
Copy link
Member Author

Rozzii commented Oct 28, 2024

/override metal3-ubuntu-e2e-integration-test-main

This test is not relevant.

@metal3-io-bot
Copy link
Collaborator

@Rozzii: Overrode contexts on behalf of Rozzii: metal3-ubuntu-e2e-integration-test-main

In response to this:

/override metal3-ubuntu-e2e-integration-test-main

This test is not relevant.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@metal3-io-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tuminoid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 28, 2024
@@ -0,0 +1,20 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have executable in this file, no need to add a shebang if you're just sourcing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have executable in this file, no need to add a shebang if you're just sourcing it

It is not harmful to have it, and it makes $EDITOR's life easier as it also doesn't have extension to detect the source type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to have it for the reasons mentioned by @tuminoid .

jenkins/image_building/initrd_sdk/unlock-mount-luks.sh Outdated Show resolved Hide resolved
@Rozzii Rozzii force-pushed the improve_initrd_sdk_robustness branch from ece938f to 3c1e175 Compare October 31, 2024 07:37
@Rozzii
Copy link
Member Author

Rozzii commented Oct 31, 2024

/override metal3-ubuntu-e2e-integration-test-main

This test is not relevant.

@metal3-io-bot
Copy link
Collaborator

@Rozzii: Overrode contexts on behalf of Rozzii: metal3-ubuntu-e2e-integration-test-main

In response to this:

/override metal3-ubuntu-e2e-integration-test-main

This test is not relevant.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Rozzii Rozzii force-pushed the improve_initrd_sdk_robustness branch from 3c1e175 to a8c1956 Compare November 4, 2024 11:09
@metal3-io-bot metal3-io-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 4, 2024
This commit:

- Implements LUKS and TPM2 tool chain checks and enforcement in order to
avoid issues originating from uninitialized hardware and driver modules.

- Improves the "testability" of the code

- Changes the configuration workflow of the unlock-mount-luks.sh to
rely on a config file instead of positional cmdline arguments in order
to make configuration more explicit and easier to debug.

- Ads script used for tpm2.0 persistent secret unsealing

- Ads a config file with value presets intended for testing

- Implements support for disks where only the root partition need decryption
by the unlock-mount-luks.sh

- Implements auto discovery for root partition based on GPT partition label

- Implements auto discovery for config drive partition based on GPT partition
label

- Implement support for environments where only the config-drive is
encrypted

- Reorganizes and updates comments

- Fixes evaluation bug of the "key_command"

- the key script is now executed once after the preparation stage and the
LUKS key file is stored in memory until the root switching happens

- LUKS key file is accessible via a persistent file descriptor instead of an
ephemeral file descriptor for stability reasons

- Typo fixes

- Exclude .swp files via .gitignore

- Fix incorrect config drive partition name generation in relation to disks
types that doesn't use partition prefixes

- Introduce config option to skip the preparation "phase" intended for testing

- Add support for use-case where encryption is not present and the tool chain
is also missing

- The verify script will mount /sys,/dev,/proc and /run FS before unblocking
the root switching in order to make the switching more controlled

- Implements a configurable timeout mechanism for the verify script

- unseal-and-open-luks service have been moved closer to the root switching
in the systemd unit "boot" order in order to minimize the possibility of
conflicts with other mounts,device operations and services

Signed-off-by: Adam Rozman <adam.rozman@est.tech>
@Rozzii Rozzii force-pushed the improve_initrd_sdk_robustness branch from a8c1956 to ffa364b Compare November 5, 2024 06:36
@Rozzii Rozzii requested a review from elfosardo November 5, 2024 07:38
@Rozzii
Copy link
Member Author

Rozzii commented Nov 6, 2024

/override metal3-ubuntu-e2e-integration-test-main

@metal3-io-bot
Copy link
Collaborator

@Rozzii: Overrode contexts on behalf of Rozzii: metal3-ubuntu-e2e-integration-test-main

In response to this:

/override metal3-ubuntu-e2e-integration-test-main

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a bit over my head, but
/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 6, 2024
@metal3-io-bot metal3-io-bot merged commit d7d1864 into metal3-io:main Nov 6, 2024
7 checks passed
@metal3-io-bot metal3-io-bot deleted the improve_initrd_sdk_robustness branch November 6, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants