From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 5/6] tests: add iotests helpers for dealing with TLS certificates
Date: Mon, 19 Nov 2018 10:27:32 +0000 [thread overview]
Message-ID: <20181119102732.GF19532@redhat.com> (raw)
In-Reply-To: <5acd44f8-69c7-a791-0ce0-49cad6e48423@redhat.com>
On Fri, Nov 16, 2018 at 10:39:03AM -0600, Eric Blake wrote:
> On 11/16/18 9:53 AM, Daniel P. Berrangé wrote:
> > Add helpers to common.tls for creating TLS certificates for a CA,
> > server and client.
>
> MUCH appreciated! We NEED this coverage, easily automated.
>
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > tests/qemu-iotests/common.tls | 139 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 139 insertions(+)
> > create mode 100644 tests/qemu-iotests/common.tls
> >
> > diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
> > new file mode 100644
>
> I was a bit surprised that this wasn't 100755, but this matches the fact
> that none of the other common.* are executable. And after thinking more, it
> makes sense - they aren't standalone scripts, but designed to be sourced,
> and 'source' doesn't care about execute bits.
>
> > +tls_dir="${TEST_DIR}/tls"
> > +
> > +function tls_x509_cleanup()
> > +{
> > + rm -f ${tls_dir}/*.pem
> > + rm -f ${tls_dir}/*/*.pem
> > + rmdir ${tls_dir}/*
> > + rmdir ${tls_dir}
>
> Why not just:
> rm -rf $tls_dir
Yeah, I guess we could do that for simplicity
> Also, the quoting is a bit inconsistent. if ${TEST_DIR} can contain spaces,
> then all uses of ${tls_dir} need to be in "".
Hmm, yes.
> > +}
> > +
> > +
> > +function tls_x509_init()
> > +{
> > + mkdir "${tls_dir}"
>
> And this just highlights the quoting inconsistency. Should this use mkdir
> -p?
I assume $TEST_DIR would already exist, so wouldn't need -p.
> > +
> > +function tls_x509_create_root_ca()
> > +{
> > + name=$1
> > +
> > + test -z "$name" && name=ca-cert
>
> Could also be shortened as:
>
> name=${1:-ca-cert}
ok
> > +
> > + cat > ${tls_dir}/ca.info <<EOF
> > +cn = Cthulu Dark Lord Enterprises $name
>
> s/Cthulu/Cthulhu/ - after all, we don't want him coming after us just
> because we botched the spelling of his name :)
>
> > +ca
> > +cert_signing_key
> > +EOF
> > +
> > + certtool --generate-self-signed \
> > + --load-privkey ${tls_dir}/key.pem \
> > + --template ${tls_dir}/ca.info \
> > + --outfile ${tls_dir}/$name-cert.pem 2>&1 | head -1
>
> More missing ""
>
> > +
> > + rm -f ${tls_dir}/ca.info
> > +}
> > +
> > +
> > +function tls_x509_create_server()
> > +{
> > + caname=$1
> > + name=$2
> > +
> > + mkdir ${tls_dir}/$name
> > + cat > ${tls_dir}/cert.info <<EOF
> > +organization = Cthulu Dark Lord Enterprises $name
>
> Matched spelling
>
> > +function tls_x509_create_client()
> > +{
> > + caname=$1
> > + name=$2
> > +
> > + mkdir ${tls_dir}/$name
> > + cat > ${tls_dir}/cert.info <<EOF
> > +country = South Pacific
> > +locality = R'lyeh
> > +organization = Cthulu Dark Lord Enterprises $name
>
> And again
>
> Needs several touch-ups, but the idea itself is sound.
Yes will fix
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:[~2018-11-19 10:27 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 15:53 [Qemu-devel] [PATCH 0/6] Misc fixes to NBD Daniel P. Berrangé
2018-11-16 15:53 ` [Qemu-devel] [PATCH 1/6 for-3.1] nbd: fix whitespace in server error message Daniel P. Berrangé
2018-11-16 16:01 ` Eric Blake
2018-11-19 16:29 ` Philippe Mathieu-Daudé
2018-11-16 15:53 ` [Qemu-devel] [PATCH 2/6 for-3.1] nbd: stop waiting for a NBD response with NBD_CMD_DISC Daniel P. Berrangé
2018-11-16 16:08 ` Eric Blake
2018-11-18 2:19 ` Eric Blake
2018-11-19 10:23 ` Daniel P. Berrangé
2018-11-19 14:24 ` Eric Blake
2018-11-19 13:47 ` Daniel P. Berrangé
2018-11-16 15:53 ` [Qemu-devel] [PATCH 3/6] tests: pull qemu-nbd iotest helpers into common.nbd file Daniel P. Berrangé
2018-11-16 16:11 ` Eric Blake
2018-11-16 21:41 ` Eric Blake
2018-11-16 21:43 ` Eric Blake
2018-11-19 10:24 ` Daniel P. Berrangé
2018-11-18 3:01 ` Eric Blake
2018-11-19 10:24 ` Daniel P. Berrangé
2018-11-16 15:53 ` [Qemu-devel] [PATCH 4/6] tests: check if qemu-nbd is still alive before waiting Daniel P. Berrangé
2018-11-16 16:24 ` Eric Blake
2018-11-19 10:26 ` Daniel P. Berrangé
2018-11-16 15:53 ` [Qemu-devel] [PATCH 5/6] tests: add iotests helpers for dealing with TLS certificates Daniel P. Berrangé
2018-11-16 16:39 ` Eric Blake
2018-11-19 10:27 ` Daniel P. Berrangé [this message]
2018-11-19 11:04 ` Max Reitz
2018-11-19 14:27 ` Eric Blake
2018-11-19 14:32 ` Daniel P. Berrangé
2018-11-16 15:53 ` [Qemu-devel] [PATCH 6/6] tests: exercise NBD server in TLS mode Daniel P. Berrangé
2018-11-16 17:20 ` Eric Blake
2018-11-17 21:31 ` Eric Blake
2018-11-19 10:37 ` Daniel P. Berrangé
2018-11-19 17:00 ` Eric Blake
2018-11-20 9:40 ` Daniel P. Berrangé
2018-11-19 10:36 ` Daniel P. Berrangé
2018-11-17 20:49 ` Eric Blake
2018-11-17 22:31 ` Eric Blake
2018-11-17 22:32 ` [Qemu-devel] [PATCH 1.5/6] nbd/server: Ignore write errors when replying to NBD_OPT_ABORT Eric Blake
2018-11-19 10:39 ` Daniel P. Berrangé
2018-11-19 10:39 ` [Qemu-devel] [PATCH 6/6] tests: exercise NBD server in TLS mode Daniel P. Berrangé
2018-11-18 2:24 ` [Qemu-devel] [PATCH 7/6] iotests: Also test I/O over NBD TLS Eric Blake
2018-11-19 10:40 ` Daniel P. Berrangé
2018-11-19 17:11 ` Eric Blake
2018-11-19 17:04 ` [Qemu-devel] [PATCH 6/6] tests: exercise NBD server in TLS mode Eric Blake
2018-11-20 17:27 ` Kevin Wolf
2018-11-20 17:45 ` Eric Blake
2018-11-20 17:53 ` Daniel P. Berrangé
2018-11-20 18:22 ` Eric Blake
2018-11-20 21:56 ` Kevin Wolf
2018-11-21 9:30 ` Daniel P. Berrangé
2018-11-18 2:39 ` [Qemu-devel] [PATCH 0/6] Misc fixes to NBD Eric Blake
2018-11-27 15:42 ` 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=20181119102732.GF19532@redhat.com \
--to=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.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.