[dm-crypt] piping password to cryptsetup

frodowiz frodowiz at gmail.com
Thu Sep 18 02:29:35 CEST 2014


i have been to so many forums to find a solution to this. all the 
variations are confusing me and none are working. 
i am trying to pipe a passphrase to cryptsetup using yad. 

 pass1=`yad --form --title="Enter container passphrase" --height=50 
--width=350 --field=Password:H`

then i strip out the pipe character present between yad variables

pass="${pass1//|}"

at this point the variable pass appears to be exactly what i want.

later on i invoke cryptsetup with the passphrase variable piped to it. 

echo "$pass" | cryptsetup --cipher aes-xts-plain --key-size 512 --hash 
sha512 --iter-time 5000 --use-random luksFormat "$container" -

after a moment, i see the device pop into the selection in my file 
manager then it dissapears. 

the funny thing is, i wrote a terminal only version using the same 
methods minus the yad things and it works fine(see attached)

terminal version requires 3 confirmations YES, passphrase, passphrase. 
do i need to reproduce these confirmations even with a minus sign at 
the end of the cryptsetup line?

if so, would echo "YES"$'\n'"$pass"$'\n'"$pass"'\n' do this? 

also, if i replace the echo "$pass" pipe with xterm -e cryptsetup.... 
it works fine. basically, i am not getting the password format piped 
correctly. ive seen 7 different variations on this pipe and nothing is 
working. its probably something with spaces but i am resorting to email 
to lower my bloodpressure. also avoiding forums to lower my heart rate 
:)

thanks to anyone reading this.
Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.saout.de/pipermail/dm-crypt/attachments/20140918/a9982de8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nextgen.sh
Type: application/x-shellscript
Size: 4771 bytes
Desc: not available
URL: <http://www.saout.de/pipermail/dm-crypt/attachments/20140918/a9982de8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lukscrypt.sh
Type: application/x-shellscript
Size: 2746 bytes
Desc: not available
URL: <http://www.saout.de/pipermail/dm-crypt/attachments/20140918/a9982de8/attachment-0001.bin>


More information about the dm-crypt mailing list