Commit graph

382 commits

Author SHA1 Message Date
Thomas Haller be813707f0 device: make the MTU globally configurable via connection-defaults
This allows a user to restore the previous behavior where NetworkManager
would not reconfigure the MTU during device activation, if no MTU is
available (commit "22e8af6 device: set a per-device default MTU on
activation").

Well, not exactly. The previous behavior was to use per-connection
configuration, then DHCP provided value, or finally leave the MTU
unspecified.
Now, we prefer a per-connection configuration, followed by a global
connection default. If "ethernet.mtu=0", the MTU is left unspecified.
In absense of a global connection default, the value from DHCP is used
or finally a per-device-type default. That is effectively 1500 for most
types, except for infiniband where the MTU is still left unspecified.
2017-01-17 13:43:50 +01:00
Francesco Giudici 71e172e080 man: minor fix to nmcli.xml 2017-01-09 18:40:21 +01:00
Thomas Haller f0d40525df device: support dynamic "connection.stable-id" in form of text-substitution
Usecase: when connecting to a public Wi-Fi with MAC address randomization
("wifi.cloned-mac-address=random") you get on every re-connect a new
IP address due to the changing MAC address.
"wifi.cloned-mac-address=stable" is the solution for that. But that
means, every time when reconnecting to this network, the same ID will
be reused. We want an ID that is stable for a while, but at a later
point a new ID should e generated when revisiting the Wi-Fi network.

Extend the stable-id to become dynamic and support templates/substitutions.
Currently supported is "${CONNECTION}", "${BOOT}" and "${RANDOM}".
Any unrecognized pattern is treated verbaim/untranslated.

"$$" is treated special to allow escaping the '$' character. This allows
the user to still embed verbatim '$' characters with the guarantee that
future versions of NetworkManager will still generate the same ID.
Of course, a user could just avoid '$' in the stable-id unless using
it for dynamic substitutions.

Later we might want to add more recognized substitutions. For example, it
could be useful to generate new IDs based on the current time. The ${} syntax
is extendable to support arguments like "${PERIODIC:weekly}".

Also allow "connection.stable-id" to be set as global default value.
Previously that made no sense because the stable-id was static
and is anyway strongly tied to the identity of the connection profile.
Now, with dynamic stable-ids it gets much more useful to specify
a global default.

Note that pre-existing stable-ids don't change and still generate
the same addresses -- unless they contain one of the new ${} patterns.
2017-01-09 14:50:33 +01:00
Jiří Klimeš 645ec95f30 man: replace libnm-util reference with libnm-core in nm-settings page 2016-12-15 15:36:57 +01:00
Jiří Klimeš 112a6bff13 man: add unsupported settings to the list in nm-settings-ifcfg-rh page 2016-12-15 15:20:19 +01:00
Thomas Haller afcfa7be2b config/trivial: unify name of compile time config defaults 2016-11-25 18:02:38 +01:00
Thomas Haller ce28e6ab30 man: clarify dns=default setting in NetworkManager.conf manual
https://bugzilla.gnome.org/show_bug.cgi?id=774399
2016-11-14 12:34:28 +01:00
Lubomir Rintel 7b589e2b72 man: use <filename> to mark file names
This gives the templates a chance to do something extra clever with the
formatting. The templates, of course, choose not to :(
2016-11-11 14:42:27 +01:00
Lubomir Rintel 42e1e669bc man: link to some online resources 2016-11-11 14:42:27 +01:00
Lubomir Rintel 063d714a3c man: get rid of the extra capitalization in docbook source
The temaplates capitalize the names if they wish.
2016-11-11 14:42:26 +01:00
Lubomir Rintel bcad38ac31 man: use /run instead of /var/run
/var/run is just a compatibility symlink, according to file-hierarchy(7).
2016-11-03 17:56:13 +01:00
Thomas Haller 207c855348 man: clarify behavior of "ip4"/"ip6" alias to nmcli 2016-11-02 18:31:12 +01:00
Thomas Haller e9bf87805c dhcp: make default dhcp plugin configurable at compile-time 2016-10-27 11:28:01 +02:00
Thomas Haller a5e3016fc9 man: document /var/run/NetworkManager/conf.d directory 2016-10-23 13:33:09 +02:00
Thomas Haller 2296db22c8 build: merge "man/Makefile.am" into toplevel Makefile 2016-10-21 17:37:57 +02:00
Beniamino Galvani a67bdbc331 core: handle the autoconnect-retries property 2016-10-16 12:56:09 +02:00
Thomas Haller 132234bb79 cli: support qualifying proxy.pac-script with "file://" or "js://" 2016-10-04 11:44:44 +02:00
Thomas Haller c1a4c084b0 cli: support explicitly selecting team-config as file or json data
nmcli has a heuristic when setting the team-config to accepting both
a filename or the plain json text.

Add support for two schemes "file://" and "json://" to explicitly
determine whether to read from file or from json.

Also, no longer silently ignore an all-whitespace word. That is an
error (unless you have a file named " ").

Also, no longer replace newlines with space. Don't mangle the input
text at all.
2016-09-27 10:59:47 +02:00
Beniamino Galvani 58349c3885 man: NetworkManager.conf: better document dns=dnsmasq
It's potentially unexpected by user that dnsmasq works differently
from the libc resolver and doesn't try the servers in order. Add a
paragraph to explain that and how to tweak the resolution order.
2016-09-20 15:32:37 +02:00
Thomas Haller fae5ecec5a device: change default value for cloned-mac-address to "preserve" (bgo#770611)
Long ago before commit 1b49f94, NetworkManager did not touch the
MAC address at all. Since 0.8.2 NetworkManager would modify the
MAC address, and eventually it would reset the permanent MAC address
of the device.

This prevents a user from externally setting the MAC address via tools
like macchanger and rely on NetworkManager not to reset it to the
permanent MAC address. This is considered a security regression in
bgo#708820.

This only changed with commit 9a354cd and 1.4.0. Since then it is possible
to configure "cloned-mac-address=preserve", which instead uses the "initial"
MAC address when the device activates.
That also changed that the "initial" MAC address is the address which was
externally configured on the device as last. In other words, the
"initial" MAC address is picked up from external changes, unless it
was NetworkManager itself who configured the address when activating a
connection.

However, in absence of an explicit configuration the default for
"cloned-mac-address" is still "permanent". Meaning, the user has to
explicitly configure that NetworkManager should not touch the MAC address.
It makes sense to change the upstream default to "preserve". Although this
is a change in behavior since 0.8.2, it seems a better default.

This change has the drastic effect that all the existing connections
out there with "cloned-mac-address=$(nil)" change behavior after upgrade.
I think most users won't notice, because their devices have the permanent
address set by default anyway. I would think that there are few users
who intentionally configured "cloned-mac-address=" to have NetworkManager
restore the permanent address.

https://bugzilla.gnome.org/show_bug.cgi?id=770611
2016-09-12 14:01:57 +02:00
Beniamino Galvani 3719816c7f man: document dns=systemd-resolved 2016-09-08 12:51:22 +02:00
Thomas Haller e284651f4c man: fix wording in NetworkManager.conf for "rc-manager" 2016-09-02 17:04:37 +02:00
Thomas Haller 9aee7b493e doc: add comment to systemd's NetworkManager.service about ibft requiring CAP_SYS_ADMIN
We don't want to enable this upstream, but make the requirement
more discoverable by documenting it and put a comment to
NetworkManager.service.

https://bugzilla.redhat.com/show_bug.cgi?id=1371201
2016-09-02 15:39:08 +02:00
Beniamino Galvani f87ca31341 man: NetworkManager.conf: fix link syntax
Fixes: c7cee12189
2016-08-26 20:53:28 +02:00
Thomas Haller 6fb2a24f3a man: fix reference in NetworkManager.conf
Without this, it reads:
  See the section called “Sections” for details.
but there are multiple sections called “Sections” and it should
explicitly refer to the one from the other top-level section.

With this change, it reads:
  See “Sections” under the section called “CONNECTION SECTION” for details.
2016-08-26 14:58:20 +02:00
Lubomir Rintel 53fb00d5f7 man: document completion 2016-08-01 13:52:36 +02:00
Lubomir Rintel d73c0e57d5 cli: add ability to indicate command completion expects a file name 2016-08-01 13:52:36 +02:00
Mario Sanchez Prada 3359368f28 man: Added documentation for the connectivity-change dispatcher hook
Also added documentation for the new CONNECTIVITY_STATE environment
variable, that will also be avaiblable in those hooks.

https://bugzilla.gnome.org/show_bug.cgi?id=768969
2016-07-28 22:22:14 +02:00
Jiří Klimeš 58f7319043 man: additional fixes for nmcli commands syntax in nmcli.xml 2016-07-19 10:41:04 +02:00
Jiří Klimeš 77cb0e370e man: fix 'domain' to 'domains' for nmcli general logging 2016-07-15 12:26:24 +02:00
Jiří Klimeš 624a28504e man: fix 'nmcli connection edit' description in nmcli.xml 2016-07-15 12:26:24 +02:00
Jiří Klimeš f99282d2f5 man: fix 'nmcli connection clone' description in nmcli.xml 2016-07-15 12:26:24 +02:00
Jiří Klimeš 6c71fd588f man: correct '--field' option in nmcli man page 2016-07-15 12:26:24 +02:00
Jiří Klimeš 250662a5d8 man: correct '--wait' option in nmcli man page 2016-07-15 12:26:24 +02:00
Jiří Klimeš dfa26f2227 man: fix bridge-port properties description in nmcli.xml 2016-07-15 12:26:24 +02:00
Jiří Klimeš e15645a4d0 man: add missing commands to 'nmcli connection' synopsis in nmcli.xml 2016-07-15 12:26:24 +02:00
Jiří Klimeš c875471430 nmcli: fix 'nmcli device modify' description
Fixes: 8b4494598d
2016-07-15 12:26:24 +02:00
Thomas Haller ede6ddf58f man: improve NetworkManager.conf manual fo "wifi.scan-rand-mac-address" 2016-06-30 09:22:12 +02:00
Thomas Haller 96cabbcbb8 all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.

Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.

By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.

By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.

One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.

One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.

To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.

With this, the following macchanger options can be implemented:

  `macchanger --random`
   This is the default if no mask is configured.
   -> ""
   while is the same as:
   -> "00:00:00:00:00:00"
   -> "02:00:00:00:00:00 02:00:00:00:00:00"

  `macchanger --random --bia`
   -> "02:00:00:00:00:00 00:00:00:00:00:00"

  `macchanger --ending`
   This option cannot be fully implemented, because macchanger
   uses the current MAC address but also implies --bia.
   -> "FF:FF:FF:00:00:00"
      This would yields the same result only if the current MAC address
      is already a burned-in address too. Otherwise, it has not the same
      effect as --ending.
   -> "FF:FF:FF:00:00:00 <MAC_ADDR>"
      Alternatively, instead of using the current MAC address,
      spell the OUI part out. But again, that is not really the
      same as macchanger does because you explictly have to name
      the OUI part to use.

  `machanger --another`
  `machanger --another_any`
  -> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
     "$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-30 08:32:50 +02:00
Thomas Haller 7b585bcc93 wifi: make MAC address randomization during scanning configurable
This allows the user to disable MAC address randomization during
scanning for Wi-Fi networks, which is done by default.

For one, this allows the user to disable the randomization for whatever
reason.

Also, together with configuring the per-connection setting
wifi.cloned-mac-address=preserve, this allows to disable NetworkManager
to modify the MAC address of the interface. This may allow the user
to set the MAC address outside of NetworkManager without NetworkManager
interfering.
2016-06-30 08:29:56 +02:00
Thomas Haller 767abfa690 wifi: implement MAC address randomization in NetworkManager instead of supplicant
'wireless.mac-address-randomization' broke 'wireless.cloned-mac-address',
because we would always set 'PreassocMacAddr=1'. The reason is that
supplicant would set 'wpa_s->mac_addr_changed' during scanning, and
later during association it would either set a random MAC address or
reset the permanent MAC address [1].

Anyway, 'wireless.mac-address-randomization' conflicts with
'wireless.cloned-mac-address'. Instead of letting supplicant set the
MAC address, manage the MAC addresses entirely from NetworkManager.
Supplicant should not touch it.

[1] https://w1.fi/cgit/hostap/tree/wpa_supplicant/wpa_supplicant.c?id=f885b8e97cf39b56fe7ca6577890f2d20df7ae08#n1663
2016-06-30 08:29:56 +02:00
Thomas Haller 8eed67122c device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.

"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.

"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a6.

"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".

On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.

There is some overlap with the "wifi.mac-address-randomization" setting.

https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-06-30 08:29:56 +02:00
Thomas Haller eb3247c097 core: fix comparing nm_setting_wired_get_mac_address() with permanent MAC address
`man nm-settings` says about ethernet.mac-address:

  If specified, this connection will only apply to the Ethernet device
  whose permanent MAC address matches.
2016-06-30 08:29:55 +02:00
Thomas Haller 481cdc2706 device: let device specs match on permanent MAC address
Using the current, possibly non-permanent MAC address doesn't really
make sense.

Also, NM_DEVICE_HW_ADDRESS used to be writable and was set by NMDeviceBt
to the bdaddr. That is wrong, because bdaddr should not be the current
address, but the permanent one.
2016-06-30 08:29:55 +02:00
Thomas Haller c7cee12189 config: make "ignore-carrier" a per-device configuration option
NetworkManager.conf already contains several per-device settings,
that is, settings that have a device-spec as argument.

   main.ignore-carrier
   main.no-auto-default
   main.assume-ipv6ll-only
   keyfile.unmanged-devices

Optimally, these settings should be moved to the new [device*]
section.

For now, only move main.ignore-carrier there. For the others
it may not make sense to do so:

- main.no-auto-default: is already merged with internal state
  from /var/lib/NetworkManager/no-auto-default.state. While
  NMConfig's write API would be fine to also persist and merge
  the no-auto-default setting, we'd still have to read the old
  file too. Thus, deprecating this setting gets quite cumbersome
  to still handle the old state file.
  Also, it seems a less useful setting to configure in the
  global configuration aside setting main.no-auto-default=*.

- main.assume-ipv6ll-only: one day, I hope that we no longer
  assume connections at all, and this setting becomes entirely
  obsolete.

- keyfile.unmanged-devices: this sets NM_UNMANAGED_USER_SETTINGS,
  which cannot be overruled via D-Bus. For a future device.managed
  setting we want it it to be overwritable via D-Bus by an explicit
  user action. Thus, a device.managed property should have a different
  semantic, this should be more like a device.unmanaged-force setting,
  which could be done.
2016-06-30 08:27:17 +02:00
Thomas Haller 3cda2df12b config: add support for per-device configuration to NetworkManager.conf
Add a new [device*] section to NetworkManager.conf. This works similar
like the default connection settings in [connection*].

This will allow us to express per-device configuration in NetworkManager.conf
in our familar style.

Later, via NMConfig's write API it will be possible to make settings
accessible via D-Bus and persist them in NetworkManager-intern.conf.
This way, the user can both edit configuration snippets and modify
them via D-Bus, and also support installing default configuration
from the package.

In a way, a [device*] setting is similar to networkd's link files.
The match options is all encoded in the match-device specs.
One difference is, that the resulting setting can be merged together
by multiple section by partially overwriting them. This makes it
more flexible and allows for example to drop a configuration snippet
that only sets one property, while the rest can be merged from different
snippets.
2016-06-30 08:07:35 +02:00
Lubomir Rintel 8b4494598d cli/device: add modify command
It modifies the applied connection using the Reapply API.
2016-06-29 20:28:42 +02:00
Lubomir Rintel c3422e917d man: update the nmcli manual for new connection add syntax
It allows us to clean up the nmcli "c add" section considerably.

We list the old-fashioned aliases in a separate section that applies to both
"nmcli c add" and "nmcli c modify".

The section is now nicely cross-linked with nm-settings in HTML
rendering.
2016-06-21 18:40:22 +02:00
Lubomir Rintel 057d477b2a man: turn the manual page cross-references into links
This improves the HTML rendering.

But it also causes a lot of non-resolvable linkends warning when rendering a
separate manual pages into roff/mman. The messages are harmless, but still
a bit ugly.
2016-06-21 18:40:13 +02:00
Thomas Haller 4143fbde17 logging: enable logging domain VPN_PLUGIN up to level <info>
The logging domain VPN_PLUGIN controlls logging of the VPN plugins.
Especially at verbose levels <debug> and <trace>, the plugins might
reveal sensitive information in the logging.

Thus, this level should not be enabled by a

  $ nmcli logging general level DEBUG domains ALL

It should only be enabled when requested explicitly.

  $ nmcli logging general level DEBUG domains ALL,VPN_PLUGIN:DEBUG

Previously, the special level VPN_PLUGIN was entirely excluded from
ALL and DEFAULT domains and it was entirely disabled by default. That
is however to strict, as it completely silences the VPN plugins by
defult. Now, enable them by default up to level INFO.

VPN plugins should take care that they don't reveal sensitive
information at levels <info> (LOG_NOTICE) and higher (less verbose).
For more verbose levels they may print passwords, but that should
still be avoided as far as possible.
2016-06-17 08:19:44 +02:00