summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-01-22 09:40:01 +0100
committerLubomir Rintel <lkundrak@v3.sk>2019-02-05 10:20:27 +0100
commit2d3e42b5a773275643af7553227b10144d269522 (patch)
tree68f17f3046c09d4fc447a01ec26b680606a21e14
parent5af08ded7564a61c47143e0f2aa5e8fd2c7f88cc (diff)
downloadNetworkManager-2d3e42b5a773275643af7553227b10144d269522.tar.gz
libnm-core/setting-wireless-security: add support for SAE key management
This adds support for configuring the Wi-Fi connections to use SAE. SAE is a password-based authentication mechanism that replaces WPA-PSK in WPA3-Personal. The pass phrase is still stored in the "psk" property, with some limitations lifted.
-rw-r--r--clients/common/settings-docs.h.in4
-rw-r--r--libnm-core/nm-setting-wireless-security.c38
2 files changed, 25 insertions, 17 deletions
diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in
index 725ca7d6b8..0816822c77 100644
--- a/clients/common/settings-docs.h.in
+++ b/clients/common/settings-docs.h.in
@@ -24,14 +24,14 @@
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_AUTH_ALG N_("When WEP is used (ie, key-mgmt = \"none\" or \"ieee8021x\") indicate the 802.11 authentication algorithm required by the AP here. One of \"open\" for Open System, \"shared\" for Shared Key, or \"leap\" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\") the \"leap-username\" and \"leap-password\" properties must be specified.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_FILS N_("Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE (1) (disable FILS), NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL (2) (enable FILS if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED (3) (enable FILS and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) and no global default is set, FILS will be optionally enabled.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_GROUP N_("A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"wep40\", \"wep104\", \"tkip\", or \"ccmp\".")
-#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-none\" (Ad-Hoc WPA-PSK), \"wpa-psk\" (infrastructure WPA-PSK), or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.")
+#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-none\" (Ad-Hoc WPA-PSK), \"wpa-psk\" (infrastructure WPA-PSK), \"sae\" (SAE) or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD N_("The login password for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS N_("Flags indicating how to handle the \"leap-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME N_("The login username for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PAIRWISE N_("A list of pairwise encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"tkip\" or \"ccmp\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PMF N_("Indicates whether Protected Management Frames (802.11w) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE (1) (disable PMF), NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (2) (enable PMF if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (3) (enable PMF and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) and no global default is set, PMF will be optionally enabled.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PROTO N_("List of strings specifying the allowed WPA protocol versions to use. Each element may be one \"wpa\" (allow WPA) or \"rsn\" (allow WPA2/RSN). If not specified, both WPA and RSN connections are allowed.")
-#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK N_("Pre-Shared-Key for WPA networks. If the key is 64-characters long, it must contain only hexadecimal characters and is interpreted as a hexadecimal WPA key. Otherwise, the key must be between 8 and 63 ASCII characters (as specified in the 802.11i standard) and is interpreted as a WPA passphrase, and is hashed to derive the actual WPA-PSK used when connecting to the Wi-Fi network.")
+#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK N_("Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII passphrase of 8 to 63 characters that is (as specified in the 802.11i standard) hashed to derive the actual key, or the key in form of 64 hexadecimal character. The WPA3-Personal networks use a passphrase of any length for SAE authentication.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS N_("Flags indicating how to handle the \"psk\" property.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS N_("Flags indicating how to handle the \"wep-key0\", \"wep-key1\", \"wep-key2\", and \"wep-key3\" properties.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE N_("Controls the interpretation of WEP keys. Allowed values are NM_WEP_KEY_TYPE_KEY (1), in which case the key is either a 10- or 26-character hexadecimal string, or a 5- or 13-character ASCII password; or NM_WEP_KEY_TYPE_PASSPHRASE (2), in which case the passphrase is provided as a string and will be hashed using the de-facto MD5 method to derive the actual WEP key.")
diff --git a/libnm-core/nm-setting-wireless-security.c b/libnm-core/nm-setting-wireless-security.c
index c38d21ff10..65b55db351 100644
--- a/libnm-core/nm-setting-wireless-security.c
+++ b/libnm-core/nm-setting-wireless-security.c
@@ -863,6 +863,15 @@ need_secrets (NMSetting *setting)
goto no_secrets;
}
+ /* SAE, used in MESH and WPA3-Personal */
+ if (strcmp (priv->key_mgmt, "sae") == 0) {
+ if (!priv->psk || !*priv->psk) {
+ g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_PSK);
+ return secrets;
+ }
+ goto no_secrets;
+ }
+
/* LEAP */
if ( priv->auth_alg
&& !strcmp (priv->auth_alg, "leap")
@@ -894,7 +903,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
{
NMSettingWirelessSecurity *self = NM_SETTING_WIRELESS_SECURITY (setting);
NMSettingWirelessSecurityPrivate *priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (self);
- const char *valid_key_mgmt[] = { "none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", NULL };
+ const char *valid_key_mgmt[] = { "none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", "sae", NULL };
const char *valid_auth_algs[] = { "open", "shared", "leap", NULL };
const char *valid_protos[] = { "wpa", "rsn", NULL };
const char *valid_pairwise[] = { "tkip", "ccmp", NULL };
@@ -1072,14 +1081,12 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
if ( NM_IN_SET (priv->pmf,
NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL,
NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED)
- && !NM_IN_STRSET (priv->key_mgmt, "wpa-eap", "wpa-psk")) {
+ && !NM_IN_STRSET (priv->key_mgmt, "wpa-eap", "wpa-psk", "sae")) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("'%s' can only be used with '%s=%s' or '%s=%s'"),
- priv->pmf == NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL ? "optional" : "required",
- NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap",
- NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk");
+ _("'%s' can only be used with 'wpa-eap', 'wpa-psk' or 'sae' key management "),
+ priv->pmf == NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL ? "optional" : "required");
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PMF);
return FALSE;
}
@@ -1139,7 +1146,9 @@ verify_secrets (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
/* WPA-PSK */
- if (priv->psk && !nm_utils_wpa_psk_valid (priv->psk)) {
+ if ( priv->psk
+ && strcmp (priv->key_mgmt, "sae") != 0
+ && !nm_utils_wpa_psk_valid (priv->psk)) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -1447,8 +1456,8 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *klass)
*
* Key management used for the connection. One of "none" (WEP), "ieee8021x"
* (Dynamic WEP), "wpa-none" (Ad-Hoc WPA-PSK), "wpa-psk" (infrastructure
- * WPA-PSK), or "wpa-eap" (WPA-Enterprise). This property must be set for
- * any Wi-Fi connection that uses security.
+ * WPA-PSK), "sae" (SAE) or "wpa-eap" (WPA-Enterprise).
+ * This property must be set for any Wi-Fi connection that uses security.
**/
/* ---ifcfg-rh---
* property: key-mgmt
@@ -1722,12 +1731,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *klass)
/**
* NMSettingWirelessSecurity:psk:
*
- * Pre-Shared-Key for WPA networks. If the key is 64-characters long, it
- * must contain only hexadecimal characters and is interpreted as a
- * hexadecimal WPA key. Otherwise, the key must be between 8 and 63 ASCII
- * characters (as specified in the 802.11i standard) and is interpreted as a
- * WPA passphrase, and is hashed to derive the actual WPA-PSK used when
- * connecting to the Wi-Fi network.
+ * Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII
+ * passphrase of 8 to 63 characters that is (as specified in the 802.11i
+ * standard) hashed to derive the actual key, or the key in form of 64
+ * hexadecimal character. The WPA3-Personal networks use a passphrase
+ * of any length for SAE authentication.
**/
/* ---ifcfg-rh---
* property: psk