All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] piping password to cryptsetup
@ 2014-09-18  0:29 frodowiz
  2014-09-18  7:29 ` ken
  2014-09-18 13:45 ` Konstantin Bläsi
  0 siblings, 2 replies; 4+ messages in thread
From: frodowiz @ 2014-09-18  0:29 UTC (permalink / raw)
  To: dm-crypt


[-- Attachment #1.1: Type: text/plain, Size: 1508 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 1844 bytes --]

[-- Attachment #2.1: nextgen.sh --]
[-- Type: application/x-shellscript, Size: 4771 bytes --]

[-- Attachment #2.2: lukscrypt.sh --]
[-- Type: application/x-shellscript, Size: 2746 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dm-crypt] piping password to cryptsetup
  2014-09-18  0:29 [dm-crypt] piping password to cryptsetup frodowiz
@ 2014-09-18  7:29 ` ken
  2014-09-18 13:45 ` Konstantin Bläsi
  1 sibling, 0 replies; 4+ messages in thread
From: ken @ 2014-09-18  7:29 UTC (permalink / raw)
  To: frodowiz, dm-crypt

I don't know anything about yad, but here's what worked for me some 
years ago:

echo -n "passphrase" \
| cryptsetup --key-file="-" luksOpen /dev/sda5 name1

Replace /dev/sda5 with whatever the relevant device name is.

Let us know if this works for you.  (Hope it does.)

ken


On 09/17/2014 08:29 PM frodowiz wrote:
> 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
>
>
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dm-crypt] piping password to cryptsetup
  2014-09-18  0:29 [dm-crypt] piping password to cryptsetup frodowiz
  2014-09-18  7:29 ` ken
@ 2014-09-18 13:45 ` Konstantin Bläsi
  2014-09-27  4:20   ` frodowiz
  1 sibling, 1 reply; 4+ messages in thread
From: Konstantin Bläsi @ 2014-09-18 13:45 UTC (permalink / raw)
  To: dm-crypt

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

On 09/18/2014 02:29 AM, frodowiz wrote:
> 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
>
>
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
Hi Erik,

you want to use "echo -n" for piping the password without a trailing
newline and "cryptsetup -q ..." in your scripts to avoid any additional
user input.

Konstantin

[-- Attachment #2: Type: text/html, Size: 3263 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dm-crypt] piping password to cryptsetup
  2014-09-18 13:45 ` Konstantin Bläsi
@ 2014-09-27  4:20   ` frodowiz
  0 siblings, 0 replies; 4+ messages in thread
From: frodowiz @ 2014-09-27  4:20 UTC (permalink / raw)
  To: dm-crypt

Konstantin Bläsi <ktrackfd@...> writes:


i just wanted to say thank you to  the replies. for some reason, possibly a
race condition?, the problem dissapeared after i wrote this original post.
seeing the replies helped me stick to the path i was on and voila!.  

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

works with "$container" and "$pass" defined earlier in a graphical dialog.

thanks again for all your work on this.
erik

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-27  4:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18  0:29 [dm-crypt] piping password to cryptsetup frodowiz
2014-09-18  7:29 ` ken
2014-09-18 13:45 ` Konstantin Bläsi
2014-09-27  4:20   ` frodowiz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.