1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00
Commit Graph

63766 Commits

Author SHA1 Message Date
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
Yu Watanabe
1f06ea747b sd-journal: allow to specify compression algorithm through env
Fixes RHBZ#2183546 (https://bugzilla.redhat.com/show_bug.cgi?id=2183546).

Previously, journal file is always compressed with the default algorithm
set at compile time. So, if a newer algorithm is used, journal files
cannot be read by older version of journalctl that does not support the
algorithm.

Co-authored-by: Colin Walters <walters@verbum.org>
2023-04-04 18:32:12 +09:00
Yu Watanabe
2360352ef0 sd-journal: always use the compression algorithm specified in the header
Previously, data object may be compressed with an algorithm that is not
mentioned in the header.
2023-04-04 18:32:12 +09:00
Yu Watanabe
83f3d73da8 compress: introduce compression_supported() helper function 2023-04-04 18:32:12 +09:00
Yu Watanabe
9dfbae203e sd-journal: cache results of parsing environment variables 2023-04-04 18:32:12 +09:00
Yu Watanabe
01aa59979b journald: fix log message 2023-04-04 18:32:12 +09:00
Lennart Poettering
f2eb0c508f service: dump fdstore contents also in free-form debug dump 2023-04-04 09:45:17 +02:00
Daan De Meyer
b3a3ed2d50
Merge pull request #27122 from yuwata/id128-at
undefined
2023-04-04 09:25:37 +02:00
Yu Watanabe
21eac258f8 chase: fix error handling
Fixes a bug introduced by 63bfd52f48.
2023-04-04 09:20:09 +02:00
Yu Watanabe
9853542dd3 test: add tests for id128_{read,write}_at() 2023-04-04 11:46:18 +09:00
Yu Watanabe
c227c46b8b sd-id128: introduce id128_write_at() 2023-04-04 11:46:18 +09:00
Yu Watanabe
0f44b76601 sd-id128: introduce id128_read_at() 2023-04-04 11:46:18 +09:00
Yu Watanabe
762b78dee9 sd-id128: rename Id128FormatFlag -> Id128Flag
As the flag is not only for formatting.
2023-04-04 11:46:18 +09:00
Yu Watanabe
169d91b727 sd-id128: rename argument and add missing assertion 2023-04-04 11:46:18 +09:00
Yu Watanabe
17f9d6d806 Revert "sd-id128: make id128_read() optionally take root directory"
This reverts commit 830e52caa2.
2023-04-04 11:46:18 +09:00
OMOJOLA JOSHUA DAMILOLA
de2820606d src: changed usage of basename() to path_extract_filename().
TODO.
2023-04-04 00:10:22 +01:00
Luca Boccassi
ee9fc74a4c
Merge pull request #27114 from keszybz/trivial-cleanups
Trivial cleanups
2023-04-03 18:55:49 +01:00
Lennart Poettering
a732e28436 pid1: drop two spurious empty line 2023-04-03 19:15:58 +02:00
Mike Yuan
09567df7db core/main: also check the argument terminator
For future-proof reasons, in case we will add
another option that starts with --deserialize.

Addresses 4f44d2c4f7 (r107285603)
2023-04-03 16:04:35 +01:00
Dmitry V. Levin
56df2f6f9b udev-rules: check tokens order
When invoked by udevadm verify, warn about rules that have PROGRAM
assignments specified after RESULT checks.
2023-04-03 23:44:26 +09:00
Zbigniew Jędrzejewski-Szmek
73ed4874e9 shared/exec-util: reduce scope of iterator variables 2023-04-03 15:28:53 +02:00
Zbigniew Jędrzejewski-Szmek
68e58ca95b core/service: inline one variable 2023-04-03 15:28:53 +02:00
Zbigniew Jędrzejewski-Szmek
2657d5bddc basic/fs-util: typo fix 2023-04-03 15:28:53 +02:00
Zbigniew Jędrzejewski-Szmek
0d6e0adef5 man/systemd-sysext: minor grammar optimizations 2023-04-03 15:28:44 +02:00
Zbigniew Jędrzejewski-Szmek
2c71aa77a5 basic/mkdir: simplify error handling
If we created the dir successfully, we let chmod_and_chown_at() do its thing
and shouldn't go into the part where we check if the existing directory has the
right permissions and ownership and possibly adjust them. The code was doing
that, by relying on the fact that chmod_and_chown_at() does not return -EEXIST.
That's probably true, but seems unnecessarilly complicated.

Follow-up for c1b1492a94.
2023-04-03 15:28:00 +02:00
William Roberts
acbb504eaf tpm2: add support for a trusted SRK
Prevent attackers from spoofing the tpmKey portion of the AuthSession by
adding a trusted key to the LUKS header metadata. Also, use a persistent
object rather than a transient object.

This provides the following benifits:
1. No way to MITM the tpmKey portion of the session, see [1] for
details.

2. Strengthens the encrypted sessions, note that the bindKey could be
   dropped now.

3. Speed, once it's created we just use it.

4. Owner Auth is needed to call create primary, so using the SRK
   creates a scratch space for normal users.

This is a "first to set" model, in where the first person to set the key
in the LUKS header wins. Thus, setup should be done in a known good
state. If an SRK, which is a primary key at a special persistent
address, is found, it will use whatever is there. If not, it creates an
SRK. The SRK follows the convetions used through the tpm2-software
organization code on GitHub [2], however, a split has occured between
Windows and Linux with respect to SRK templates. The Linux SRK is
generated with the unique field size set to 0, in Windows, it properly
sets the size to key size in bytes and the unique data to all 0's of that
size. Note the proper templates for SRKs is covered in spec [3].
However, the most important thing, is that both SRKs are passwordless,
and thus they should be interchangable. If Windows is the first to make
the SRK, systemd will gladly accept it and vice-versa.

1. Without the bindKey being utilized, an attacker was able to intercept
this and fake a key, thus being able to decrypt and encrypt traffic as
needed. Introduction of the bindKey strengthened this, but allows for
the attacker to brute force AES128CFB using pin guesses. Introduction of
the salt increases the difficulty of this attack as well as DA attacks
on the TPM objects itself.

2. https://github.com/tpm2-software

3. https://trustedcomputinggroup.org/wp-content/uploads/TCG-TPM-v2.0-Provisioning-Guidance-Published-v1r1.pdf

Fixes: #20668
Fixes: #22637

Signed-off-by: William Roberts <william.c.roberts@intel.com>
2023-04-03 13:10:49 +02:00
Lennart Poettering
6b868766eb
Merge pull request #27044 from bluca/sysext_recursive_dir
Ensure sysexts do not contain an os-release file, do not load sysexts from /usr[/local]/lib/extensions/
2023-04-03 12:38:48 +02:00
Zbigniew Jędrzejewski-Szmek
a78413baae user-sessions: do not remove /etc/nologin
pam_nologin looks for /etc/nologin and /run/nologin.
user-sessions creates (and removes) /run/nologin, but also removes
/etc/nologin. (This behaviour is unchanged since the introduction
of the binary in e92787416c691c3f34f47349e5eae3fa68eae856.)

By not removing pam_nologin we fully drop compatibility with PAM < 1.1.
This has the advantage that now /etc/nologin can be used by administrator to
disable user logins, e.g. for extended maintanance. We already specified
PAM >= 1.1.2 as dependency, so this was already covered.

The makes the code match the man page.

Fixes #26965.
2023-04-03 12:32:56 +02:00
dmkUK
dc2b3f9469
update 60-sensor.hwdb with toshiba tablet (#27103)
* update 60-sensor.hwdb with toshiba tablet

udevadm output after new matrix added

E: MODALIAS=dmi:bvnTOSHIBA:bvr2.00:bd01/09/2015:br2.0:efr19.0:svnTOSHIBA:pnTOSHIBAWT10-A-102:pvrPDW0BE-00800TEN:rvnType2-BoardManufacturer:rnType2-BoardProductName:rvrType2-BoardVersion:cvnChassisManufacturer:ct10:cvrChassisVersion:

P: /devices/platform/80860F41:02/i2c-2/i2c-13/13-000c
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-13/13-000c
E: SUBSYSTEM=i2c
E: MODALIAS=i2c:INVN6500-client

P: /devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00
E: SUBSYSTEM=i2c
E: DRIVER=inv-mpu6050-i2c
E: MODALIAS=acpi:INVN6500:
E: USEC_INITIALIZED=8659532
E: ID_VENDOR_FROM_DATABASE=Inviso, Inc.

P: /devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/iio:device0
N: iio:device0
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/iio:device0
E: SUBSYSTEM=iio
E: DEVNAME=/dev/iio:device0
E: DEVTYPE=iio_device
E: MAJOR=246
E: MINOR=0
E: USEC_INITIALIZED=9662385
E: ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
E: IIO_SENSOR_PROXY_TYPE=iio-poll-accel iio-buffer-accel
E: SYSTEMD_WANTS=iio-sensor-proxy.service
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/trigger0
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/trigger0
E: SUBSYSTEM=iio

The orientation is the same as the WT10-A-103 already listed in 60.sensor.hwdb but not picked up by that rule.
2023-04-03 00:09:11 +01:00
Mike Yuan
4f44d2c4f7 core: do early setup check for arguments with '=' too
Follow-up for d2ebd50d7f

We now modify our cmdline to use '=' for all arguments,
but didn't change early setup check to work with that.
So every daemon-reexec does a full setup, thus breaking
running user sessions.

Fixes #27106
2023-04-02 16:22:52 +01:00
taniishkaaa
6cc19afac1
Added unit test for strv_env_name_is_valid() function listed in env-util.c (#27100)
tests: add test for strv_env_name_is_valid function listed in env-util.c
2023-04-02 14:27:29 +01:00
Luca Boccassi
8014efda19
Merge pull request #27096 from YHNdnzj/networkctl-modernize
networkctl: modernize
2023-04-02 14:23:59 +01:00
Mike Yuan
3508b1ba2b
Merge pull request #27086 from keszybz/oomd-on-v1
Do not pull in systemd-oomd on v1 to avoid repeated message in logs
2023-04-02 16:21:53 +08:00
Andrei Stepanov
7f1d261f07 po: Translated using Weblate (Russian)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Andrei Stepanov <adem4ik@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ru/
Translation: systemd/main
2023-04-02 16:25:12 +09:00
dependabot[bot]
ca0a1a3107 build(deps): bump github/codeql-action from 2.2.5 to 2.2.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.5 to 2.2.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](32dc499307...04df1262e6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-01 19:11:42 +02:00
Frantisek Sumsal
2e4f69946c
Merge pull request #27087 from mrc0mmand/missing-coverage
test: set ReadWritePaths= for test-.services when built w/ coverage
2023-04-01 18:59:42 +02:00
Yu Watanabe
efebf6ba3a
Merge pull request #27067 from DaanDeMeyer/find-esp-at
find-esp: Add openat() like helpers that operate on fds
2023-04-02 01:19:57 +09:00
dependabot[bot]
6e57813113 build(deps): bump ossf/scorecard-action from 2.1.2 to 2.1.3
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](e38b1902ae...80e868c13c)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-01 18:08:20 +02:00
dependabot[bot]
ca8444d471 build(deps): bump actions/labeler from 4.0.2 to 4.0.3
Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](5c7539237e...ba790c862c)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-01 18:07:58 +02:00
dependabot[bot]
4a0c9b60b2 build(deps): bump github/super-linter from 4.9.7 to 4.10.1
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.7 to 4.10.1.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](bb2d833b08...454ba4482c)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-01 18:07:43 +02:00