Skip to contentSkip to conversation

eap-tls: Drop EAP-{TTLS,PEAP}-Client{Cert,Key}

PATCH In review Andrew Zaborowski 3 participants 9 messages Jan 25, 2021 – Jan 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 eap-tls: Drop EAP-{TTLS,PEAP}-Client{Cert,Key}

As requested move the client certificate and private key loading from eap-tls-common.c to eap-tls.c. No man page change needed because those two settings weren't documented in it in the first place.

---
 src/eap-tls-common.c | 239 ++++---------------------------------------
 src/eap-tls-common.h |   9 ++
 src/eap-tls.c        | 237 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 260 insertions(+), 225 deletions(-)
src/eap-tls-common.c +22 -217
index 68e2a10c..164115d8 100644
@@ -867,8 +867,8 @@ static struct l_queue *eap_tls_load_ca_cert(struct l_settings *settings,
 	return l_pem_load_certificate_list_from_data(pem, strlen(pem));
 }
 
-static struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
-							const char *value)
+struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
+						const char *value)
 {
 	const char *pem;
 
@@ -882,7 +882,7 @@ static struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
 	return l_pem_load_certificate_chain_from_data(pem, strlen(pem));
 }
 
-static struct l_key *eap_tls_load_priv_key(struct l_settings *settings,
+struct l_key *eap_tls_load_priv_key(struct l_settings *settings,
 				const char *value, const char *passphrase,
 				bool *is_encrypted)
 {
@@ -905,186 +905,23 @@ int eap_tls_common_settings_check(struct l_settings *settings,
 					struct l_queue **out_missing)
 {
 	char setting_key[72];
-	char client_cert_setting[72];
-	char passphrase_setting[72];
-	struct l_queue *cacerts = NULL;
-	struct l_certchain *cert = NULL;
-	struct l_key *priv_key = NULL;
-	bool is_encrypted, is_public;
-	int ret;
-	const char *error_str;
-	size_t size;
-	ssize_t result;
-	uint8_t *encrypted, *decrypted;
-	struct l_key *pub_key;
+	bool have_cacerts = false;
 	const char *domain_mask_str;
-
 	L_AUTO_FREE_VAR(char *, value);
-	L_AUTO_FREE_VAR(char *, client_cert) = NULL;
-	L_AUTO_FREE_VAR(char *, passphrase) = NULL;
 
 	snprintf(setting_key, sizeof(setting_key), "%sCACert", prefix);
 	value = l_settings_get_string(settings, "Security", setting_key);
 	if (value) {
-		cacerts = eap_tls_load_ca_cert(settings, value);
+		struct l_queue *cacerts = eap_tls_load_ca_cert(settings, value);
 
 		if (!cacerts) {
 			l_error("Failed to load %s", value);
 			return -EIO;
 		}
-	}
-
-	snprintf(client_cert_setting, sizeof(client_cert_setting),
-							"%sClientCert", prefix);
-	client_cert = l_settings_get_string(settings, "Security",
-							client_cert_setting);
-	if (client_cert) {
-		cert = eap_tls_load_client_cert(settings, client_cert);
-
-		if (!cert) {
-			l_error("Failed to load %s", client_cert);
-			ret = -EIO;
-			goto done;
-		}
-
-		/*
-		 * Sanity check that certchain provided is valid.  We do not
-		 * verify the certchain against the provided CA, since the
-		 * CA that issued user certificates might be different from
-		 * the one that is used to verify the peer
-		 */
-		if (!l_certchain_verify(cert, NULL, &error_str)) {
-			l_error("Certificate chain %s fails verification: %s",
-				client_cert, error_str);
-			ret = -EINVAL;
-			goto done;
-		}
-	}
-
-	l_free(value);
 
-	snprintf(setting_key, sizeof(setting_key), "%sClientKey", prefix);
-	value = l_settings_get_string(settings, "Security", setting_key);
-
-	if (value && !client_cert) {
-		l_error("%s present but no client certificate (%s)",
-					setting_key, client_cert_setting);
-		ret = -ENOENT;
-		goto done;
-	} else if (!value && client_cert) {
-		l_error("%s present but no client private key (%s)",
-					client_cert_setting, setting_key);
-		ret = -ENOENT;
-		goto done;
-	}
-
-	snprintf(passphrase_setting, sizeof(passphrase_setting),
-					"%sClientKeyPassphrase", prefix);
-	passphrase = l_settings_get_string(settings, "Security",
-							passphrase_setting);
-
-	if (!passphrase) {
-		const struct eap_secret_info *secret;
-
-		secret = l_queue_find(secrets, eap_secret_info_match,
-							passphrase_setting);
-		if (secret)
-			passphrase = l_strdup(secret->value);
-	}
-
-	if (!value) {
-		if (passphrase) {
-			l_error("%s present but no client private key"
-				" value set (%s)", passphrase_setting,
-				setting_key);
-			ret = -ENOENT;
-			goto done;
-		}
-
-		ret = 0;
-		goto done;
-	}
-
-	priv_key = eap_tls_load_priv_key(settings, value, passphrase,
-						&is_encrypted);
-
-	if (!priv_key) {
-		if (!is_encrypted) {
-			l_error("Error loading client private key %s", value);
-			ret = -EIO;
-			goto done;
-		}
-
-		if (passphrase) {
-			l_error("Error loading encrypted client private key %s",
-				value);
-			ret = -EACCES;
-			goto done;
-		}
-
-		/*
-		 * We've got an encrypted key and passphrase was not saved
-		 * in the network settings, need to request the passphrase.
-		 */
-		eap_append_secret(out_missing,
-					EAP_SECRET_LOCAL_PKEY_PASSPHRASE,
-					passphrase_setting, NULL, value,
-					EAP_CACHE_TEMPORARY);
-		ret = 0;
-		goto done;
-	}
-
-	if (passphrase && !is_encrypted) {
-		l_error("%s present but client private key %s is not encrypted",
-			passphrase_setting, value);
-		ret = -ENOENT;
-		goto done;
-	}
-
-	if (!l_key_get_info(priv_key, L_KEY_RSA_PKCS1_V1_5, L_CHECKSUM_NONE,
-				&size, &is_public) || is_public) {
-		l_error("%s is not a private key or l_key_get_info fails",
-			value);
-		ret = -EINVAL;
-		goto done;
-	}
-
-	size /= 8;
-	encrypted = alloca(size);
-	decrypted = alloca(size);
-
-	pub_key = l_cert_get_pubkey(l_certchain_get_leaf(cert));
-	if (!pub_key) {
-		l_error("l_cert_get_pubkey fails for %s", client_cert);
-		ret = -EIO;
-		goto done;
-	}
-
-	result = l_key_encrypt(pub_key, L_KEY_RSA_PKCS1_V1_5, L_CHECKSUM_NONE,
-				"", encrypted, 1, size);
-	l_key_free(pub_key);
-
-	if (result != (ssize_t) size) {
-		l_error("l_key_encrypt fails with %s: %s", client_cert,
-			strerror(-result));
-		ret = result;
-		goto done;
-	}
-
-	result = l_key_decrypt(priv_key, L_KEY_RSA_PKCS1_V1_5, L_CHECKSUM_NONE,
-				encrypted, decrypted, size, size);
-	if (result < 0) {
-		l_error("l_key_decrypt fails with %s: %s", value,
-			strerror(-result));
-		ret = result;
-		goto done;
-	}
-
-	if (result != 1 || decrypted[0] != 0) {
-		l_error("Private key %s does not match certificate %s", value,
-			client_cert);
-		ret = -EINVAL;
-		goto done;
+		l_queue_destroy(cacerts,
+				(l_queue_destroy_func_t) l_cert_free);
+		have_cacerts = true;
 	}
 
 	/*
@@ -1097,23 +934,12 @@ int eap_tls_common_settings_check(struct l_settings *settings,
 			prefix);
 	domain_mask_str = l_settings_get_value(settings, "Security",
 						setting_key);
-	if (domain_mask_str && !cacerts) {
+	if (domain_mask_str && !have_cacerts) {
 		l_error("%s was set but no CA Certificates given", setting_key);
-		ret = -EINVAL;
-		goto done;
+		return -EINVAL;
 	}
 
-	ret = 0;
-done:
-	l_queue_destroy(cacerts,
-			(l_queue_destroy_func_t) l_cert_free);
-	l_certchain_free(cert);
-	l_key_free(priv_key);
-
-	if (passphrase)
-		explicit_bzero(passphrase, strlen(passphrase));
-
-	return ret;
+	return 0;
 }
 
 bool eap_tls_common_settings_load(struct eap_state *eap,
@@ -1124,8 +950,8 @@ bool eap_tls_common_settings_load(struct eap_state *eap,
 	struct eap_tls_state *eap_tls;
 	char setting_key[72];
 	char *domain_mask_str;
+
 	L_AUTO_FREE_VAR(char *, value) = NULL;
-	L_AUTO_FREE_VAR(char *, passphrase) = NULL;
 
 	eap_tls = l_new(struct eap_tls_state, 1);
 
@@ -1143,37 +969,6 @@ bool eap_tls_common_settings_load(struct eap_state *eap,
 		}
 	}
 
-	l_free(value);
-
-	snprintf(setting_key, sizeof(setting_key), "%sClientCert", prefix);
-	value = l_settings_get_string(settings, "Security", setting_key);
-	if (value) {
-		eap_tls->client_cert = eap_tls_load_client_cert(settings,
-								value);
-		if (!eap_tls->client_cert) {
-			l_error("Could not load ClientCert %s", value);
-			goto load_error;
-		}
-	}
-
-	l_free(value);
-
-	snprintf(setting_key, sizeof(setting_key), "%sClientKeyPassphrase",
-									prefix);
-	passphrase = l_settings_get_string(settings, "Security", setting_key);
-
-	snprintf(setting_key, sizeof(setting_key), "%sClientKey", prefix);
-	value = l_settings_get_string(settings, "Security", setting_key);
-	if (value) {
-		eap_tls->client_key = eap_tls_load_priv_key(settings, value,
-								passphrase,
-								NULL);
-		if (!eap_tls->client_key) {
-			l_error("Could not load ClientKey %s", value);
-			goto load_error;
-		}
-	}
-
 	snprintf(setting_key, sizeof(setting_key), "%sServerDomainMask",
 								prefix);
 	domain_mask_str = l_settings_get_string(settings, "Security",
@@ -1194,6 +989,16 @@ load_error:
 	return false;
 }
 
+void eap_tls_common_set_keys(struct eap_state *eap,
+				struct l_certchain *client_cert,
+				struct l_key *client_key)
+{
+	struct eap_tls_state *eap_tls = eap_get_data(eap);
+
+	eap_tls->client_cert = client_cert;
+	eap_tls->client_key = client_key;
+}
+
 void eap_tls_common_set_completed(struct eap_state *eap)
 {
 	struct eap_tls_state *eap_tls = eap_get_data(eap);
src/eap-tls-common.h +9 -0
index 88cac244..81c84c3e 100644
@@ -48,6 +48,12 @@ void eap_tls_common_handle_request(struct eap_state *eap,
 void eap_tls_common_handle_retransmit(struct eap_state *eap,
 						const uint8_t *pkt, size_t len);
 
+struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
+						const char *value);
+struct l_key *eap_tls_load_priv_key(struct l_settings *settings,
+				const char *value, const char *passphrase,
+				bool *is_encrypted);
+
 int eap_tls_common_settings_check(struct l_settings *settings,
 						struct l_queue *secrets,
 						const char *prefix,
@@ -56,6 +62,9 @@ bool eap_tls_common_settings_load(struct eap_state *eap,
 				struct l_settings *settings, const char *prefix,
 				const struct eap_tls_variant_ops *variant_ops,
 				void *variant_data);
+void eap_tls_common_set_keys(struct eap_state *eap,
+				struct l_certchain *client_cert,
+				struct l_key *client_key);
 
 void eap_tls_common_send_empty_response(struct eap_state *eap);
 enum eap_tls_version eap_tls_common_get_negotiated_version(
src/eap-tls.c +229 -8

262 lines not on this page · raw message

Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/7 eap-tls: Make use of l_cert_load_container_file

Switch EAP-TLS-ClientCert and EAP-TLS-ClientKey to use l_cert_load_container_file for file loading so that the file format is autodetected. Add new setting EAP-TLS-ClientKeyBundle for loading both the client certificate and private key from one file.

---
 src/eap-tls-common.c |  40 ++++++++++---
 src/eap-tls-common.h |   9 ++-
 src/eap-tls.c        | 137 +++++++++++++++++++++++++++++++++++--------
 3 files changed, 151 insertions(+), 35 deletions(-)
src/eap-tls-common.c +32 -8
index 164115d8..5edbfc5d 100644
@@ -868,12 +868,25 @@ static struct l_queue *eap_tls_load_ca_cert(struct l_settings *settings,
 }
 
 struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
-						const char *value)
+						const char *value,
+						const char *passphrase,
+						bool *out_is_encrypted)
 {
 	const char *pem;
 
-	if (!is_embedded(value))
-		return l_pem_load_certificate_chain(value);
+	if (!is_embedded(value)) {
+		struct l_certchain *certchain;
+
+		if (l_cert_load_container_file(value, passphrase,
+						&certchain, NULL,
+						out_is_encrypted))
+			return certchain;
+
+		if (out_is_encrypted)
+			*out_is_encrypted = false;
+
+		return NULL;
+	}
 
 	pem = load_embedded_pem(settings, value);
 	if (!pem)
@@ -883,20 +896,31 @@ struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
 }
 
 struct l_key *eap_tls_load_priv_key(struct l_settings *settings,
-				const char *value, const char *passphrase,
-				bool *is_encrypted)
+					const char *value,
+					const char *passphrase,
+					bool *out_is_encrypted)
 {
 	const char *pem;
 
-	if (!is_embedded(value))
-		return l_pem_load_private_key(value, passphrase, is_encrypted);
+	if (!is_embedded(value)) {
+		struct l_key *key;
+
+		if (l_cert_load_container_file(value, passphrase, NULL, &key,
+						out_is_encrypted))
+			return key;
+
+		if (out_is_encrypted)
+			*out_is_encrypted = false;
+
+		return NULL;
+	}
 
 	pem = load_embedded_pem(settings, value);
 	if (!pem)
 		return NULL;
 
 	return l_pem_load_private_key_from_data(pem, strlen(pem),
-						passphrase, is_encrypted);
+						passphrase, out_is_encrypted);
 }
 
 int eap_tls_common_settings_check(struct l_settings *settings,
src/eap-tls-common.h +6 -3
index 81c84c3e..174770c0 100644
@@ -49,10 +49,13 @@ void eap_tls_common_handle_retransmit(struct eap_state *eap,
 						const uint8_t *pkt, size_t len);
 
 struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
-						const char *value);
+						const char *value,
+						const char *passphrase,
+						bool *out_is_encrypted);
 struct l_key *eap_tls_load_priv_key(struct l_settings *settings,
-				const char *value, const char *passphrase,
-				bool *is_encrypted);
+					const char *value,
+					const char *passphrase,
+					bool *out_is_encrypted);
 
 int eap_tls_common_settings_check(struct l_settings *settings,
 						struct l_queue *secrets,
src/eap-tls.c +113 -24

204 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw

PATCH 3/7 autotests: Test loading binary key formats in testEAP-TLS

In reply to Andrew Zaborowski
---
 autotests/misc/certs/cert-client.crt     | Bin 0 -> 1089 bytes
 autotests/misc/certs/cert-client.p12     | Bin 0 -> 2693 bytes
 autotests/testEAP-TLS/connection_test.py |   4 ++++
 autotests/testEAP-TLS/hw.conf            |   3 ++-
 autotests/testEAP-TLS/ssidEAP-TLS3.8021x |   2 +-
 autotests/testEAP-TLS/ssidEAP-TLS4.8021x |   9 +++++++++
 autotests/testEAP-TLS/ssidEAP-TLS4.conf  |  13 +++++++++++++
 7 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 autotests/misc/certs/cert-client.crt
 create mode 100644 autotests/misc/certs/cert-client.p12
 create mode 100644 autotests/testEAP-TLS/ssidEAP-TLS4.8021x
 create mode 100644 autotests/testEAP-TLS/ssidEAP-TLS4.conf
autotests/misc/certs/cert-client.crt new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..fb363f59593079fc54a5f44777cf6da1ae7885ab
GIT binary patch
autotests/misc/certs/cert-client.p12 new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..e57a1bfde3a9a157605d2fdb55800c6a819e9b02
GIT binary patch
autotests/testEAP-TLS/connection_test.py +4 -0
index 1e390e69..c90b0ceb 100644
@@ -66,11 +66,15 @@ class Test(unittest.TestCase):
     def test_eap_tls3(self):
         self.do_test_connection_success('ssidEAP-TLS3', 'abc')
 
+    def test_eap_tls4(self):
+        self.do_test_connection_success('ssidEAP-TLS4')
+
     @classmethod
     def setUpClass(cls):
         IWD.copy_to_storage('ssidEAP-TLS.8021x')
         IWD.copy_to_storage('ssidEAP-TLS2.8021x')
         IWD.copy_to_storage('ssidEAP-TLS3.8021x')
+        IWD.copy_to_storage('ssidEAP-TLS4.8021x')
 
     @classmethod
     def tearDownClass(cls):
autotests/testEAP-TLS/hw.conf +2 -1
index 44cd4239..0ce95320 100644
@@ -1,8 +1,9 @@
 [SETUP]
-num_radios=4
+num_radios=5
 tmpfs_extra_stuff=../misc/certs
 
 [HOSTAPD]
 rad0=ssidEAP-TLS.conf
 rad1=ssidEAP-TLS2.conf
 rad2=ssidEAP-TLS3.conf
+rad3=ssidEAP-TLS4.conf
autotests/testEAP-TLS/ssidEAP-TLS3.8021x +1 -1
index 1d9225f1..03d571e9 100644
@@ -1,7 +1,7 @@
 [Security]
 EAP-Method=TLS
 EAP-TLS-CACert=/tmp/certs/cert-ca.pem
-EAP-TLS-ClientCert=/tmp/certs/cert-client.pem
+EAP-TLS-ClientCert=/tmp/certs/cert-client.crt
 EAP-TLS-ClientKey=/tmp/certs/cert-client-key-v2-des-ede3.pem
 EAP-Identity=abc(a)example.com
 
autotests/testEAP-TLS/ssidEAP-TLS4.8021x new file +9 -0
new file mode 100644
index 00000000..61523310
@@ -0,0 +1,9 @@
+[Security]
+EAP-Method=TLS
+EAP-TLS-CACert=/tmp/certs/cert-ca.pem
+EAP-TLS-ClientKeyBundle=/tmp/certs/cert-client.p12
+EAP-TLS-ClientKeyPassphrase=abc
[email protected]
+
+[Settings]
+AutoConnect=False
autotests/testEAP-TLS/ssidEAP-TLS4.conf new file +13 -0
new file mode 100644
index 00000000..41c63c95
@@ -0,0 +1,13 @@
+ctrl_interface=/var/run/hostapd
+hw_mode=g
+channel=4
+ssid=ssidEAP-TLS4
+
+wpa=3
+wpa_key_mgmt=WPA-EAP
+ieee8021x=1
+eap_server=1
+eap_user_file=/tmp/certs/eap-user-tls.text
+ca_cert=/tmp/certs/cert-ca.pem
+server_cert=/tmp/certs/cert-server.pem
+private_key=/tmp/certs/cert-server-key.pem
Signature · 1 line
2.27.0
#3 lore raw

Re: [PATCH 3/7] autotests: Test loading binary key formats in testEAP-TLS

Hi Andrew,

autotests/testEAP-TLS/connection_test.py class Test(unittest.TestCase): · line 71

Quoted 13 lines
autotests/testEAP-TLS/connection_test.py +3 -0
index 1e390e69..c90b0ceb 100644
@@ -66,11 +66,15 @@ class Test(unittest.TestCase):
     def test_eap_tls3(self):
         self.do_test_connection_success('ssidEAP-TLS3', 'abc')
 
+    def test_eap_tls4(self):
+        self.do_test_connection_success('ssidEAP-TLS4')
+

Just FYI, these two new tests do not pass for me. Seems to fail loading the client-cert. I'm guessing its a lack of those recent keyring changes you've been working on in the kernel?

Failed to load /tmp/certs/cert-client.crt Esrc/agent.c:agent_unregister() agent unregister src/agent.c:agent_free() agent free 0x191c520 src/network.c:network_connect() src/network.c:network_connect_8021x() EAP-TLS-ClientKeyPassphrase present but no client private key value set (EAP-TLS-ClientKey)
E
======================================================================
ERROR: test_eap_tls3 (connection_test.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jprestwo/iwd/autotests/testEAP-TLS/connection_test.py",
line 67, in test_eap_tls3
self.do_test_connection_success('ssidEAP-TLS3', 'abc')
File "/home/jprestwo/iwd/autotests/testEAP-TLS/connection_test.py",
line 44, in do_test_connection_success
ordered_network.network_object.connect()
File "/home/jprestwo/iwd/autotests/util/iwd.py", line 590, in connect

    self._wait_for_async_op()

File "/home/jprestwo/iwd/autotests/util/iwd.py", line 119, in
_wait_for_async_op
raise tmp
iwd.NotConfiguredEx: net.connman.iwd.NotConfigured: Not configured

======================================================================
ERROR: test_eap_tls4 (connection_test.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jprestwo/iwd/autotests/testEAP-TLS/connection_test.py",
line 70, in test_eap_tls4
self.do_test_connection_success('ssidEAP-TLS4')
File "/home/jprestwo/iwd/autotests/testEAP-TLS/connection_test.py",
line 44, in do_test_connection_success
ordered_network.network_object.connect()
File "/home/jprestwo/iwd/autotests/util/iwd.py", line 590, in connect

    self._wait_for_async_op()

File "/home/jprestwo/iwd/autotests/util/iwd.py", line 119, in
_wait_for_async_op
raise tmp
iwd.NotConfiguredEx: net.connman.iwd.NotConfigured: Not configured

----------------------------------------------------------------------
Ran 4 tests in 4.663s

Thanks,
James

#4 lore raw

PATCH 4/7 testrunner: Fix /tmp files cleanup on error

In reply to Andrew Zaborowski

Since the list of files copied to /tmp was part of the return value from pre_test(), if an exception occurred inside pre_test(), "copied" would be undefined and the post_test(ctx, copied) call in the finally clause cause another exception:

raceback (most recent call last):
File "/home/balrog/repos/iwd/tools/test-runner", line 1508, in <module>

    run_tests()

File "/home/balrog/repos/iwd/tools/test-runner", line 1242, in run_tests
run_auto_tests(config.ctx, args)
File "/home/balrog/repos/iwd/tools/test-runner", line 1166, in run_auto_tests
post_test(ctx, copied)
UnboundLocalError: local variable 'copied' referenced before assignment

(apart from not being able to clean up the files). Pass "copied" as a paremeter to pre_test instead.

---
 tools/test-runner | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/test-runner +5 -3
index 7bd15a28..3ba49953 100755
@@ -973,7 +973,7 @@ def start_test(ctx, subtests, rqueue):
 	# This may not be required since we are manually popping sys.modules
 	importlib.invalidate_caches()
 
-def pre_test(ctx, test):
+def pre_test(ctx, test, copied):
 	'''
 		Copy test files, start processes, and any other pre test work.
 	'''
@@ -1005,6 +1005,7 @@ def pre_test(ctx, test):
 			shutil.copytree(f, '/tmp/' + f)
 		else:
 			shutil.copy(f, '/tmp')
+		copied.append(f)
 
 	# Prune down any subtests if needed
 	if ctx.args.sub_tests:
@@ -1044,7 +1045,7 @@ def pre_test(ctx, test):
 
 	sys.path.insert(1, test)
 
-	return (to_copy, sorted(subtests))
+	return sorted(subtests)
 
 def post_test(ctx, to_copy):
 	'''
@@ -1119,8 +1120,9 @@ def run_auto_tests(ctx, args):
 	shutil.copy(args.testhome + '/autotests/misc/phonesim/phonesim.conf', '/tmp')
 
 	for test in tests:
+		copied = []
 		try:
-			copied, subtests = pre_test(ctx, test)
+			subtests = pre_test(ctx, test, copied)
 
 			if args.shell:
 				#
Signature · 1 line
2.27.0
#5 lore raw

PATCH 5/7 doc: Update EAP-TLS client key setting information

In reply to Andrew Zaborowski
---
 src/iwd.network.rst | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
src/iwd.network.rst +14 -7
index cb3afc67..c0548052 100644
@@ -211,20 +211,27 @@ authentication configuration.
    * - EAP-TLS-ClientCert
      - absolute file path or embedded pem
 
-       Path to a PEM-formatted client X.509 certificate or certificate chain
-       to send on server request.
+       Path to the client X.509 certificate or certificate chain to send on
+       server request.
    * - EAP-TLS-ClientKey
      - absolute file path or embedded pem
 
-       Path to a PEM-formatted client PKCS#8 private key corresponding to the
-       public key provided in *EAP-TLS-ClientCert*.
+       Path to the client private key corresponding to the public key provided
+       in *EAP-TLS-ClientCert*.  The recommended format is PKCS#8 PEM.
+   * - EAP-TLS-ClientKeyBundle
+     - absolute file path
+
+       As an alternative to *EAP-TLS-ClientCert* and *EAP-TLS-ClientKey* IWD
+       can load both the certificate and the private key from a container file
+       pointed by this setting.  The recommended format is PKCS#12 when this
+       is used.
    * - | EAP-TLS-
        | ClientKeyPassphrase
      - string
 
-       Decryption key for the client private key file.  This is used if the
-       private key given by *EAP-TLS-ClientKey* is encrypted.  If not provided,
-       then the agent is asked for the passphrase at connection time.
+       Decryption key for the client key files.  This should be used if the
+       certificate or the private key in the files mentioned above is encrypted.
+       When not given, the agent is asked for the passphrase at connection time.
    * - | EAP-TLS-ServerDomainMask,
        | EAP-TTLS-ServerDomainMask,
        | EAP-PEAP-ServerDomainMask
Signature · 1 line
2.27.0
#6 lore raw

PATCH 6/7 doc: Specify the DNS format as string lists

In reply to Andrew Zaborowski
---
 src/iwd.network.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/iwd.network.rst +4 -4
index c0548052..083b2103 100644
@@ -301,9 +301,9 @@ network configuration with the static addresses.
        The IPv4 address of the gateway (router). This field is `required` for
        the static configuration.
    * - DNS
-     - IPv4 address string
+     - IPv4 address string list, space delimited
 
-       The IPv4 address of the Domain Name System (DNS). This field is
+       The IPv4 address(es) of the Domain Name System (DNS). This field is
        `optional`. DNS setting can be used to override the DNS entries received
        from the DHCP server.
    * - Netmask
@@ -352,9 +352,9 @@ network configuration.
        The IPv6 address of the gateway (router). This field is `required` for
        the static configuration.
    * - DNS
-     - IPv6 address string
+     - IPv6 address string list, space delimited
 
-       The IPv6 address of the Domain Name System (DNS). This field is
+       The IPv6 address(es) of the Domain Name System (DNS). This field is
        `optional`. DNS setting can be used to override the DNS entries received
        from the DHCPv6 server or via Router Advertisements.
    * - DomainName
Signature · 1 line
2.27.0
#7 lore raw

PATCH 7/7 netconfig: Set more correct buffer length

In reply to Andrew Zaborowski

Use INET_ADDRSTRLEN as the IPv4 address buffer size to avoid confusion.

---
 src/netconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/netconfig.c +1 -1
index e7a6a402..cf092b78 100644
@@ -608,7 +608,7 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
 	L_AUTO_FREE_VAR(char *, gateway) = NULL;
 	struct in_addr in_addr;
 	char *network;
-	char ip[INET6_ADDRSTRLEN];
+	char ip[INET_ADDRSTRLEN];
 	unsigned int prefix_len =
 		l_rtnl_address_get_prefix_length(netconfig->v4_address);
 
Signature · 1 line
2.27.0
#8 lore raw
In reply to Andrew Zaborowski

Hi Andrew,

Quoted 9 lines · Andrew Zaborowski

As requested move the client certificate and private key loading from eap-tls-common.c to eap-tls.c. No man page change needed because those two settings weren't documented in it in the first place.

---
  src/eap-tls-common.c | 239 ++++---------------------------------------
  src/eap-tls-common.h |   9 ++
  src/eap-tls.c        | 237 ++++++++++++++++++++++++++++++++++++++++--
  3 files changed, 260 insertions(+), 225 deletions(-)

All applied, thanks.

Regards,
-Denis