From: "Daniel P. Berrange" <berrange@redhat.com>
To: 陳培泓 <pahome.chen@mirlab.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Can I mount encrypt qcow2?
Date: Thu, 20 Jul 2017 10:12:24 +0100 [thread overview]
Message-ID: <20170720091224.GD21566@redhat.com> (raw)
In-Reply-To: <CAB3eZfuGD8OKr0HJwzDmiuAp5Sk5BuA8K4E+CvhwuYTAaKuMQA@mail.gmail.com>
On Thu, Jul 20, 2017 at 05:07:49PM +0800, 陳培泓 wrote:
> oh~ I don't know can expose the LUKS encryption. I'm sure the older(AES)
> can't be mounted by qemu-nbd.
It can be mounted, with current git master (all the commands I show
below are for git master btw).
You should, however, *never* use the old AES format any more. It is
broken by design and not considered secure.
> If I encrypt by the command you recommended:
>
> > qemu-nbd --object secret,id=sec0,file=passwd.txt,format=raw \
> > --image-opts driver=qcow2,file.filename=
> > demo.qcow2,encrypt.format=luks,encrypt.key-secret=sec0
This *is* exposing the encrypted file - not creating it. If you
want to connect to a host nbd device then you use the command
above, with the -c arg
$ qemu-nbd --object secret,id=sec0,file=passwd.txt,format=raw \
-c /dev/nbd0 \
--image-opts driver=qcow2,file.filename=demo.qcow2,encrypt.format=luks,encrypt.key-secret=sec0
If you have a legacy AES qcow2 file the syntax is very similar
$ qemu-nbd --object secret,id=sec0,file=passwd.txt,format=raw \
-c /dev/nbd0 \
--image-opts driver=qcow2,file.filename=demo.qcow2,encrypt.format=aes,encrypt.key-secret=sec0
Note we just changed the encrypt.format parameter there.
To actually create an encrypted file in the first place you need the
qemu-img command
$ qemu-img create --object secret,id=sec0,file=passwd.txt,format=raw \
-f qcow2 -o encrypt.format=luks,encrypt.key-secret=sec0 \
demo.qcow2 1G
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2017-07-20 9:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 2:43 [Qemu-devel] Can I mount encrypt qcow2? 陳培泓
2017-07-20 8:59 ` Daniel P. Berrange
2017-07-20 9:07 ` 陳培泓
2017-07-20 9:12 ` Daniel P. Berrange [this message]
2017-07-21 1:44 ` 陳培泓
2017-07-21 8:38 ` Daniel P. Berrange
2017-07-21 9:31 ` 陳培泓
2017-07-21 9:34 ` Daniel P. Berrange
2017-07-21 9:41 ` 陳培泓
2017-07-21 12:18 ` Eric Blake
2017-07-21 14:05 ` Eric Blake
2017-07-21 14:06 ` Daniel P. Berrange
2017-07-21 14:18 ` Eric Blake
2017-07-24 1:49 ` 陳培泓
2017-07-24 12:25 ` Eric Blake
2017-07-25 4:26 ` lampahome
2017-07-25 11:26 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170720091224.GD21566@redhat.com \
--to=berrange@redhat.com \
--cc=pahome.chen@mirlab.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.