-
Notifications
You must be signed in to change notification settings - Fork 154
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
b77bfa9
commit ecda6ec
Showing
4 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...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,18 @@ | ||
[Unit] | ||
Description=CoreOS Secex Ignition Config Decryptor | ||
ConditionPathExists=/etc/initrd-release | ||
ConditionPathExists=/run/coreos/secure-execution | ||
ConditionPathExists=/dev/disk/by-id/virtio-ignition_crypted | ||
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 |
19 changes: 19 additions & 0 deletions
19
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,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
disk=/dev/disk/by-id/virtio-ignition_crypted | ||
conf=/usr/lib/ignition/user.ign | ||
pkey=/tmp/ignition.asc | ||
tmpd= | ||
|
||
cleanup() { | ||
rm -f "${pkey}" | ||
if [[ -n "${tmpd}" ]]; then | ||
rm -rf "${tmpd}" | ||
fi | ||
} | ||
|
||
tmpd=$(mktemp -d) && trap cleanup EXIT | ||
|
||
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