1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

63695 Commits

Author SHA1 Message Date
Lennart Poettering
f1f42aeaf1 test: add integration test for image policy 2023-04-05 20:54:30 +02:00
Lennart Poettering
a594288d79 sysext: default to a stricter image policy when reading /.extra/sysext/ DDIs 2023-04-05 20:53:04 +02:00
Lennart Poettering
73740c9f84 discover-image: automaticaly pick up sysext images from /.extra/sysext 2023-04-05 20:52:21 +02:00
Lennart Poettering
a62e12dad1 analyze: add 'image-policy' tool for analyzing image dissection policies 2023-04-05 20:51:31 +02:00
Lennart Poettering
97ce55e3e5 dissect: update error code comment a bit 2023-04-05 20:50:47 +02:00
Lennart Poettering
598fd4da1c dissect: disallow empty partition tables
If we don't find a single useful partition table, refusing dissection.

(Except in systemd-dissect, when we are supposed to show DDI
information, in that case allow this to run and show general DDI
information, i.e. size, UUID and name at least)
2023-04-05 20:49:48 +02:00
Lennart Poettering
dee4a6237a dissect: add new --validate command
This allows unprivileged validation of DDIs. Only superficial structure,
i.e. not mounting or so. This becomes particularly handy in the
integration tests, and to validate image policies.
2023-04-05 20:49:06 +02:00
Lennart Poettering
93a8a85be3 dissect: make returning of DissectedImage object optional
Sometimes, we just want to validate if an image (or image policy) works,
hence let's make the returning optional.
2023-04-05 20:48:25 +02:00
Lennart Poettering
7cd7a19568 dissect: add dissect_image_file_and_warn()
This is to dissect_image_file() what dissect_loop_device_and_warn() is
to dissect_loop_device(), i.e. it dissects the image file and logs an
error string if that fails instead of just returning an error.
2023-04-05 20:47:23 +02:00
Lennart Poettering
cd22d8562d dissect: actually enforce policy 2023-04-05 20:46:27 +02:00
Lennart Poettering
84be0c710d tree-wide: hook up image dissection policy logic everywhere 2023-04-05 20:45:30 +02:00
Lennart Poettering
d452335aa4 dissect: add image dissection policy framework 2023-04-05 20:44:36 +02:00
Yu Watanabe
70650ae345 test: add tests for dir_fd_is_root_or_cwd()
Follow-up for e212f42279.
2023-04-05 19:38:08 +01:00
Ronan Pigott
cad0fc7a13 resolve: refuse mdns scope for ipv4 broadcast addresses
This query can never be answered, so let's no wait for it to timeout.
2023-04-05 13:27:16 +02:00
Zbigniew Jędrzejewski-Szmek
effd05626d
Merge pull request #27143 from bluca/no_tpm
cryptsetup: fix build without TPM2
2023-04-05 11:24:18 +02:00
Daan De Meyer
89c8328fc9 Revert "mkosi: Drop python-docutils"
This reverts commit be266f49d6b7e3f021e2a07f937d39d1f14a283d.

Turns out we installed this because it's required by the bpf selftests
so let's keep it intact.
2023-04-05 11:00:52 +02:00
Lennart Poettering
aa7c4dd66e service: use newdup() where appropriate 2023-04-05 15:25:36 +09:00
Yu Watanabe
78ebf8bfb6
Merge pull request #27137 from yuwata/id128-get-machine
sd-id128: introduce id128_get_machine() and _at()
2023-04-05 15:24:45 +09:00
Zbigniew Jędrzejewski-Szmek
51214cf491 various: simplify calls to parse_boolean_argument()
parse_boolean_argument() returns the same information via both the output
argument and normal return.
2023-04-05 13:06:26 +08:00
Luca Boccassi
b7b48b389c ci: do one build with no tpm/p11kit/fido2
We have some missing coverage in the CI, all builds enable these features,
but there are often changes and they cover a lot of code. Do one build
without them to ensure we don't break builds.
2023-04-04 22:38:08 +01:00
Luca Boccassi
4255980887 cryptsetup: fix build without TPM2
Follow-up for acbb504eaf
2023-04-04 22:35:04 +01:00
William Roberts
96181b7a89 tpm2: fix nits from PR #26185
Fixes:
  - Comment style
  - Alignment style
  - cleanup macro usage
  - incorrect error message[1]

1. Thanks to tempusfugit991@gmail.com for pointing out the error
message mistake.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
2023-04-04 20:41:11 +01:00
Thomas Blume
d6d0661631 test/test-functions: fix typo in install_suse_systemd() 2023-04-04 20:39:11 +01:00
Lennart Poettering
45ed795f41 update TODO
As it turns out RuntimeDirectoryPreserve= already supports such a mode.
2023-04-04 21:29:22 +02:00
Lennart Poettering
d657a4d8b1 update TODO 2023-04-04 21:29:22 +02:00
Lennart Poettering
e43911a78e execute: add one more assert() 2023-04-04 21:29:22 +02:00
Zbigniew Jędrzejewski-Szmek
9f27df2938
Merge pull request #27128 from keszybz/sd-bus-docs-and-error-messages
Improvements to man pages for systemd.service, sd-bus, and better error messages
2023-04-04 21:28:15 +02:00
Yu Watanabe
bc729e81f2 man: mention -o option for systemd-journal-remote 2023-04-04 19:52:04 +01:00
Yu Watanabe
a9f48db5f6 machine-id-setup: do not read host's machine ID when root directory is specified
If a root directory is specified, and e.g. /var under the root directory
is a symlink to the host's /var, then we wrongly read host's machine ID,
even if O_NOFOLLOW is set.

Let's chase the path with CHASE_NOFOLLOW to refuse such case.

Also, refuse null ID, otherwise we may setup machine ID with NULL.
2023-04-05 00:52:56 +09:00
Yu Watanabe
c1d74108a0 machine-id-setup: use id128_get_machine() at one more place 2023-04-05 00:52:56 +09:00
Yu Watanabe
f7b5f39934 discover-image: use id128_get_machine() at one more place 2023-04-05 00:52:56 +09:00
Yu Watanabe
edd595f760 specifier: always convert missing machine-id file to EUNATCH
Then, use id128_get_machine().
2023-04-05 00:52:56 +09:00
Yu Watanabe
319477f1b6 nspawn: ignore NULL machine ID in the container
Previously, when the NULL (all zero) machine ID is configured in the
container, nspawn refused to execute.

Now id128_get_machine() is used, so NULL machine ID is refused with
-ENOMEDIUM, and fallback to specified UUID or randomly generated one.
2023-04-05 00:52:56 +09:00
Yu Watanabe
5ee37b703e repart: use id128_get_machine()
This also makes that the seed is actually randomized when the read
machine ID is NULL.
2023-04-05 00:52:56 +09:00
Yu Watanabe
1adbc2a428 test: add tests for id128_get_machine() and _at() 2023-04-05 00:52:56 +09:00
Yu Watanabe
64c8c1bf1c sd-id128: introduce id128_get_machine() and id128_get_machine_at() 2023-04-05 00:52:56 +09:00
Yu Watanabe
e212f42279 fd-util: introduce dir_fd_is_root_or_cwd() 2023-04-05 00:52:56 +09:00
Yu Watanabe
99e6d7941b test: add tests for ID128_REFUSE_NULL 2023-04-05 00:52:56 +09:00
Yu Watanabe
52673ef848 sd-id128: introduce ID128_REFUSE_NULL flag 2023-04-05 00:52:56 +09:00
Lennart Poettering
51339a9aeb service: minor modernizations 2023-04-04 22:34:18 +08:00
Zbigniew Jędrzejewski-Szmek
45f540a297 manager: remove transient unit directory during startup
I was testing transient units and user@.service crashed. I restarted it, and
tried to create a transient unit. It failed because
/run/user/1000/systemd/transient/ remained after the previous aborted run:
  Failed to start transient service unit: Unit run-u0.service was already loaded or has a fragment file.

Remove the directory during initial startup so we don't get confused by our own
files.
2023-04-04 22:33:20 +08:00
Zbigniew Jędrzejewski-Szmek
91053fc94e sd-bus: use macros for standard bus error names consistently
Also add definitions for a few names that didn't have them and update
the list in the man page.
2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
44d82df46e core: a more informative error when SetProperties/StartTransientUnit fails
I was changing how some properties are appended to the StartTransientUnit call
and messed up the message contents. When something is wrong with how the
message is structed, we would return a very generic
"Failed to start transient service unit: No such device or address".

Mention that it was property setting that failed, and translate ENXIO to a
different message. bus_unit_set_properties() or any of the children it calls
may also return other errors, in particular EBADMSG or ENOMEM, but the error
message that is generated for those is understandable, so we don't need to
"translate" them explicitly.

bus_unit_set_properties() is called from two places, so it seems nicer to
generate the message internally, rather than ask the caller to do that. Also,
now bus_unit_set_properties() always sets <error>, which is nicer for the
callers.
2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
6db00b5de1 man/sd_bus_message_open_container: mention two common errors 2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
4d7ae2557b man/systemd.service: add example for char prefixes
The prefixes can be specified for any part of the command. The docs imply this,
but it's not entirely obvious. Let's add an example.
2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
8202c01701 man: move description of command line substitution out of ExecStart=
The description was split — part was under ExecStart= and part in "Command lines".
Now the whole generic part is moved to the separate section, and under ExecStart=
only the stuff that is specific to that option is described.

This just moves the text and removes some repetitions.
2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
3ff67ec43a core: unify two similar paths, avoid formatting of unused string
After 'if (DEBUG_LOGGING)' is added, the two call sites are almost identical,
except that we forgot LOG_UNIT_INVOCATION_ID(unit).

I removed the handling of the log_oom(). It's a debug message only after all,
and it's unlikely to fail.
2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
68ecb48b90 core: simplify unit_escape_setting()
The function had a provision for NULL input, and would return NULL, but that
looks like an error and all callers pass in a non-NULL arg and report oom on
NULL. So assert that the input is non-NULL.

All callers specifed the output buffer, so we can simplify the logic to only
make an allocation if appropriate and change the return type to 'const *'.

No functional change.
2023-04-04 15:18:00 +02:00
Zbigniew Jędrzejewski-Szmek
4a055e5a3e core: typos in comments 2023-04-04 15:18:00 +02:00
Lennart Poettering
a23d80d322 update TODO 2023-04-04 12:36:54 +02:00