Skip to content

Conversation

@hkumarmk
Copy link
Collaborator

@hkumarmk hkumarmk commented Nov 24, 2025

Add LUKS recovery key to vault
* Add LUKS recovery key to vault as part of mangoctl bootstrap or enroll
for LUKS volumes in each node
* added validation steps in self_test.sh
* Added additional recovery_test.sh to run as part of integration test
within run_tests.sh

@hkumarmk hkumarmk force-pushed the t1 branch 2 times, most recently from 1448093 to 1ccdc7a Compare November 26, 2025 13:50
@hkumarmk hkumarmk changed the title just for testing Add LUKS recovery key to vault Nov 26, 2025
@hkumarmk hkumarmk force-pushed the t1 branch 22 times, most recently from 105cc96 to adfde15 Compare December 2, 2025 19:53
recovery_test.sh Outdated
tr -d ':')

echo "Removing TPM keyslot ${tpm_slot} (simulating TPM failure)..."
echo -n "$recovery_key" | cryptsetup luksKillSlot /dev/$test_device "$tpm_slot" --key-file=-
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is functionally equivalent to systemd-cryptenroll --wipe-slot=tpm2.

recovery_test.sh Outdated

# THE CRITICAL TEST: Unlock with recovery key
echo "Unlocking with recovery key..."
echo -n "$recovery_key" | cryptsetup open /dev/$test_device $mapper_name --key-file=-
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is equivalent to systemd-cryptsetup attach $mapper_name $test_device $keyfile. I'm not entirely sure if it'll let you pass it on stdin like you did.

# Use TPM to unlock the device, then enroll a new recovery key
local output=$(systemd-cryptenroll "${device}" --recovery-key --unlock-tpm2-device=auto 2>&1)

# Extract recovery key - format: lowercase hex groups separated by dashes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not hex. At least your example isn't :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah , will fix it - its just small case 8 letter words separated by -

success=0

# Temporarily disable exit-on-error for polling loop
set +e
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems heavy handed. I assume it's for the alloc_status=$(...) call? Can you just put || true after it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just did this see whats next when it fail, will remove it when build is passing

run_tests.sh Outdated
#!/bin/bash

set -e
set -x
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to not have this on by default. Successful test runs should look clean.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did this for debugging whats happening when build fail. will remove once build is passed

@sorenisanerd
Copy link
Collaborator

Sorry about the wait. My dev branch was waaay out of date with main, and my local working tree had a lot of changes, too. It's all pretty well aligned now and the tests should be passing. If you can rebase on top of main now, we should be in good shape 🤞🏻

@hkumarmk hkumarmk reopened this Jan 2, 2026
@hkumarmk hkumarmk force-pushed the t1 branch 11 times, most recently from cd36524 to 67d165a Compare January 2, 2026 15:59
* docker-ce 5:29.1.3-1~ubuntu.24.04~noble has broken dependency to
  newer containerd.io which is NOT there in the repo till yet.
  That fail the build so hardcoded the version for now to get the
  build working
* Removed containerd.io from packages list from docker profile as
  docker-ce anyway install appropriate version of  containerd as
  dependency
@hkumarmk hkumarmk force-pushed the t1 branch 3 times, most recently from bbc0f6d to d52020e Compare January 2, 2026 17:47
* Add LUKS recovery key to vault as part of mangoctl bootstrap or enroll
  for LUKS volumes in each node
* added validation steps in self_test.sh
* Added additional recovery_test.sh to run as part of integration test
  within run_tests.sh
* add machine id entity metadata for a node in the vault
* Add policy so node token can write (not update or read) recovery key
  in vault kv
@hkumarmk
Copy link
Collaborator Author

hkumarmk commented Jan 3, 2026

@sorenisanerd can you pls review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants