In either cloud-init user-data runcmd, or in autoinstall late-commands, I need to essentially run this command as part of a Clevis + Tang initialization for a LUKS encrypted volume:
echo '<secret>' | clevis luks bind -d /dev/sda2 tang '{"url": "http://<ip-tangserver>" , "adv": "/tmp/adv.jws" }'
The problem is, I'm having a hard time determining if this is actually possible using either runcmd or late-commands, and if so, how I can do this in a YAML-compliant way, eg:
runcmd:
- echo 'some-luks-temp-passwd' | clevis luks bind -d /dev/vda3 tang '{"url": "http://192.168.122.150" , "adv": "/tmp/adv.jws" }'
Enclosing the entire string above doesn't seem to work either, yamllint still shows a syntax error:
runcmd:
- "echo 'some-luks-temp-passwd' | clevis luks bind -d /dev/vda3 tang '{"url": "http://192.168.122.150" , "adv": "/tmp/adv.jws" }'"
Thanks!
bash -c 'echo '\''<secret>'\'' | clevis luks bind -d /dev/sda2 tang '\''{"url": "http://<ip-tangserver>" , "adv": "/tmp/adv.jws" }'\'''
– lnee Feb 03 '22 at 00:40i=$(cat tmp)
next run thisset | grep "^i="
remove the "i=" part, and you're good – lnee Feb 03 '22 at 00:43syntax error: expected <block end>, but found ','
I'm going to keep on digging but thank you for the option to try!
– Kodiak Firesmith Feb 03 '22 at 12:33bash -c "$(xxd -r -p <<<"hexblob)"
replace "hexblob" with the output of thishexdump -v -e '/1 "%02X "' "REPLACEWITHFILETHAT HAS YOUR CODE" |sed -e 's/ //g'"
(note code was taken from https://github.com/lnee94/resh/blob/main/l/bintools) – lnee Feb 03 '22 at 13:38