From 9fde21504e782b81cdd4c5d1f5068e33e532078e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 27 May 2020 11:43:02 +0200 Subject: libnm,ifcfg-rh: fix documentation for IEEE_8021X_PASSWORD_RAW_FLAGS in `man nm-settings-ifcfg-rh` Fixes: a83ab252ee58 ('ifcfg-rh: add support for 802-1x.password-raw property') --- libnm-core/nm-setting-8021x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnm-core/nm-setting-8021x.c b/libnm-core/nm-setting-8021x.c index 0d614d4fa1..34a71bdd4b 100644 --- a/libnm-core/nm-setting-8021x.c +++ b/libnm-core/nm-setting-8021x.c @@ -4280,8 +4280,8 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *klass) **/ /* ---ifcfg-rh--- * property: password-raw-flags - * variable: (none) - * description: The property is not handled by ifcfg-rh plugin. + * variable: IEEE_8021X_PASSWORD_RAW_FLAGS(+) + * description: The secret flags for password-raw. * ---end--- */ obj_properties[PROP_PASSWORD_RAW_FLAGS] = -- cgit v1.2.1 From b4537f2c03dbb433ecdec81c84f95f8e9f8727b3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 27 May 2020 11:59:19 +0200 Subject: libnm,ifcfg-rh: fix documentation for IEEE_8021X_SYSTEM_CA_CERTS in `man nm-settings-ifcfg-rh` Fixes: 2a4fb75d3b03 ('ifcfg: add support for "802-1x.system-ca-certs" setting') --- libnm-core/nm-setting-8021x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnm-core/nm-setting-8021x.c b/libnm-core/nm-setting-8021x.c index 34a71bdd4b..d3784e204d 100644 --- a/libnm-core/nm-setting-8021x.c +++ b/libnm-core/nm-setting-8021x.c @@ -4513,8 +4513,8 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *klass) **/ /* ---ifcfg-rh--- * property: system-ca-certs - * variable: (none) - * description: The property is not handled by ifcfg-rh plugin. + * variable: IEEE_8021X_SYSTEM_CA_CERTS(+) + * description: a boolean value. * ---end--- */ obj_properties[PROP_SYSTEM_CA_CERTS] = -- cgit v1.2.1 From 655fd1ebd8c1f14dc658f728109bc41e9362d740 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 27 May 2020 12:14:26 +0200 Subject: ifcfg-rh: support persisting 802-1x.pin and pin-flags property --- Makefile.am | 1 + libnm-core/nm-setting-8021x.c | 8 ++++---- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 6 ++++++ src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c | 2 ++ src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h | 2 +- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 7 +++++++ .../tests/network-scripts/ifcfg-test-wired-802-1x-password-raw | 2 ++ .../tests/network-scripts/keys-test-wired-802-1x-password-raw | 1 + src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 3 +++ 9 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw diff --git a/Makefile.am b/Makefile.am index f1a06dbf33..98c81ef4d8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3245,6 +3245,7 @@ EXTRA_DIST += \ src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-hex \ src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted \ src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted2 \ + src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw \ src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-8021x-peap-mschapv2 \ src/settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-defroute-no-gatewaydev-yes \ src/settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway \ diff --git a/libnm-core/nm-setting-8021x.c b/libnm-core/nm-setting-8021x.c index d3784e204d..f6dbda6341 100644 --- a/libnm-core/nm-setting-8021x.c +++ b/libnm-core/nm-setting-8021x.c @@ -4469,8 +4469,8 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *klass) **/ /* ---ifcfg-rh--- * property: pin - * variable: (none) - * description: The property is not handled by ifcfg-rh plugin. + * variable: IEEE_8021X_PIN(+) + * description: The pin secret used for EAP authentication methods. * ---end--- */ obj_properties[PROP_PIN] = @@ -4487,8 +4487,8 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *klass) **/ /* ---ifcfg-rh--- * property: pin-flags - * variable: (none) - * description: The property is not handled by ifcfg-rh plugin. + * variable: IEEE_8021X_PIN_FLAGS(+) + * description: The secret flags for the pin property. * ---end--- */ obj_properties[PROP_PIN_FLAGS] = diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index 26e88b79d2..4fee95c406 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -3713,6 +3713,12 @@ next: svGetValueBoolean (ifcfg, "IEEE_8021X_OPTIONAL", FALSE), NULL); + _secret_set_from_ifcfg (s_8021x, + ifcfg, + keys_ifcfg, + "IEEE_8021X_PIN", + NM_SETTING_802_1X_PIN); + return g_steal_pointer (&s_8021x); } diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c index c0a51bd33d..188ae14527 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c @@ -927,6 +927,8 @@ const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = { _KEY_TYPE ("IEEE_8021X_PHASE2_DOMAIN_MATCH", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), _KEY_TYPE ("IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), _KEY_TYPE ("IEEE_8021X_PHASE2_SUBJECT_MATCH", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), + _KEY_TYPE ("IEEE_8021X_PIN", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), + _KEY_TYPE ("IEEE_8021X_PIN_FLAGS", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), _KEY_TYPE ("IEEE_8021X_PRIVATE_KEY", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), _KEY_TYPE ("IEEE_8021X_PRIVATE_KEY_PASSWORD", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), _KEY_TYPE ("IEEE_8021X_PRIVATE_KEY_PASSWORD_FLAGS", NMS_IFCFG_KEY_TYPE_IS_PLAIN ), diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h index 83b2d74e19..50b07d4a5d 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h @@ -33,7 +33,7 @@ typedef struct { NMSIfcfgKeyTypeFlags key_flags; } NMSIfcfgKeyTypeInfo; -extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[237]; +extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[239]; const NMSIfcfgKeyTypeInfo *nms_ifcfg_well_known_key_find_info (const char *key, gssize *out_idx); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 9f7344e619..4f5d038d19 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -520,6 +520,13 @@ write_8021x_setting (NMConnection *connection, svSetValue (ifcfg, "IEEE_8021X_PHASE2_CA_PATH", nm_setting_802_1x_get_phase2_ca_path (s_8021x)); + set_secret (ifcfg, + secrets, + "IEEE_8021X_PIN", + nm_setting_802_1x_get_pin (s_8021x), + "IEEE_8021X_PIN_FLAGS", + nm_setting_802_1x_get_pin_flags (s_8021x)); + if (!write_8021x_certs (s_8021x, secrets, blobs, FALSE, ifcfg, error)) return FALSE; diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw index 181ffbef81..a5434434ba 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw @@ -11,3 +11,5 @@ IEEE_8021X_IDENTITY="Bill Smith" IEEE_8021X_CA_CERT=test_ca_cert.pem IEEE_8021X_INNER_AUTH_METHODS=EAP-GTC IEEE_8021X_PASSWORD_RAW=0408151623420001 +#IEEE_8021X_PIN=hallo1 +IEEE_8021X_PIN_FLAGS=0 diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw b/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw new file mode 100644 index 0000000000..d29a428976 --- /dev/null +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw @@ -0,0 +1 @@ +IEEE_8021X_PIN=hallo2 diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index a028d5281f..a5025f3b93 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -2037,6 +2037,9 @@ test_read_write_802_1x_password_raw (void) ==, NM_SETTING_SECRET_FLAG_NONE); + g_assert_cmpstr (nm_setting_802_1x_get_pin (s_8021x), ==, "hallo2"); + g_assert_cmpint (nm_setting_802_1x_get_pin_flags (s_8021x), ==, NM_SETTING_SECRET_FLAG_NONE); + _writer_new_connection (connection, TEST_SCRATCH_DIR, &testfile); -- cgit v1.2.1