Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v2 2/3] build: generate tls config for unit tests
Date: Mon, 07 Oct 2019 11:06:03 -0700	[thread overview]
Message-ID: <20191007180604.1943-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20191007180604.1943-1-prestwoj@gmail.com>

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

To test embedded certs we need a settings file containing the same
PEMs that we generate during build time. In the same fashion generate
tls-settings.8021x file using the previously generated PEMs.
---
 Makefile.am | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

-v2:
 * Added AM_V_GEN to tls-settings.8021x generation
 * Remove tls-settings.8021x in clean-local

diff --git a/Makefile.am b/Makefile.am
index 7f01689a..3f647079 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -441,7 +441,8 @@ unit_test_eapol_DEPENDENCIES = $(ell_dependencies) \
 				unit/cert-server.pem \
 				unit/cert-server-key-pkcs8.pem \
 				unit/cert-client.pem \
-				unit/cert-client-key-pkcs8.pem
+				unit/cert-client-key-pkcs8.pem \
+				unit/tls-settings.8021x
 
 unit_test_util_SOURCES = src/util.h src/util.c \
 				unit/test-util.c
@@ -576,6 +577,21 @@ unit/cert-client.pem: unit/cert-client.csr unit/cert-ca.pem unit/gencerts.cnf
 			-CAserial $(builddir)/unit/cert-ca.srl \
 			-CAcreateserial -sha256 -days 10000 -out $@ $($(AM_V_P)_redirect_openssl)
 
+unit/tls-settings.8021x: unit/cert-ca.pem unit/cert-client.pem unit/cert-client-key-pkcs8.pem
+	$(AM_V_GEN) \
+	$(file >$@,[Security])
+	$(file >>$@,EAP-Method=TLS)
+	$(file >>$@,EAP-Identity=abc(a)example.com)
+	$(file >>$@,EAP-TLS-CACert=embed:ca_cert)
+	$(file >>$@,EAP-TLS-ClientCert=embed:client_cert)
+	$(file >>$@,EAP-TLS-ClientKey=embed:client_key)
+	$(file >>$@,[@pem(a)ca_cert])
+	$(shell cat unit/cert-ca.pem >> $@)
+	$(file >>$@,[@pem(a)client_cert])
+	$(shell cat unit/cert-client.pem >> $@)
+	$(file >>$@,[@pem(a)client_key])
+	$(shell cat unit/cert-client-key-pkcs8.pem >> $@)
+
 BUILT_SOURCES = $(ell_built_sources) src/builtin.h
 
 ell/internal: Makefile
@@ -627,7 +643,7 @@ endif
 endif
 
 clean-local:
-	-rm -f unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl
+	-rm -f unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl unit/*-settings.8021x
 
 maintainer-clean-local:
 	-rm -rf build-aux ell
-- 
2.17.1

  reply	other threads:[~2019-10-07 18:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 18:06 [PATCH v2 1/3] eap-tls-common: allow embedded PEMs in settings James Prestwood
2019-10-07 18:06 ` James Prestwood [this message]
2019-10-07 18:06 ` [PATCH v2 3/3] unit: add test for embedded certs to test-eapol James Prestwood

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=20191007180604.1943-2-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox