DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] Add new key from a variable
@ 2014-12-26  2:47 Jian-Ming Zheng
  2014-12-26  6:49 ` Sven Eschenberg
  0 siblings, 1 reply; 4+ messages in thread
From: Jian-Ming Zheng @ 2014-12-26  2:47 UTC (permalink / raw)
  To: dm-crypt

Hi,

I want to write a script to add a new key to LUKS device /dev/sda2. As
I know, I can set the new key in a key file (for example,
new-key-file) and use the key file in the option. For example,

$ cryptsetup luksAddKey /dev/sda2 new-key-file

Can I add a new key from a variable defined in my script (for example,
$newkey) instead of using a key file?

Thanks

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

* Re: [dm-crypt] Add new key from a variable
  2014-12-26  2:47 [dm-crypt] Add new key from a variable Jian-Ming Zheng
@ 2014-12-26  6:49 ` Sven Eschenberg
  2014-12-26 16:51   ` Arno Wagner
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Eschenberg @ 2014-12-26  6:49 UTC (permalink / raw)
  To: dm-crypt

Hi,

You could use STDIN to pipe the value of $var into cryptsetup, if that
fits your needs. See man page on password processing to make sure you
don't hit any surprises.

Regards

-Sven


On Fri, December 26, 2014 03:47, Jian-Ming Zheng wrote:
> Hi,
>
> I want to write a script to add a new key to LUKS device /dev/sda2. As
> I know, I can set the new key in a key file (for example,
> new-key-file) and use the key file in the option. For example,
>
> $ cryptsetup luksAddKey /dev/sda2 new-key-file
>
> Can I add a new key from a variable defined in my script (for example,
> $newkey) instead of using a key file?
>
> Thanks
> _______________________________________________
> 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] Add new key from a variable
  2014-12-26  6:49 ` Sven Eschenberg
@ 2014-12-26 16:51   ` Arno Wagner
  2014-12-26 17:09     ` Sven Eschenberg
  0 siblings, 1 reply; 4+ messages in thread
From: Arno Wagner @ 2014-12-26 16:51 UTC (permalink / raw)
  To: dm-crypt


This may not be such a good idea. If you are unlucky, the 
variable content may end up in swap. My guess would be that
the probability is low though.

Arno


On Fri, Dec 26, 2014 at 07:49:40 CET, Sven Eschenberg wrote:
> Hi,
> 
> You could use STDIN to pipe the value of $var into cryptsetup, if that
> fits your needs. See man page on password processing to make sure you
> don't hit any surprises.
> 
> Regards
> 
> -Sven
> 
> 
> On Fri, December 26, 2014 03:47, Jian-Ming Zheng wrote:
> > Hi,
> >
> > I want to write a script to add a new key to LUKS device /dev/sda2. As
> > I know, I can set the new key in a key file (for example,
> > new-key-file) and use the key file in the option. For example,
> >
> > $ cryptsetup luksAddKey /dev/sda2 new-key-file
> >
> > Can I add a new key from a variable defined in my script (for example,
> > $newkey) instead of using a key file?
> >
> > Thanks
> > _______________________________________________
> > dm-crypt mailing list
> > dm-crypt@saout.de
> > http://www.saout.de/mailman/listinfo/dm-crypt
> >
> 
> 
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt

-- 
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno@wagner.name
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -- Plato

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier

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

* Re: [dm-crypt] Add new key from a variable
  2014-12-26 16:51   ` Arno Wagner
@ 2014-12-26 17:09     ` Sven Eschenberg
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Eschenberg @ 2014-12-26 17:09 UTC (permalink / raw)
  To: dm-crypt

True, I forgot about that. And AFAIK there's no standard tools for
mlocking in scripts.

Regards

-Sven


On Fri, December 26, 2014 17:51, Arno Wagner wrote:
>
> This may not be such a good idea. If you are unlucky, the
> variable content may end up in swap. My guess would be that
> the probability is low though.
>
> Arno
>
>
> On Fri, Dec 26, 2014 at 07:49:40 CET, Sven Eschenberg wrote:
>> Hi,
>>
>> You could use STDIN to pipe the value of $var into cryptsetup, if that
>> fits your needs. See man page on password processing to make sure you
>> don't hit any surprises.
>>
>> Regards
>>
>> -Sven
>>
>>
>> On Fri, December 26, 2014 03:47, Jian-Ming Zheng wrote:
>> > Hi,
>> >
>> > I want to write a script to add a new key to LUKS device /dev/sda2. As
>> > I know, I can set the new key in a key file (for example,
>> > new-key-file) and use the key file in the option. For example,
>> >
>> > $ cryptsetup luksAddKey /dev/sda2 new-key-file
>> >
>> > Can I add a new key from a variable defined in my script (for example,
>> > $newkey) instead of using a key file?
>> >
>> > Thanks
>> > _______________________________________________
>> > dm-crypt mailing list
>> > dm-crypt@saout.de
>> > http://www.saout.de/mailman/listinfo/dm-crypt
>> >
>>
>>
>> _______________________________________________
>> dm-crypt mailing list
>> dm-crypt@saout.de
>> http://www.saout.de/mailman/listinfo/dm-crypt
>
> --
> Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno@wagner.name
> GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D
> 9718
> ----
> A good decision is based on knowledge and not on numbers. -- Plato
>
> If it's in the news, don't worry about it.  The very definition of
> "news" is "something that hardly ever happens." -- Bruce Schneier
> _______________________________________________
> 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

end of thread, other threads:[~2014-12-26 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26  2:47 [dm-crypt] Add new key from a variable Jian-Ming Zheng
2014-12-26  6:49 ` Sven Eschenberg
2014-12-26 16:51   ` Arno Wagner
2014-12-26 17:09     ` Sven Eschenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox