-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s390x: secex: decrypt ignition config on firstboot
- Loading branch information
1 parent
77295d3
commit 0b634e3
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-secex-ignition-decrypt.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=CoreOS Secex Ignition Config Decryptor | ||
ConditionPathExists=/etc/initrd-release | ||
ConditionPathExists=/run/coreos/secure-execution | ||
DefaultDependencies=false | ||
|
||
OnFailure=emergency.target | ||
OnFailureJobMode=isolate | ||
|
||
# Run after virtio_blk and before Ignition | ||
After=coreos-gpt-setup.service | ||
Before=ignition-fetch-offline.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/sbin/coreos-secex-ignition-decrypt |
26 changes: 26 additions & 0 deletions
26
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-secex-ignition-decrypt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
disk=/dev/disk/by-id/virtio-ignition_crypted | ||
conf=/usr/lib/ignition/user.ign | ||
pkey=/usr/lib/coreos/ignition.asc | ||
tmpd= | ||
|
||
cleanup() { | ||
rm -f "${pkey}" | ||
if [[ -n "${tmpd}" ]]; then | ||
rm -rf "${tmpd}" | ||
fi | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
tmpd=$(mktemp -d) | ||
|
||
if [ ! -e "${disk}" ]; then | ||
echo "Ignition config must be encrypted" | ||
exit 1 | ||
fi | ||
|
||
gpg --homedir "${tmpd}" --import "${pkey}" && rm "${pkey}" | ||
gpg --homedir "${tmpd}" --skip-verify --output "${conf}" --decrypt "${disk}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters