1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-18 21:57:48 +03:00

62293 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
2584e16cb7
Merge pull request #26236 from medhefgo/meson-fixes
meson: Fixes
2023-02-01 10:05:36 +01:00
Lennart Poettering
0e8330262e journald: some minor modernizations 2023-02-01 09:25:57 +01:00
Lennart Poettering
2308cf7c9c journal: generate a clean message when we try to write to a journal file from a different host 2023-02-01 09:23:18 +01:00
Lennart Poettering
75bf2627b0 journal-file: refuse writing to journal files where the header size is different then expected
We keep adding fields to the header, and it's fine reading files with
different header sizes, as we check via the size if the fields we need
are included. However, let's be stricter when writing journal files than
when reading, and insist that the header structure in the file actually
matches our expectations. Refuse otherwise, so that a new file is
created after rotation that then matches our expectations.

This makes sure that mismatch in header size is treated exactly as
unknown "compatible" flags, which is our other mechanism to allow
extending the journal file format in a non-breaking way.
2023-02-01 09:20:18 +01:00
Rudi Heitbaum
1bb6ba08b1 glibc: Conditionally #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
2023-02-01 00:02:41 +00:00
Zbigniew Jędrzejewski-Szmek
49bb7fe5f8 sysusers: insist that root group is 0
In https://bugzilla.redhat.com/show_bug.cgi?id=2156900 sysusers was reporting a
conflict between the following lines:
  u root 0:0 "Super User" /root /bin/bash
  u root    0     "Super User" /root

The problem is that those configurations are indeed not equivalent. If group 0
exists with a different name, the first line would just create the user, but the
second line would create a 'root' group with a different GID. The second
behaviour seems definitely wrong. (Or at least more confusing in practice than
the first one. The system is in a strange shape, but the second approach takes
an additional step than is worse than doing nothing.)

When this line was initially added, we didn't have the uid:gid functionality for
'u', so we didn't think about this too much. But now we do, so we should use it.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'g foobar 0'
Creating group 'foobar' with GID 0.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0 "Zuper zuper"'
src/sysusers/sysusers.c:1365: Creating group 'root' with GID 999.
src/sysusers/sysusers.c:1115: Suggested user ID 0 for root already used.
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 999 and GID 999.

vs.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0:0 "Zuper zuper"'
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 0 and GID 0.
2023-02-01 00:02:09 +00:00
Zbigniew Jędrzejewski-Szmek
a0d613ec43 meson: fail build on implicit int warnings 2023-02-01 00:01:03 +00:00
Yu Watanabe
2cb1cabb41 network: dhcp-server: do not create DHCPServer object when the DHCP server is running in relaying mode
Follow-up for c95df5879eeb2cec8bc8eec2cfa7e741e1d9469f.

Fixes #26196.
2023-02-01 00:00:19 +00:00
Tuetuopay
1d84a3c779 network/dhcp4: accept local subnet routes from DHCP
RFC3442 specifies option 121 (Classless Static Routes) that allow a DHCP
server to push arbitrary routes to a client. It has a Local Subnet
Routes section expliciting the behavior of routes with a null (0.0.0.0)
gateway.

Such routes are to be installed on the interface with a Link scope, to
mark them as directly available on the link without any gateway.

Networkd currently drops those routes, which is against the RFC, as
Linux has proper support for such routes.

Fixes: 7f20627 ("network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network")
2023-01-31 23:58:34 +00:00
Frantisek Sumsal
9c45bfb2ac ukify: don't install ukify man page if ukify is not enabled
Checking for gnu-efi is not enough, since ukify can be explicitly
disabled.

Resolves: #26274
2023-01-31 23:57:28 +00:00
Ilya Leoshkevich
907046282c bpf: fix restrict_fs on s390x
Linux kernel's bpf-next contains BPF LSM support for s390x. systemd's
test-bpf-lsm currently fails with this kernel.

This is an endianness issue: in the restrict_fs bpf program,
magic_number has type unsigned long (64 bits on s390x), but magic_map
keys are uint32_t (32 bits). Accessing magic_map using 64-bit keys may
work by accident on little-endian systems, but fails hard on big-endian
ones.

Fix by casting magic_number to uint32_t.
2023-01-31 12:23:16 +01:00
Arsen Arsenović
181eea677d importd: Always specify file unpacked by tar
Despite popular belief, the default file extracted by GNU tar is not stdin.  It
is the value of the TAPE environment variable, falling back on a compile-time
constant.  On my system, the default value is /dev/full, which causes tar to
just spin forever due to --ignore-zeros.  Always specifying this flag is the
safe thing to do.

  ~$ tar --show-defaults
  --format=gnu -f/dev/full -b20 --quoting-style=escape
  --rmt-command=/usr/sbin/grmt

See also: ``(tar)defaults'', available via Info viewers, and in HTML form at:
https://www.gnu.org/s/tar/manual/html_node/defaults.html
2023-01-31 12:21:44 +01:00
Lennart Poettering
a444091840
Merge pull request #26249 from DaanDeMeyer/nspawn-uid-fix
nspawn: Make sure we create bind mount points as the correct UID/GID
2023-01-31 12:21:09 +01:00
Lennart Poettering
e9125200ac
Merge pull request #26245 from ldv-alt/tmpfiles-fixes
tmpfiles: fix specifier expansion in arguments of C and L lines
2023-01-30 17:14:03 +01:00
Yu Watanabe
808f7c94f0
Merge pull request #23956 from mrc0mmand/resolved-ipv6
test: cover (not only) IPv6 in the resolved test suite
2023-01-30 19:21:19 +09:00
Luca Boccassi
0a5bd40a70
Merge pull request #25374 from yuwata/sleep-fixlets
sleep: several fixlets
2023-01-30 09:51:21 +00:00
Daan De Meyer
1ac51b0dc7
Merge pull request #26252 from DaanDeMeyer/mkosi-drop-workaround
mkosi fixes
2023-01-29 19:31:15 +01:00
Daan De Meyer
60f42f7ec2 test-systemd-tmpfiles: Fix execution when user is not in /etc/passwd
We might be running in a chroot as a uid that doesn't exist in /etc/passwd.
Let's make sure we don't fail in this scenario.

We pass $HOME when resetting the env so that we can find a home directory
and skip tests that depend on user name/group.
2023-01-29 17:49:38 +00:00
Daan De Meyer
3d4fa9aaa0 mkosi: Disable auditd when running with nspawn in CI
auditd fails to start in CentOS Stream 9 causing CI failures so let's
disable it when running with nspawn in CI.
2023-01-29 17:34:21 +01:00
Daan De Meyer
868c318ba3 mkosi: Add back CentOS Stream 8 to CI
It's still useful to test the EFI handover logic in systemd-boot.
We use a mkosi.prepare script to install a newer python and update
the system to use it.
2023-01-29 17:05:23 +01:00
Daan De Meyer
fc4b61d0b9 mkosi: Drop focal workaround in build script
Now that jammy is the latest LTS, lets drop the focal workaround
from the build script.
2023-01-29 17:05:23 +01:00
Daan De Meyer
84a4af2c81 mkosi: Don't modify rootfs in build script
When unprivileged mkosi becomes available, builds will be executed
as an unprivileged user, so we won't be able to modify the rootfs
anymore. Let's update the build script to account for this.
2023-01-29 17:05:23 +01:00
Daan De Meyer
ac3326dfb8 mkosi: Fix shellcheck warnings 2023-01-29 17:05:04 +01:00
cake03
98a6d8505d update footer to 2023 2023-01-29 20:26:28 +09:00
Daan De Meyer
c3caadb400 mkosi: Drop epel-testing repository from centos config
python3-pefile was pushed to epel 9 stable.
2023-01-29 11:55:57 +01:00
Daan De Meyer
0a67965fa2 nspawn: Make sure we create bind mount points as the correct UID/GID
When using --private-users, we have to create bind mount points as
the user that will become root in the user namespace, so let's take
that into account.
2023-01-29 08:59:19 +01:00
Daan De Meyer
2312fd17cc mkdir-label: Add mkdir_parents_safe_label() 2023-01-28 15:11:29 +01:00
Yu Watanabe
b52031dbbc sd-dhcp-server: allow to send header only message
If we receive a header only message, and the server is running in relay
mode, then the assertion was triggered.

Fixes #26151.
2023-01-28 10:44:30 +00:00
Daan De Meyer
c811aba082 ukify: python 3.9 compat followup 2023-01-27 22:16:07 +01:00
Yu Watanabe
fe8e0f8e79 sleep: enumerate only existing and non-device batteries
The enumerator is now mostly consistent with on_ac_power() in
udev-util.c.
2023-01-27 20:52:12 +00:00
Yu Watanabe
3332cfe176 sleep: fix indentation 2023-01-27 20:52:12 +00:00
Yu Watanabe
a7795a4ecf sleep: introduce siphash24_compress_id128()
Also, rename get_battery_identifier() to siphash24_compress_device_sysattr().

This also makes any errors in sd_id128_get_machine() or id128_get_product()
ignored. For the machine ID, the failure should not be significant unless
the file stored in the discharge level is reused by another system, which
is quite unusual. For the product ID, if the firmware provides useless
ID (all zero or all 0xFF), then loading/storing the discharge rate
becomes completely broken, that should be avoided.

Note, now sysattrs are used instead of properties in uevent files, but
both provide the same information, hence no functionality should be
changed.
2023-01-27 20:52:12 +00:00
Yu Watanabe
3d9ca76f36 sleep: simplify code a bit
- use device_get_sysattr_int(),
- drop redundant log message.
2023-01-27 20:52:12 +00:00
Yu Watanabe
3c3f46013e sleep: coding style fixlets 2023-01-27 20:52:12 +00:00
Yu Watanabe
4f58b656d9 sleep: introduce SuspendEstimationSec=
Before v252, HibernateDelaySec= specifies the maximum timespan that the
system in suspend state, and the system hibernate after the timespan.

However, after 96d662fa4c8cab24da57523c5e49e6ef3967fc13, the setting is
repurposed as the default interval to measure battery charge level and
estimate the battery discharging late. And if the system has enough
battery capacity, then the system will stay in suspend state and not
hibernate even if the time passed. See issue #25269.

To keep the backward compatibility, let's introduce another setting
SuspendEstimationSec= for controlling the interval to measure
battery charge level, and make HibernateDelaySec= work as of v251.

This also drops implementation details from the man page.

Fixes #25269.
2023-01-27 20:52:12 +00:00
Jan Janssen
c49ac355c0 meson: Use files() in one more place 2023-01-27 18:37:15 +01:00
Jan Janssen
4c6d1e1665 meson: Install missing udev rule 2023-01-27 18:23:02 +01:00
Jan Janssen
7b2f84e3f2 meson: Install missing bash-completions 2023-01-27 17:56:12 +01:00
Jan Janssen
17be6f2709 meson: Install missing network file 2023-01-27 17:50:27 +01:00
Jan Janssen
3774ff06f2 meson: Install all catalogs 2023-01-27 17:47:09 +01:00
Jan Janssen
4c181c1a33 meson: Properly install 90-uki-copy.install 2023-01-27 17:47:09 +01:00
Jan Janssen
6249face77 meson: Remove unused variables 2023-01-27 17:47:09 +01:00
Frantisek Sumsal
42262f3e1b test: wrap delv & dig when running with sanitizers
On Arch both delv and dig pull in libnss_resolve:

```
$ grep resolve /etc/nsswitch.conf
hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
```
2023-01-27 16:40:52 +01:00
Frantisek Sumsal
270e9dcdb8 test: don't hang indefinitely on no match 2023-01-27 15:45:00 +01:00
Frantisek Sumsal
05bb428952 test: add a test for the OPENPGPKEY RR 2023-01-27 15:45:00 +01:00
Frantisek Sumsal
3095bd2cca test: add a couple of SRV records to check service resolution 2023-01-27 15:45:00 +01:00
Frantisek Sumsal
5c9111fe77 test: cover IPv6 in the resolved test suite 2023-01-27 15:45:00 +01:00
Daan De Meyer
c8943ce884 mkosi: Update and enable ukify in mkosi builds
We also add the necessary deps for ukify to the mkosi configs.

CentOS Stream 8 is dropped from CI because its python version is too
old (3.6) to be able to run ukify.
2023-01-27 15:05:04 +01:00
Lennart Poettering
b6033b7060 tmpfiles: automatically create /etc/credstore/ and friends
This adds a tmpfiles.d/ snippet for LoadCredential= style credentials
directories in /etc/ and /run/.

This is done primarily to ensure that the access modes for the dirs are
set up properly, in the most restrictive ways. Specifically these are
set to 0000, so that CAP_DAC_OVERRIDE is necessary to enumerate and read
the credentials, and being UID=0 is not sufficient to do so.

This creates /etc/credstore/, but leaves /run/credstore/ absent if
missing, for now. Thinking is: the latter being non-persistent is
created by software usually, not manually by users, and hence more
likely right. But dunno, we might want to revisit this sooner or later.

This is ultimately an exercise to advertise the LoadCredential= concept
a bit, and do so in a reasonably secure way, underlining the safety of
the concept.
2023-01-27 10:03:38 +01:00
Lennart Poettering
745de3506a
Merge pull request #26228 from DaanDeMeyer/resolve-cap
resolve: Skip stubs if running in a container with userns but without network namespace
2023-01-27 10:03:17 +01:00