1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-26 17:27:41 +03:00
Commit Graph

5169 Commits

Author SHA1 Message Date
Daan De Meyer
dd1c01b20f test: Implement TEST_SHELL for mkosi based test runner
TEST_SHELL can be used to get a shell in the integration test
environment without actually immediately starting the test.
2024-08-05 15:00:24 +02:00
Daan De Meyer
33f400a9e0 test: Rename INTERACTIVE_DEBUG to TEST_SHELL 2024-08-05 15:00:24 +02:00
Mike Yuan
1391f149f0 core/service: actually allow to "hurry up" auto restarts
unit_start() advertises that start requests don't get suppressed,
so that it could be used to manually speed up auto restarts.
However, service_start() so far rejected this, stating that
clients should issue restart request in order to trigger
BindsTo=/OnFailure=.

That seems to be a red herring though, because for a long time
the service states between auto-restarts were buggy (#27594).
With the introduction of RestartMode=direct, the behavior
is sane again and customizable, hence I see no reason to refuse
this anymore. Whether those deps are triggered solely depends
on RestartMode= now.

Plus, filter out some intermediate states that should never
be seen in service_start().

Fixes #33890
2024-08-03 13:03:28 +02:00
Yu Watanabe
74d1ee0373 core: refuse credentials with invalid names matching with glob
Even if the glob pattern is valid, the pattern may match credentials
with invalid names. So, we need to check the names of the found
credentials.

Follow-up for 947c4d3952.
2024-08-03 14:25:35 +09:00
Yu Watanabe
b376dbc83d test: a credential can be imported multiple times with different names
This is supported since 831f208783.
Let's explicitly test the functionality.
2024-08-03 14:23:17 +09:00
Yu Watanabe
40dd2a1c24 core: make ImportCredentialEx= DBus property support without renaming
Note that the conf parser for ImportCredential= checks in the same way.

Follow-up for 831f208783.
2024-08-03 14:20:07 +09:00
jauge-technica
82f2a2f032
Added support for L2 BridgeMDB entries (#32894)
* Added support for L2 BridgeMDB entries
2024-08-02 16:31:20 +01:00
Frantisek Sumsal
4d1fbe53c1 test: don't use /skipped for subtests
Since, at least the old framework, checks for the presence of the file
at the end and marks the whole test as skipped if it exists.

Resolves: systemd/systemd-centos-ci#728
2024-08-02 16:44:25 +02:00
Yu Watanabe
76459af531
Merge pull request #33876 from dbnicholson/firstboot-root-creds-only
firstboot: fix root params with creds and prompting disabled
2024-08-02 11:37:05 +09:00
Frantisek Sumsal
ce2344bbee test: attempt to install sshd-session from multiple places
On Fedora the sshd-session binary is under /usr/libexec/openssh/ so
cover this path as well in the old framework.

Follow-up for aaa7b36bd1.
2024-08-01 15:02:34 +02:00
Yu Watanabe
b1b30d0226 test: add test for journalctl --list-invocations and --invocation= 2024-08-01 07:31:44 +09:00
Daan De Meyer
e54a8e0fc3
Merge pull request #33873 from DaanDeMeyer/rename-creds
core: Add support for renaming credentials with ImportCredential=
2024-07-31 17:35:58 +02:00
Michal Sekletar
941a12dcba socket: fix socket activation of stopped services with pinned FD store 2024-07-31 16:29:07 +02:00
Daan De Meyer
831f208783 core: Add support for renaming credentials with ImportCredential=
This allows for "per-instance" credentials for units. The use case
is best explained with an example. Currently all our getty units
have the following stanzas in their unit file:

"""
ImportCredential=agetty.*
ImportCredential=login.*
"""

This means that setting agetty.autologin=root as a system credential
will make every instance of our all our getty units autologin as the
root user. This prevents us from doing autologin on /dev/hvc0 while
still requiring manual login on all other ttys.

To solve the issue, we introduce support for renaming credentials with
ImportCredential=. This will allow us to add the following to e.g.
serial-getty@.service:

"""
ImportCredential=tty.serial.%I.agetty.*:agetty.
ImportCredential=tty.serial.%I.login.*:login.
"""

which for serial-getty@hvc0.service will make the service manager read
all credentials of the form "tty.serial.hvc0.agetty.xxx" and pass them
to the service in the form "agetty.xxx" (same goes for login). We can
apply the same to each of the getty units to allow setting agetty and
login credentials for individual ttys instead of globally.
2024-07-31 15:52:27 +02:00
Daan De Meyer
3de13e6148 exec-credential: Skip duplicate credentials in load_credential_glob()
We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.
2024-07-31 15:23:45 +02:00
Dan Nicholson
35bc4c3424 firstboot: fix root params with creds and prompting disabled
Remove an early return that prevents --prompt-root-password or
--prompt-root-shell and systemd.firstboot=off using credentials. In that case,
arg_prompt_root_password and arg_prompt_root_shell will be false, but the
prompt helpers still need to be called to read the credentials. Furthermore, if
only the root shell has been set, don't overwrite the root password.
2024-07-31 04:02:43 -06:00
Dan Nicholson
2319154a6b firstboot: handle missing root password entries
If /etc/passwd and/or /etc/shadow exist but don't have an existing root entry,
one needs to be added. Previously this only worked if the files didn't exist.
2024-07-31 04:02:39 -06:00
Dan Nicholson
5088de9daa firstboot: create locked and empty root passwords consistently
Although locked and empty passwords in /etc/passwd are treated the same, in all
other cases the entry is configured to read the password from /etc/shadow.
2024-07-31 00:40:56 -06:00
Dan Nicholson
38688bbc8f test: extend firstboot testing
Several features were not being tested or weren't being evaluated thoroughly.
2024-07-31 00:40:56 -06:00
Yu Watanabe
f320c0777a test-network: add test case for preferred source with peer
For issue #31950.
2024-07-31 05:36:14 +09:00
Daan De Meyer
7fe0ea2ead
Merge pull request #33857 from DaanDeMeyer/mkosi
Two small improvements
2024-07-29 15:40:48 +02:00
Daan De Meyer
578ee05155 test: Don't mount build sources into image when running non-interactively 2024-07-29 13:40:42 +02:00
Luca Boccassi
85c7a9a2f5
Merge pull request #27855 from Werkov/test-delegate-useraddfixup
Delegate/cgroup test refactor
2024-07-26 14:01:38 +01:00
Luca Boccassi
281b0bfbed
Merge pull request #33842 from DaanDeMeyer/test
Two fixes
2024-07-26 10:04:20 +01:00
Michal Koutný
3e6e3e6d40 test: Fail cgroup delegation test when user cannot be created
It means: a) user cannot be created, something's wrong in the
test environment -> fail the test; b) user already exists, we shall not
continue and delete (foreign) user.
2024-07-26 10:44:10 +02:00
Daan De Meyer
ae07feb401 resize-fs: Put minimal ext4 size in the same ballpark as the other filesystems
TEST-46-HOMED fails on ext4 because the filesystem is deemed to small
for activation by cryptsetup. Let's bump the minimal filesystem size for
ext4 a bit to be in the same ballpark as ext4 and btrfs to avoid weird
errors due to impossibly small filesystems.

Also use U64_MB while we're touching this.
2024-07-26 08:27:24 +02:00
Michal Koutný
4f0541dc59 test: Reorganize testcase of cgroup delegation
There are multiple subtests, just move them around into functions
(leveraging the testcase_* convention) to make space for new related
subtests.
2024-07-25 17:29:42 +02:00
Luca Boccassi
a6bcab05df
Merge pull request #33840 from bluca/test_locale_dbus
test: fix D-Bus policy override for TEST-73-LOCALE
2024-07-25 13:18:53 +01:00
Daan De Meyer
ebe17e3f9e TEST-54-CREDS: Specify SMBIOS creds via corresponding mkosi option
This allows mkosi to combine fstab.extra with its own fstab.extra so
that it doesn't override the one we pass for the test.
2024-07-25 13:12:16 +02:00
Luca Boccassi
3bf483fc4f
Merge pull request #33727 from intelfx/work/analyze-capability-masks
analyze: capability: add support for decoding capability masks
2024-07-25 11:08:21 +01:00
Luca Boccassi
a4c436c9d8 test: fix D-Bus policy override for TEST-73-LOCALE
We don't need to allow non-root, and the policy needs to specify destination
and interface too, to narrow it down

Follow-up for 7b5c38a91d
2024-07-25 10:43:48 +01:00
Ivan Shapovalov
3e7a029c28 analyze: capability: add support for decoding capability masks
This adds support in `systemd-analyze capability` for decoding
capability masks (sets), e.g.:

```console
$ systemd-analyze capability --mask 0000000000003c00
NAME                 NUMBER
cap_net_bind_service     10
cap_net_broadcast        11
cap_net_admin            12
cap_net_raw              13
```

This is intended as a convenience tool for pretty-printing capability
values as found in e.g. `/proc/$PID/status`.
2024-07-24 17:25:47 +02:00
Gregor Herburger
1aa74ad048 test: systemd-networkd-tests: add fdb learned tests
Add a test for the new bridge netlink attributes IFLA_BR_FDB_N_LEARNED and
IFLA_BR_FDB_MAX_LEARNED.

Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
2024-07-22 10:27:56 +02:00
Mike Yuan
60b218e36e test-execute: ExecStop= and friends should not get credentials
See #32583
2024-07-21 19:10:58 +01:00
Luca Boccassi
7b5c38a91d test: override blocking localed policy in TEST-73-LOCALE
On Debian and derivatives writing calls to localed are blocked as other
tools are used to change settings, override that policy for the tests
2024-07-21 16:30:57 +01:00
Daan De Meyer
d279ec4a50 mkosi: Streamline running the integration tests without building systemd
Let's document in detail how to build the integration test image and run
the integration tests without building systemd. To streamline the process,
we stop automatically using binaries from build/ when invoking mkosi directly
and don't automatically use a tools tree anymore if systemd on the host is too
old. Instead, we document these options in HACKING.md and change the mkosi meson
target to automatically use the current build directory as an extra binary search
path for mkosi.
2024-07-18 11:39:07 +02:00
Daan De Meyer
473747b8cf
Merge pull request #33752 from DaanDeMeyer/lsm
Two mkosi improvements
2024-07-17 20:15:17 +02:00
Daan De Meyer
f5c44df929 mkosi: Remove enforcing=0 from default kernel command line
We already have selinux=0 in the default kernel command line so
enforcing=0 is redundant. Instead, pass in enforcing=0 when we
enable selinux in TEST-06-SELINUX.
2024-07-17 18:56:02 +02:00
Luca Boccassi
09edabe96a id128: add 'var-partition-uuid' verb
As per DPS the UUID for /var/ should be keyed by the local machine-id,
which is non-trivial to do in a script. Enhance 'systemd-id128' to
take 'var-partition-uuid' as a verb, and if so perform the
calculation.
2024-07-17 18:05:40 +02:00
Daan De Meyer
923eeb38fb
Merge pull request #33695 from DaanDeMeyer/epel
mkosi: Add CI for CentOS Stream 10
2024-07-16 11:43:49 +02:00
Daan De Meyer
5ac0dc70ff TEST-13-NSPAWN: make sure we don't load libnss_systemd
Let's make sure we don't load libnss_systemd.so from bash as the
necessary environment variables aren't set to make that work when
we're running with sanitizers enabled.

We can't add a sanitizer wrapper for bash as the wrapper runs using
bash so you end up in a loop.
2024-07-16 09:42:17 +02:00
Daan De Meyer
985d5b4bc2 systemd-networkd-tests: Skip tests requiring dhcpd if it is not available
dhcpd is not available on CentOS Stream 10

See https://github.com/systemd/systemd/issues/33717
2024-07-15 16:17:33 +02:00
Daan De Meyer
f65ec2e904 TEST-55-OOMD: Remove the opensuse user@ dropin
Required to make TEST-55-OOMD pass on OpenSUSE.
2024-07-15 16:17:33 +02:00
Daan De Meyer
d97b48176b TEST-64-UDEV-STORAGE: Use max_ioqpairs instead of num_queues
Fixes a deprecation warning from qemu.
2024-07-15 16:17:33 +02:00
Daan De Meyer
ff8c89aa5a test: do not attempt to set xattr on tmpfs
This is only possible since a recent kernel version, and fails otherwise,
like on CentOS 9
2024-07-15 16:17:33 +02:00
Mike Yuan
11b3775f51 core/unit: ignore dropins for masked units completely when checking need_reload
Follow-up for 19a44dfe45

If a drop-in is set from upper level, e.g. global unit_type.d/,
even if a unit is masked, its dropin_paths would still be partially
populated. However, unit_need_daemon_reload() would always
compare u->dropin_paths with empty strv in case of masked units,
resulting in it always returning true. Instead, let's ignore
dropins entirely here.

Fixes #33672
2024-07-12 15:59:36 +02:00
David Tardon
8b6de9e638 test: add a reproducer for #33672 2024-07-12 15:59:20 +02:00
Daan De Meyer
14fb6354f1
Merge pull request #33636 from DaanDeMeyer/ext4
Various integration test improvements
2024-07-10 21:33:23 +02:00
Daan De Meyer
dedd712dd9 TEST-06-SELINUX: Various fixes
- Stop installing the policy in the initramfs as it's not really
supported anyway (https://github.com/fedora-selinux/selinux-policy/issues/2221)
- Stop relabeling on first boot and prefer to do it at image build time
- Disable mkosi relabeling by default but enable it in CI
- Build image as root in CI so the SELinux relabeling works properly
2024-07-10 18:52:29 +02:00
Daan De Meyer
e842deeac6 test: Switch to ncat instead of nc
ncat is available in CentOS Stream 9 without having to enable EPEL.
2024-07-10 18:52:29 +02:00