Commit Graph
53953 Commits
Author SHA1 Message Date
Lennart Poettering c7bf079bbc homework: add new helper call that can shift home dir UID/GID ranges
This new helper is not used yet, but it's useful for apply UID/GID
shifts so that the underlying home dir can use an arbitrary UID (for
example "nobody") and we'll still make it appear as owned by the target
UID.

This operates roughly like this:

1. The relevant underlying UID is mapped to the target UID
2. Everything in the homed UID range except for the target UID is left
   unmapped (and thus will appear as "nobody")
3. Everything in the 16bit UID range outside of the homed UID
   range/target UID/nobody user is mapped to itself
4. Everything else is left unmapped (in particular everything outside of
   the 16 bit range).

Why do it like this?

The 2nd rule done to ensure that any files from homed's managed UID
range that do not match the user's own UID will be shown as "unmapped"
basically. Of course, IRL this should never happen, except if people
managed to manipulate the underlying fs directly.

The 3rd rule is to allow that if devs untar an OS image it more or
less just works as before: 16bit UIDs outside of the homed range will
be mapped onto themselves: you can untar things and tar it back up and
things will just work.
2021-10-27 17:37:14 +02:00
Lennart Poettering 2ba38f78c3 homework: rework directory backend to set up mounts in /run/systemd/user-home-mount before moving them to /home
This does what we already do for the LUKS backend: instead of mounting
the source directory directly to the final home dir, we instead bind
mount it to /run/systemd/user-home-mount (where /run/ is unshared and
specific to our own mount namespace), then adjust its mount flags and
then bind mount it in a single atomic operation into the final
destination, fully set up.

This doesn't improve much on its own, but it makes things a tiny bit
more correct: this way MS_NODEV/MS_NOEXEC/MS_NOSUID will already be
applied when the bind mount appears in the host mount namespace, instead
of being adjusted after the fact.

Doing things this way also makes things work more like the LUKS backend,
reducing surprises. Most importantly it's preparation for doing
uidmapping for directory homes, added in a later commit.
2021-10-27 17:37:14 +02:00
Lennart Poettering cfef46f5fe homework: when activating a directory, include info about it in resulting record
For the other backends we synthesize a "binding" section in the json
record of the user that stores meta info how a user record is "bound" to
the local host. It declares storage info and such. Let's do the same for
the directory/subvolume backends.
2021-10-27 17:37:14 +02:00
Lennart Poettering e1aeaf27f5 homework: port home_create_directory_or_subvolume() to use HomeSetup
Let's migrate home_create_directory_or_subvolume() to also use HomeSetup
for storing its runtime objects we'd like to destroy in case of failure.

In the beginning this is just the root_fd, but later on we can add more.

No change in behaviour, just shifting things around.
2021-10-27 17:37:14 +02:00
Lennart Poettering f509ed4b61 homed: move HOME_UID_{MIN,MAX} into a header we can reuse in homework.c 2021-10-27 17:37:14 +02:00
Yu Watanabe eef5ebec97 Merge pull request #21143 from yuwata/sd-radv-router-lifetime
sd-radv: several cleanups for router lifetime
2021-10-27 22:14:35 +09:00
Lennart Poettering 6663b509d8 bootctl: refuse parsing unknown special '@' entry ids
Let's make sure '@' is never written as entry ID into any EFI variable,
as we want the ability to add new ids like this later on, with them
resulting in a clear error on older implementations.
2021-10-27 22:12:07 +09:00
Zbigniew Jędrzejewski-Szmek 3c15860e9e Merge pull request #21147 from DaanDeMeyer/hacking-docs
docs: Clean up HACKING.md
2021-10-27 14:09:46 +02:00
Daan De Meyer b2c9da052a docs: Specify code block language for mkosi boot instructions 2021-10-27 12:27:16 +01:00
Daan De Meyer 4c71f971c1 docs: Make mkosi install instructions generic 2021-10-27 12:27:16 +01:00
Daan De Meyer b43ed972e0 docs: Extend builddep instructions to include more distros 2021-10-27 12:27:14 +01:00
Yu Watanabe 1ad83d9500 Merge pull request #21144 from yuwata/sd-radv-trivial-cleanups
sd-radv: trivial cleanups
2021-10-27 19:52:57 +09:00
Yu Watanabe 8524db5021 conf-parse: make config_parse_many() optionally save 'struct stat' for each file
Fixes #21113.
2021-10-27 19:49:55 +09:00
Luca Boccassi f3f1172cf6 docs/COREDUMP_PACKAGE_METADATA: ELF section should be allocated and 0-padded 2021-10-27 12:29:31 +02:00
Yu Watanabe 4f1ac4a38d network: radv: refuse invalid router lifetime in conf parser 2021-10-27 19:29:05 +09:00
Yu Watanabe 804775577d sd-radv: update how to calculate interval of sending advertisements 2021-10-27 19:27:23 +09:00
Yu Watanabe 0945767012 sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
See RFC 4861 section 6.2.1.
2021-10-27 19:27:07 +09:00
Daan De Meyer 390a307665 docs: Remove mkosi symlink instruction from HACKING
mkosi automatically builds for the host distro which seems a much
better default to encourage since dnf won't be installed on any host
system that's not Fedora anyway.
2021-10-27 11:10:52 +01:00
Daan De Meyer ff7c07fb08 docs: Simplify git instructions in HACKING slightly 2021-10-27 11:10:52 +01:00
Daan De Meyer 540804827a docs: Clean up links in HACKING.md 2021-10-27 11:10:50 +01:00
Yu Watanabe 72db0a714b sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC 2021-10-27 19:05:55 +09:00
Yu Watanabe e786c2e50f sd-radv: add several notes about constants 2021-10-27 19:03:58 +09:00
Yu Watanabe 03ec10fdf4 sd-radv: make several constants not exposed 2021-10-27 19:03:35 +09:00
Yu Watanabe d6fc0d674f sd-radv: drop SD_ prefix for unexposed constants 2021-10-27 19:03:31 +09:00
Lennart Poettering 3f9335e8e3 Merge pull request #21130 from systemd/wip/hadess/webcams
Tag IR cameras and allow media* access
2021-10-27 12:03:30 +02:00
Yu Watanabe 68cbac5bd4 sd-radv: use IPv6 specific functions 2021-10-27 16:41:04 +09:00
Yu Watanabe acbb5500e2 sd-radv: use assert_return() 2021-10-27 16:41:04 +09:00
Yu Watanabe 7003b11487 sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t) 2021-10-27 16:13:09 +09:00
Greg Zuro cfee6b9551 change indicator used for later versions of VirtualBox (#21127)
Detection of VirtualBox is accomplished in the existing code by *either* `innotek GmbH`
or `Oracle Corporation` existing in any of:

- /sys/class/dmi/id/product_name
- /sys/class/dmi/id/sys_vendor
- /sys/class/dmi/id/board_vendor
- /sys/class/dmi/id/bios_vendor

With Oracle's physical servers, both `/sys/class/dmi/id/sys_vendor` and
`/sys/class/dmi/id/board_vendor` contain `Oracle Corporation`, so those
servers are detected as `oracle` (VirtualBox).

VirtualBox has the following values in the latest versions:

- /sys/class/dmi/id/product_name: `VirtualBox`
- /sys/class/dmi/id/sys_vendor: `innotek GmbH`
- /sys/class/dmi/id/board_vendor: `Oracle Corporation`
- /sys/class/dmi/id/bios_vendor: `innotek GmbH`

Presumably the existing check for `innotek GmbH` is meant to detect
older versions of VirtualBox, while changing the second checked value
from `Oracle Corporation` to `VirtualBox` will reliably detect later and future
versions.
2021-10-27 13:02:37 +09:00
Yu Watanabe b81070ff13 Merge pull request #21129 from yuwata/network-dhcp6-pd-vs-ndisc
network: several follow-ups for DHCPv6-PD
2021-10-27 12:15:18 +09:00
Bastien Nocera e78e11d8c5 hwdb: Tag IR cameras as such
So that front-ends can ignore them if they wish to.

See https://gitlab.gnome.org/GNOME/cheese/-/merge_requests/4
2021-10-27 00:14:41 +02:00
Lennart Poettering 8f1daefce6 json: do something remotely reasonable when we see NaN/infinity
JSON doesn't have NaN/infinity/-infinity concepts in the spec.
Implementations vary what they do with it. JSON5 + Python simply
generate special words "NAN" and "Inifinity" from it. Others generate
"null" for it.

At this point we never actually want to output this, so let's be
conservative and generate RFC compliant JSON, i.e. convert to null.

One day should JSON5 actually become a thing we can revisit this, but in
that case we should implement things via a flag, and only optinally
process nan/infinity/-infinity.

This patch is extremely simple: whenever accepting a
nan/infinity/-infinity from outside it converts it to NULL. I.e. we
convert on input, not output.
2021-10-26 22:26:27 +02:00
Frantisek Sumsal cd37793d28 test: add a missing udevadm settle to the multipath test case
8a088877ab uncovered a missing `udevadm
settle` in the multipath test case, causing the test to occasionally
fail with:

```
[   41.718617] testsuite-64.sh[806]: + for i in {0..63}
[   41.727917] systemd-udevd[1120]: sdhf: /usr/lib/udev/rules.d/60-persistent-storage.rules:66 Importing properties from results of 'scsi_id --export --whitelisted -d /dev/sdhf'
[   41.728668] testsuite-64.sh[2341]: ++ printf %.4d 1
[   41.733851] systemd-udevd[1415]: sdhc: Adding watch on '/dev/sdhc'
[   41.734477] testsuite-64.sh[806]: + wwid=deaddeadbeef0001
[   41.734477] testsuite-64.sh[806]: + path=/dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.746174] systemd-udevd[1409]: sdhb: 'scsi_id --export --whitelisted -d /dev/sdhb'(out) 'ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20'
[   41.747058] testsuite-64.sh[2342]: ++ readlink -f /dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.755512] testsuite-64.sh[806]: + dmpath=/dev/sdi
[   41.755512] testsuite-64.sh[806]: + lsblk /dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.766884] systemd-udevd[1402]: sdhd: 'scsi_id --export --whitelisted -d /dev/sdhd'(out) 'ID_VENDOR=QEMU'
[   41.767532] testsuite-64.sh[2343]: NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
[   41.767532] testsuite-64.sh[2343]: sdi    8:128  0  512B  0 disk
[   41.779219] systemd-udevd[1400]: dm-33: 'kpartx_id 254 33 mpath-3deaddeadbeef0051'(out) 'DM_WWN=0xdeaddeadbeef0051'
[   41.779902] testsuite-64.sh[806]: + multipath -C /dev/sdi
[   41.785296] systemd-udevd[1414]: dm-31: Device processed (SEQNUM=4839, ACTION=change)
[   41.785925] testsuite-64.sh[2344]: 37.658168 | /dev/sdi is not a dm device
```
2021-10-27 02:23:55 +09:00
Yu Watanabe 149cda85bf man: adjust the explanations related to the DHCPv6 client starting mode 2021-10-27 00:33:44 +09:00
Yu Watanabe 0e45721e3d network: dhcp6: make UplinkInterface=:self imply WithoutRA=solicit 2021-10-27 00:33:44 +09:00
Yu Watanabe fac19a21cf network: do not restart DHCPv6 client when WithoutRA= is set
Previously, even if WithoutRA= is specified, the DHCPv6 client may be
restarted in undesired mode when a RA is received.
2021-10-27 00:33:44 +09:00
Yu Watanabe 483566e5ba network: deprecate ForceDHCPv6PDOtherInformation= setting
The setting is completely meaningless, as WithoutRA= and UseDelegatedPrefix=
in [DHCPv6] section, and DHCPv6Client= in [IPv6AcceptRA] section control
the behavior.
2021-10-27 00:33:44 +09:00
Yu Watanabe f107df6cdb Merge pull request #21000 from yuwata/network-dhcp6-pd-introduce-uplink
network: dhcp6: introduce UplinkInterface= for prefix delegation
2021-10-27 00:32:50 +09:00
Zbigniew Jędrzejewski-Szmek d6d31d9f41 Merge pull request #21126 from bluca/meta_arch
docs/COREDUMP_PACKAGE_METADATA: add architecture field
2021-10-26 16:24:22 +02:00
Lennart Poettering bb5464ad20 update TODO 2021-10-26 15:40:25 +02:00
Luca Boccassi 98acae1f21 docs/COREDUMP_PACKAGE_METADATA: ELF section should be read-only and 4-bytes-aligned 2021-10-26 12:49:39 +01:00
Yu Watanabe caad88a22b test-network: add test cases for DHCPv6 prefix delegation 2021-10-26 20:43:10 +09:00
Yu Watanabe dc5cae6c9d network: dhcp6: introduce UplinkInterface= for DHCP6 prefix delegation 2021-10-26 20:43:10 +09:00
Yu Watanabe 2cba2146ac network: move config_parse_uplink() to networkd-dhcp-common.[ch] 2021-10-26 20:43:10 +09:00
Yu Watanabe 47e9c655b4 network: dhcp6pd: do not trigger prefix reassignment for all downstreams when a new downstream appears
It is not necessary to reconfigure other interfaces.
2021-10-26 20:43:08 +09:00
Yu Watanabe 079f94edfa network: dhcp6: do not reconfigure/restart DHCPv6 clients when a new downstream appears
Previously, when a downstream appears which requests delegated prefix to
be assigned, then possibly restart all DHCPv6 clients for another
interfaces.

This makes networkd always honor the UseDelegatedPrefix= setting, and
not restart DHCPv6 clients.
2021-10-26 20:40:20 +09:00
Yu Watanabe 0f5ef9b62a network: dhcp6: introduce UseDelegatedPrefix= setting and enable by default
Previously, the prefix delegation is enabled when at least one
downstream interfaces request it. But, when the DHCPv6 client on the
upstream interface is configured, some downstream interfaces may not
exist yet, nor have .network file assigned.

Also, if a system has thousands of interfaces, then the previous logic
introduce O(n^2) search.

This makes the prefix delegation is always enabled, except when it is
explicitly disabled. Hopefully, that should not break anything, as the
DHCPv6 server should ignore the prefix delegation request if the server
do not have any prefix to delegate.
2021-10-26 20:29:08 +09:00
Bastien Nocera 63fbfc598f hwdb: Allow console users access to media* nodes
Newer webcams and video devices have controls only available through
/dev/media* nodes. Make sure they're accessible in the same way as
/dev/video* nodes.

Closes: #21054
2021-10-26 11:57:30 +02:00
gregzuro 48538c19e5 change req meson version
since `meson compile` first appears in 0.54.0
2021-10-26 09:29:14 +01:00
Yu Watanabe adef6d089b Merge pull request #21122 from yuwata/network-optimize-reload
network: slightly optimize "networkctl reload"
2021-10-26 15:55:01 +09:00