Commit graph

28255 commits

Author SHA1 Message Date
Jonas Dreßler
2bc3cf0cb8
supplicant/config: Disallow SHA1 ciphers when using required PMF
As mentioned in the wpa_supplicant reference config, when setting PMF to
required with WPA2 (personal or enterprise) authentication, we want to
only enable SHA256 and upwards as HMAC. So enforce that by not passing
WPA-PSK and WPA-EAP to the config in case pmf is set to REQUIRED.
2021-05-06 22:23:28 +02:00
Jonas Dreßler
a4b95a9fcd
libnm-core: Don't allow disabling PMF when using WPA3 key management
Modern WPA3 authentication methods like SAE and WPA-EAP-SUITE-B-192 need
to have management frame protection set to required according to the
standard. Since the last commit, we enforce this automatically when
key-mgmt is set to 'owe', 'sae' or 'wpa-eap-suite-b-192', so disabling
it manually should not be possible.

Add a check to the pmf property that makes sure it can't be set to
'disabled' or 'optional' when one of those key-mgmt methods is used.
2021-05-06 22:23:28 +02:00
Jonas Dreßler
8816cfe736
supplicant/config: Require pmf for owe, sae and wpa-eap-suite-b-192
When using modern WPA3 encryption like owe, sae or wpa-eap-suite-b-192
without fallbacks (so not WPA3+WPA2), protected management frames are
required to be enabled by the specification.

For wpa-eap-suite-b-192 we already do this and force PMF to REQUIRED, we
should also do it for OWE and SAE.
2021-05-06 22:23:28 +02:00
Jonas Dreßler
e06f9508d1
libnm-core: Rewrite comment of key-mgmt property
The key-mgmt property of NMSettingWirelessSecurity is slightly confusing
when you know there's also a wpa_supplicant configuration option called
"key_mgmt". Our property is not the same as that supplicant option even
though they do have things in common. NMs key-mgmt is not exactly meant
to configure which AKM suites you want to use, but rather which method
of wifi security is being used (so "wpa2+wpa3 personal", "wpa3 personal
only" or "wpa3 enterprise only").

Try to make this a bit clearer in the documentation of the property by
rewriting it and listing those security methods.
2021-05-06 22:23:28 +02:00
Jonas Dreßler
5f146b40f3
supplicant/config: Refactor key_mgmt config generation
Refactor the generation of the key_mgmt option of the wpa_supplicant
config we generate. The goal of this is to lay out all the cases we
support more obviously and to make it a bit clearer that our key-mgmt
property of NMSettingsWirelessSecurity is not the same as the "key_mgmt"
config we set in wpa_supplicant.
2021-05-06 22:23:28 +02:00
Thomas Haller
a6cf94cfc4
strbuf: drop nm_str_buf_append_c[24]() for nm_str_buf_append_c() 2021-05-06 13:18:56 +02:00
Thomas Haller
94ce36f816
strbuf: make nm_str_buf_append_c() a variadic macro
We already have nm_str_buf_append_c2() and nm_str_buf_append_c4()
to support 2 or 4 characters.

I'd like to also have one for 3 characters.

At this point, just make it a variadic macro. This now supports 1 up to
4 characters, and it will be easy to extend further.
2021-05-06 13:18:19 +02:00
Thomas Haller
cc40eba9aa
firewall: merge branch 'th/firewalld-manager-rename'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/839
2021-05-06 12:24:40 +02:00
Thomas Haller
b86545e7c0
firewall: rename NMFirewallManager to NMFirewalldManager
The file was already renamed. Now also rename the type and API.
2021-05-06 12:22:37 +02:00
Thomas Haller
8483c47d70
firewall: rename "nm-firewall-manager.[ch]" to "nm-firewalld-manager.[ch]"
We will add a general "firewall-manager", so rename the firewalld related
file. This commit only renames the file. The next commit will change the
symbol naming.
2021-05-06 12:22:37 +02:00
Thomas Haller
0bc5a2c76f
core: add "nm-device-utils.[ch]" with simple helper functions
"nm-device.c" is huge, and it does complicated things like handling the
state of the device and IP configuration.

It also contains simpler, individual functions, like converting enums to
strings. Let's move those trivial functions to a new module, so that the
remaining part is smaller.

"nm-device-utils.[ch]" should only contain simpler functions that have
no complex behavior or state.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/840
2021-05-06 12:19:44 +02:00
Thomas Haller
037a94e837
ppp: cleanup nm-ppp-manager-call to use const pointer and atomic operations
- Mark NMPPPOps variable as const. It really must not be modified.

- We cache the loaded symbols in a global variable. While this code
  is not used in a multi threaded situation, I think we should not
  add code that uses global variables that is not thread safe.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/837
2021-05-06 11:34:28 +02:00
Beniamino Galvani
f3821b27dd release: bump version to 1.31.4 (development) 2021-05-05 21:17:53 +02:00
Wen Liang
86dcb31ab3
build: replace ./tools/generate-docs-nm-property-infos.pl with python script
In order to have more structured settings in man page and make it more
manageable to generate the docbook, it is recommended to use python
script to replace `./tools/generate-docs-nm-property-infos.pl` (this
tool is used to parse the comment section starting with `---nmcli---`,
`---dbus---`, `---keyfile---`, `---ifcfg-rh---`).

Signed-off-by: Wen Liang <liangwen12year@gmail.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/824
2021-05-05 15:28:17 +02:00
Thomas Haller
8232c3473f
all: merge branch 'th/uuid'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/835
2021-05-04 15:53:08 +02:00
Thomas Haller
207cf3d5d4
libnm: normalize "connection.uuid"
For NetworkManager profiles, "connection.uuid" is the identifier of the
profile. It is supposed to be a UUID, however:

- the UUID was not ensured to be all-lower case. We should make sure
  that our UUIDs are in a consistent manner, so that users can rely
  on the format of the string.

- the UUID was never actually interpreted as a UUID. It only was some
  opaque string, that we use as identifier. We had nm_utils_is_uuid()
  which checks that the format is valid, however that did not fully
  validate the format, like it would accept "----7daf444dd78741a59e1ef1b3c8b1c0e8"
  and "549fac10a25f4bcc912d1ae688c2b4987daf444d" (40 hex characters).

Both invalid UUIDs and non-normalized UUID should be normalized. We
don't want to break existing profiles that use such UUIDs, thus we don't
outright reject them. Let's instead mangle them during
nm_connection_normalize().
2021-05-04 15:51:59 +02:00
Thomas Haller
5bd03fd9a3
libnm: use nm_uuid_is_valid_nmlegacy() to implement nm_utils_is_uuid() 2021-05-04 15:51:57 +02:00
Thomas Haller
ce65fc52a8
glib-aux: add nm_uuid_is_valid() helper 2021-05-04 15:51:55 +02:00
Thomas Haller
b12f116a02
glib-aux: add nm_uuid_is_valid_nmlegacy() helper 2021-05-04 15:51:53 +02:00
Thomas Haller
2fcabf5699
all: only include "libnm-glib-aux/nm-uuid.h" where needed
Don't let "nm-core-internal.h" (which is a very popular header itself)
drag in "nm-uuid.h".
2021-05-04 15:51:51 +02:00
Thomas Haller
414ce2236e
glib-aux: add NMUuidType enum for nm_uuid_generate_from_string()
Let's have an enum instead of plain "int" and #define.
2021-05-04 15:51:50 +02:00
Thomas Haller
995c78245e
glib-aux/trivial: rename NMUuid API 2021-05-04 15:51:49 +02:00
Thomas Haller
78297db721
libnm,glib-aux: move nm_utils_uuid_*() API to libnm-glib-aux 2021-05-04 15:51:47 +02:00
Thomas Haller
c5985db7cf
libnm,glib-aux: move nm_crypto_md5_hash() to "libnm-glib-aux"
This only uses glib's md5 code and has no dependency on our
crypto libraries (gnutls, nss).

Move it to "libnm-glib-aux" so it can be freely used.

Maybe it deserves a better name, but "nm-shared-utils.h" is a heap of
various utility functions, it's hard to name them well.
2021-05-04 15:51:46 +02:00
Thomas Haller
73cfc4097a
libnm,glib-aux: add and use nm_uuid_generate_random_str*() helpers 2021-05-04 15:51:45 +02:00
Thomas Haller
dd1a618745
libnm,glib-aux: move nm_utils_uuid_is_null() to "nm-uuid.h" 2021-05-04 15:51:45 +02:00
Thomas Haller
73b9883c6f
build: don't link libnm/libnm-core against libuuid
We use util-linux's libuuid for handling UUIDs. But UUIDs are
really a trivial thing, at least the portion that we use.

Reimplement the parse/unparse/generate_random() methods and drop
the dependency. Note that no other libraries from our dependency chain
was dragging in libuuid, so thereby we really get rid of the dependency.

We still require libuuid for building, because it is used by an example
program. Maybe that should be changed, to avoid the build dependency.
But that can be done at a later time.
2021-05-04 15:51:44 +02:00
Thomas Haller
7a15144f75
glib-aux: use nm_uuid_generate_random() helper 2021-05-04 15:51:43 +02:00
Thomas Haller
b4608b3ff7
glib-aux: add nm_uuid_generate_random() helper 2021-05-04 15:51:43 +02:00
Thomas Haller
42d67415b4
glib-aux: use nm_uuid_parse() helper 2021-05-04 15:51:42 +02:00
Thomas Haller
e7568e29b2
glib-aux: add nm_uuid_parse() helper 2021-05-04 15:51:42 +02:00
Thomas Haller
596bf4b91b
glib-aux: use nm_uuid_unparse() 2021-05-04 15:51:42 +02:00
Thomas Haller
cd45ad4acf
glib-aux: add nm_uuid_unparse() 2021-05-04 15:51:42 +02:00
Thomas Haller
daebb11af8
glib-aux: move NMUuid to "src/libnm-glib-aux/nm-uuid.h" 2021-05-04 15:51:41 +02:00
Thomas Haller
50add1c75a
glib-aux: add "nm-uuid.[ch]" sources 2021-05-04 15:51:41 +02:00
Thomas Haller
36d92182a8
libnm-core/tests: add test for connection.uuid of settings 2021-05-04 15:51:41 +02:00
Thomas Haller
05130b6e10
ifupdown: replace _str_has_prefix() by NM_STR_HAS_PREFIX() 2021-05-04 15:51:41 +02:00
Thomas Haller
901f0bdeb3
gitlab-ci: fix running Fedora 34 test by default
- the container that is also "pages_build" should always
  run automatically. This can replace the "always" tag.

- comment out the "always: 33" part, because we no longer need
  it. It was also wrong, because by now we should run Fedora 34
  automatically.
2021-05-04 15:42:26 +02:00
Thomas Haller
264db0695a
gitlab: merge branch 'th/gitlab-update-f34'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/838
2021-05-04 13:58:48 +02:00
Thomas Haller
ebde0a3506
gitlab: update pages build to use Fedora 34 container 2021-05-04 13:56:28 +02:00
Thomas Haller
fb2ea999ea
clang-format: update "nm-code-format-container.sh" script to use Fedora 34 container 2021-05-04 13:56:27 +02:00
Thomas Haller
21321ac736
clang-format: reformat code with clang 12
The format depends on the version of the tool. Now that Fedora 34 is
released, update to clang 12 (clang-tools-extra-12.0.0-0.3.rc1.fc34.x86_64).
2021-05-04 13:56:26 +02:00
Thomas Haller
b32dc4f2cf
gitlab: add Fedora 34 container for CI pipeline 2021-05-04 13:56:25 +02:00
Thomas Haller
94ba38962f
contrib: install clang-format via REQUIRED_PACKAGES
On Fedora 33, we get it automatically because "clang" package
has an indirect (weak) dependency for clang-tools-extra. On
Fedora 34, that is no loger the case.

We need to explicitly install it.
2021-05-04 13:56:19 +02:00
Beniamino Galvani
23cc0bf335 manager: fix assertion failure in active_connection_find()
Active-connections in the async_op_lst are not guaranteed to have a
settings-connection. In particular, the settings-connection for an
AddAndActivate() AC is set only after the authorization succeeds. Use
the non-asserting variant of the function to fix the following
failure:

 nm_active_connection_get_settings_connection: assertion 'sett_conn' failed

 1    _g_log_abort()
 2    g_logv()
 3    g_log()
 4    _nm_g_return_if_fail_warning.constprop.14()
 5    nm_active_connection_get_settings_connection()
 6    active_connection_find()
 7    _get_activatable_connections_filter()
 8    nm_settings_get_connections_clone()
 9    nm_manager_get_activatable_connections()
 10   auto_activate_device_cb()
 11   g_idle_dispatch()
 12   g_main_context_dispatch()
 13   g_main_context_iterate.isra.21()
 14   g_main_loop_run()
 15   main()

Fixes: 33b9fa3a3c ('manager: Keep volatile/external connections while referenced by async_op_lst')

https://bugzilla.redhat.com/show_bug.cgi?id=1933719
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/834
2021-05-04 08:48:29 +02:00
Thomas Haller
ad2226eacd
core/firewalld: use changeZoneOfInterface() instead of deprecated changeZone()
`man firewalld.dbus` comments that changeZone() is deprecated.
Apparently this is the case since 0.3.3-1 (2013).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/836
2021-05-04 08:26:42 +02:00
Beniamino Galvani
a3306d538c merge: branch 'bg/dns-update-on-sigusr1'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/832
2021-05-03 22:22:57 +02:00
Beniamino Galvani
a0aa727af2 nmcli: remove nmc_dbus_call_sync()
The function is unused now. All operations should be asynchronous so
that nmcli keeps running the main loop.
2021-05-03 22:22:01 +02:00
Beniamino Galvani
9d0aca6757 nmcli: invoke ReloadConnections() D-Bus method asynchronously 2021-05-03 22:22:01 +02:00
Beniamino Galvani
1d82c39bfa nmcli: invoke Reload() D-Bus method asynchronously
Invoke Reload() asynchronously and run the main loop. In this way, the
polkit agent built into nmcli can be used to authenticate the reload
request.

Fixes: 5afcf9c045 ('cli: add 'general reload' command')
2021-05-03 22:22:01 +02:00