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

[-- Attachment #1: Type: text/plain, Size: 1675 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 | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 7f01689a..1576d583 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,20 @@ 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
+	$(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
-- 
2.17.1

  reply	other threads:[~2019-10-07 16:11 UTC|newest]

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

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=20191007161113.13435-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