Skip to content

Commit 0aaff9a

Browse files
committed
sdk_entry: use persistent module signing keys for unofficial builds
For official builds (COREOS_OFFICIAL=1), continue using ephemeral temporary directories for module signing keys. For unofficial/development builds, use a persistent directory at /mnt/host/source/.module-signing-keys to preserve keys across container restarts. Signed-off-by: Daniel Zatovic <daniel.zatovic@gmail.com>
1 parent 27638a2 commit 0aaff9a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ setup_keys() {
169169

170170
echo "Preparing keys at $sig_key"
171171

172+
if [[ ${COREOS_OFFICIAL:-0} -eq 0 ]]; then
173+
# Allow portage sandbox to write to the module signing key directory,
174+
# which is in home for unofficial builds
175+
addwrite "${MODULE_SIGNING_KEY_DIR}"
176+
fi
177+
172178
mkdir -p $MODULE_SIGNING_KEY_DIR
173179
pushd $MODULE_SIGNING_KEY_DIR
174180

sdk_lib/sdk_entry.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ fi
6767

6868
# Create key directory if not already configured in .bashrc
6969
if ! grep -q 'export MODULE_SIGNING_KEY_DIR' /home/sdk/.bashrc; then
70-
MODULE_SIGNING_KEY_DIR=$(su sdk -c "mktemp -d")
70+
# For official builds, use ephemeral keys. For unofficial builds, use persistent directory
71+
if [[ ${COREOS_OFFICIAL:-0} -eq 1 ]]; then
72+
MODULE_SIGNING_KEY_DIR=$(su sdk -c "mktemp -d")
73+
else
74+
MODULE_SIGNING_KEY_DIR="/home/sdk/.module-signing-keys"
75+
su sdk -c "mkdir -p '$MODULE_SIGNING_KEY_DIR'"
76+
fi
7177
if [[ ! "$MODULE_SIGNING_KEY_DIR" || ! -d "$MODULE_SIGNING_KEY_DIR" ]]; then
7278
echo "Failed to create directory for module signing keys."
7379
else

0 commit comments

Comments
 (0)