-
Notifications
You must be signed in to change notification settings - Fork 158
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
9dc0a0d
commit c4880c5
Showing
4 changed files
with
50 additions
and
2 deletions.
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 |
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
disk=/dev/disk/by-id/virtio-ignition.gpg | ||
conf=/usr/lib/ignition/user.ign | ||
pkey=/etc/ignition.asc | ||
|
||
cleanup() { | ||
rm -f "${pkey}" | ||
rm -rf "${tmpd}" | ||
} | ||
tmpd=$(mktemp -d) && trap cleanup EXIT | ||
|
||
if [ ! -e "${disk}" ]; then | ||
echo "Ignition config must be encrypted" | ||
exit 1 | ||
fi | ||
|
||
gpg --homedir "${tmpd}" --import "${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