]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
21 months agocore: reuse credential dir across start and start-post if populated, 31202/head
Mike Yuan [Sun, 4 Feb 2024 15:22:46 +0000 (23:22 +0800)] 
core: reuse credential dir across start and start-post if populated,
fresh otherwise

Currently, exec_setup_credential() always rewrite all credentials
upon exec_invoke(), i.e. invocation of each ExecCommand, and within
a single tmpfs instance. This is problematic though:

* When writing each tmp cred file, we essentially double the size
  of the credential. Therefore, if one cred is bigger than half
  of CREDENTIALS_TOTAL_SIZE_MAX, confusing ENOSPC occurs (see also
  https://github.com/systemd/systemd/pull/24734#issuecomment-1925440546)

* Credential is a unit-wide thing and thus should not change
  during the whole lifetime of main process. However, if e.g.
  a on-disk credential or SetCredential= in unit file
  changes between ExecStart= and ExecStartPost=,
  the credentials are overwritten when the latter gets to run,
  and the already-running main process is suddenly seeing
  completely different creds.

So, let's try to reuse final cred dir if the main process has started
and the tmpfs has been populated, so that the creds used is stable
across all ExecStart= and ExecStartPost=-s. We still want to retain
the ability of updating creds through ExecStartPre= though, therefore
we forcibly use a fresh cred dir for those. 'Fresh' means to actually
unmount the old tmpfs first, so the first problem goes away, too.

21 months agocore: introduce exec_params_need_credentials
Mike Yuan [Tue, 6 Feb 2024 13:53:35 +0000 (21:53 +0800)] 
core: introduce exec_params_need_credentials

Also rename EXEC_WRITE_CREDENTIALS to EXEC_SETUP_CREDENTIALS.

21 months agoTEST-54-CREDS: add test for ExecStartPost= (#31194)
Mike Yuan [Tue, 6 Feb 2024 09:10:49 +0000 (17:10 +0800)] 
TEST-54-CREDS: add test for ExecStartPost= (#31194)

21 months agocore/exec-credential: use FOREACH_ARRAY at one more place
Mike Yuan [Tue, 6 Feb 2024 14:20:49 +0000 (22:20 +0800)] 
core/exec-credential: use FOREACH_ARRAY at one more place

21 months agocore/exec-credential: add missing assertions
Mike Yuan [Tue, 6 Feb 2024 14:17:34 +0000 (22:17 +0800)] 
core/exec-credential: add missing assertions

21 months agowait-online: by default not all interface need to be online
Yu Watanabe [Fri, 2 Feb 2024 17:44:08 +0000 (02:44 +0900)] 
wait-online: by default not all interface need to be online

Fixes an issue caused by ab3aed4a0349bbaa26f53340770c1b59b463e05d (v253).

By default, all managed interface need to be configured, and at least
one interface need to be online. Hence, offline interface should be ignored.

Fixes #29506.

21 months agocryptenroll: Fix reading keyfile from socket
Felix Riemann [Fri, 2 Feb 2024 17:08:52 +0000 (18:08 +0100)] 
cryptenroll: Fix reading keyfile from socket

systemd-cryptenroll uses the READ_FULL_FILE_CONNECT_SOCKET flag when
reading the keyfile to also allow reading it from a socket. But it also
sets the offset to 0, causing an unnecessary seek to the beginning of
the newly opened keyfile and disables socket support again, as these do
not support seeking.

Disable seeking entirely to remove the unneeded seek and restore support
for reading the keyfile from a socket again as with systemd-cryptsetup.

21 months agoMerge pull request #31210 from poettering/chdir-hardening
Luca Boccassi [Tue, 6 Feb 2024 12:41:43 +0000 (12:41 +0000)] 
Merge pull request #31210 from poettering/chdir-hardening

WorkingDirectory= hardening

21 months agoMerge pull request #31205 from YHNdnzj/path-is-mount-point
Luca Boccassi [Tue, 6 Feb 2024 12:37:20 +0000 (12:37 +0000)] 
Merge pull request #31205 from YHNdnzj/path-is-mount-point

mountpoint-util: expose root and flags as path_is_mount_point_full

21 months agounits: drop userdbd from homed's Also=
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2024 19:01:25 +0000 (20:01 +0100)] 
units: drop userdbd from homed's Also=

Also= lists units which should be enabled/disabled together with the first unit.
But userdbd is independent of homed, we shouldn't e.g. disable it even if homed
is disabled.

21 months agoprocess-util: minor follow-up for pidfd_spawn
Mike Yuan [Tue, 6 Feb 2024 07:33:07 +0000 (15:33 +0800)] 
process-util: minor follow-up for pidfd_spawn

21 months agonspawn: and also add comment, making clear chdir() should come late 31210/head
Lennart Poettering [Mon, 5 Feb 2024 16:11:12 +0000 (17:11 +0100)] 
nspawn: and also add comment, making clear chdir() should come late

21 months agonspawn: also refuse paths below API VFS in nspawn's --chdir= field
Lennart Poettering [Mon, 5 Feb 2024 16:10:40 +0000 (17:10 +0100)] 
nspawn: also refuse paths below API VFS in nspawn's --chdir= field

21 months agoload-fragment: set PATH_CHECK_NON_API_VFS flag at various other places
Lennart Poettering [Mon, 5 Feb 2024 15:38:11 +0000 (16:38 +0100)] 
load-fragment: set PATH_CHECK_NON_API_VFS flag at various other places

I tried to be conservative here, and hence in doubt I left the flag off,
but in some cases I really can't see any reason why it would make sense
to specifiy paths into API VFS, hence add it there, to lock things down
a bit.

21 months agoparse-helpers: adjust log level when we say we ignore to LOG_WARNING
Lennart Poettering [Mon, 5 Feb 2024 15:32:57 +0000 (16:32 +0100)] 
parse-helpers: adjust log level when we say we ignore to LOG_WARNING

21 months agodbus: make dbus property parsing of WorkingDirectory= equally strict as loading it...
Lennart Poettering [Mon, 5 Feb 2024 15:16:59 +0000 (16:16 +0100)] 
dbus: make dbus property parsing of WorkingDirectory= equally strict as loading it from the unit files

21 months agoexec-invoke: extend comment on placement of apply_working_directory() call
Lennart Poettering [Mon, 5 Feb 2024 14:42:46 +0000 (15:42 +0100)] 
exec-invoke: extend comment on placement of apply_working_directory() call

Inspired by CVE-2024-21626, let's add a longer comment explaining why
the code really shouldn#t be moved any earlier.

Just in the hope that anyone who feels tempted to move this around maybe
actually reads the comment and reconsiders.

21 months agoparse-helpers: add new PATH_CHECK_NON_API_VFS flag
Lennart Poettering [Mon, 5 Feb 2024 14:38:55 +0000 (15:38 +0100)] 
parse-helpers: add new PATH_CHECK_NON_API_VFS flag

In various contexts it's a bit icky to allow paths below /proc/, /sys/,
/dev/ i.e. file hierarchies where API VFS are placed. Let's add a new
flag for path_simplify_and_warn() to check for this and refuse a path if
in these paths.

Enable this when parsing WorkingDirectory=.

This is inspired by CVE-2024-21626, which uses trickery around the cwd
and /proc/self/fd/.

AFAICS we are not actually vulnerable to the same issue as explained in
the CVE since we execute the WorkingDirectory= setting very late, i.e.
long after we set up the new mount namespace. But let's filter out icky
stuff better earlier than later, as extra safety precaution.

21 months agomountpoint-util: add small helper that checks if a path is below the API VFS hierarchies
Lennart Poettering [Mon, 5 Feb 2024 14:38:20 +0000 (15:38 +0100)] 
mountpoint-util: add small helper that checks if a path is below the API VFS hierarchies

21 months agoexec-invoke: rework apply_working_directory() around chase()
Lennart Poettering [Mon, 5 Feb 2024 14:36:29 +0000 (15:36 +0100)] 
exec-invoke: rework apply_working_directory() around chase()

let's be more careful and get rid of one more prefix_roota() use, in
favour of the safe chase().

21 months agoparse-helpers: indent according to coding style
Lennart Poettering [Mon, 5 Feb 2024 14:15:57 +0000 (15:15 +0100)] 
parse-helpers: indent according to coding style

21 months agoMerge pull request #31209 from bluca/pidfd_spawn
Mike Yuan [Tue, 6 Feb 2024 07:14:17 +0000 (15:14 +0800)] 
Merge pull request #31209 from bluca/pidfd_spawn

core: add support for pidfd_spawn

21 months agomountpoint-util: introduce path_is_mount_point_full 31205/head
Mike Yuan [Sun, 4 Feb 2024 20:17:32 +0000 (04:17 +0800)] 
mountpoint-util: introduce path_is_mount_point_full

21 months agologin/user-runtime-dir: properly check for mount point
Mike Yuan [Sun, 4 Feb 2024 20:53:14 +0000 (04:53 +0800)] 
login/user-runtime-dir: properly check for mount point

21 months agoTODO: drop clone3 item 31209/head
Luca Boccassi [Mon, 5 Feb 2024 16:26:44 +0000 (16:26 +0000)] 
TODO: drop clone3 item

21 months agocore: add support for pidfd_spawn
Luca Boccassi [Fri, 12 Jan 2024 21:32:20 +0000 (21:32 +0000)] 
core: add support for pidfd_spawn

Added in glibc 2.39, allows cloning into a cgroup and to get
a pid fd back instead of a pid. Removes race conditions for
both changing cgroups and getting a reliable reference for the
child process.

Fixes https://github.com/systemd/systemd/pull/18843
Replaces https://github.com/systemd/systemd/pull/16706

21 months agoexecutor: really set POSIX_SPAWN_SETSIGDEF for posix_spawn
Luca Boccassi [Mon, 5 Feb 2024 14:22:52 +0000 (14:22 +0000)] 
executor: really set POSIX_SPAWN_SETSIGDEF for posix_spawn

posix_spawnattr_setflags() doesn't OR the input to the current set of flags,
it overwrites them, so we are currently losing POSIX_SPAWN_SETSIGDEF.

Follow-up for: 6ecdfe7d1008964eed3f67b489cef8c65a218bf1

21 months agoREADME: bump the gcc baseline to 8.4
Frantisek Sumsal [Mon, 5 Feb 2024 10:02:49 +0000 (11:02 +0100)] 
README: bump the gcc baseline to 8.4

We already use __VA_OPT__ in multiple places, which was introduced in
gcc 8 [0], so let's bump the baseline to reflect that. I chose gcc 8.4,
as that was the lowest 8.x version I could easily get my hands on when I
verified this (on Ubuntu Focal with the gcc-8 package).

Closes: #31191
[0] https://gcc.gnu.org/gcc-8/changes.html

21 months agoMerge pull request #31197 from YHNdnzj/protect-system-cred
Mike Yuan [Mon, 5 Feb 2024 08:06:42 +0000 (16:06 +0800)] 
Merge pull request #31197 from YHNdnzj/protect-system-cred

core/service: set up credentials for all start-post commands too

21 months agocore/service: allow ExecStartPost= cmds to access creds 31197/head
Mike Yuan [Sun, 4 Feb 2024 11:38:20 +0000 (19:38 +0800)] 
core/service: allow ExecStartPost= cmds to access creds

Fixes #31194

21 months agocore/service: don't setup credentials for ExecCondition= and ExecReload=
Mike Yuan [Sun, 4 Feb 2024 11:36:06 +0000 (19:36 +0800)] 
core/service: don't setup credentials for ExecCondition= and ExecReload=

This seems to be a mistake in #27279. I believe credentials should
not be made available to condition or reload tasks. In most cases
they're irrelevant from the actual job of the service. Also, currently
the first ExecCondition= or ExecReload= cannot access creds anyway,
making the incompatibility introduced negligible.

If people actually come up with valid use cases, we can always
revisit this.

21 months agocore/service: don't give ExecStopPost= commands tty access
Mike Yuan [Sun, 4 Feb 2024 11:34:16 +0000 (19:34 +0800)] 
core/service: don't give ExecStopPost= commands tty access

All tasks spawned later than ExecStart= (e.g. ExecReload=, ExecStop=, ...)
don't get tty access. ExecStopPost= is the odd one out. Fix that.

21 months agocore/service: introduce service_exec_flags
Mike Yuan [Sat, 3 Feb 2024 16:25:03 +0000 (00:25 +0800)] 
core/service: introduce service_exec_flags

As suggested in
https://github.com/systemd/systemd/pull/31197#pullrequestreview-1861297477

Note that this slightly changes the behavior for
ExecReload=, ExecCondition= and ExecStartPost=. Will
be explained/corrected in later commits.

21 months agocore/unit: use ASSERT_PTR and strdup_or_null more
Mike Yuan [Sun, 4 Feb 2024 10:48:31 +0000 (18:48 +0800)] 
core/unit: use ASSERT_PTR and strdup_or_null more

21 months agocore/exec-invoke: don't duplicate needs_sandboxing condition
Mike Yuan [Sat, 3 Feb 2024 15:54:00 +0000 (23:54 +0800)] 
core/exec-invoke: don't duplicate needs_sandboxing condition

21 months agocore/exec-credential: make param const where appropriate
Mike Yuan [Sat, 3 Feb 2024 15:50:07 +0000 (23:50 +0800)] 
core/exec-credential: make param const where appropriate

21 months agobulgarian: use "RateLimitIntervalSec" rather than "RateLimitInterval"
James Muir [Sat, 3 Feb 2024 16:03:19 +0000 (11:03 -0500)] 
bulgarian: use "RateLimitIntervalSec" rather than "RateLimitInterval"

Update Bulgarian translation.  "RateLimitIntervalSec" is the current option
name.  "RateLimitInterval" is the legacy option name.

21 months agotest_ukify: use raw string for the regex
Frantisek Sumsal [Sat, 3 Feb 2024 14:46:26 +0000 (15:46 +0100)] 
test_ukify: use raw string for the regex

To get rid of the "invalid escape sequence" warning:

=============================== warnings summary ===============================
../src/ukify/test/test_ukify.py:876
  ../src/ukify/test/test_ukify.py:876: SyntaxWarning: invalid escape sequence '\s'
    assert re.search('Issuer: CN\s?=\s?SecureBoot signing key on host', out)

21 months agopo: Translated using Weblate (Swedish)
Anders Jonsson [Sat, 3 Feb 2024 10:36:41 +0000 (11:36 +0100)] 
po: Translated using Weblate (Swedish)

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/sv/
Translation: systemd/main

21 months agonspawn: permit --ephemeral with --link-journal=try-* (treat as =no)
Ivan Shapovalov [Sat, 20 Jan 2024 11:52:28 +0000 (12:52 +0100)] 
nspawn: permit --ephemeral with --link-journal=try-* (treat as =no)

Common sense says that to "try" something means "to not fail if
something turns out not to be possible", thus do not make this
combination a hard error.

The actual implementation ignores any --link-journal= setting when
--ephemeral is in effect, so the semantics are upheld.

21 months agocryptenroll: allow to use a public key on a token
Vladimir Stoiakin [Mon, 2 Oct 2023 13:37:26 +0000 (16:37 +0300)] 
cryptenroll: allow to use a public key on a token

This patch allows systemd-cryptenroll to enroll directly with a public key if a certificate is missing on a token.

Fixes: #30675
21 months agoman/systemd-bsod: fix command path
Antonio Alvarez Feijoo [Fri, 2 Feb 2024 15:54:40 +0000 (16:54 +0100)] 
man/systemd-bsod: fix command path

21 months agotest: wait until the test binary starts the test aux scope
Frantisek Sumsal [Thu, 1 Feb 2024 09:22:49 +0000 (10:22 +0100)] 
test: wait until the test binary starts the test aux scope

Otherwise we might continue too early on slower machines:

[   53.777485] testsuite-07.sh[675]: + systemd-run --unit test-aux-scope.service -p Slice=aux.slice -p Type=exec -p TasksMax=99 -p CPUWeight=199 -p IPAccounting=yes /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope
[   55.399526] testsuite-07.sh[679]: Running as unit: test-aux-scope.service; invocation ID: 375dc3e2d12f4af1bedfe80a23709e37
[   55.512917] testsuite-07.sh[691]: ++ systemctl show --value --property MainPID test-aux-scope.service
[   56.947713] testsuite-07.sh[675]: + kill -s USR1 680
[   56.947713] testsuite-07.sh[675]: + sleep 1
[   58.058809] testsuite-07.sh[675]: + systemctl status test-aux-scope.service
[   58.902808] testsuite-07.sh[695]: ● test-aux-scope.service - /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope
[   58.902808] testsuite-07.sh[695]:      Loaded: loaded (/run/systemd/transient/test-aux-scope.service; transient)
[   58.902808] testsuite-07.sh[695]:   Transient: yes
[   58.902808] testsuite-07.sh[695]:      Active: active (running) since Thu 2024-02-01 04:53:57 UTC; 3s ago
[   58.902808] testsuite-07.sh[695]:    Main PID: 680 (test-aux-scope)
[   58.902808] testsuite-07.sh[695]:          IP: 0B in, 0B out
[   58.902808] testsuite-07.sh[695]:       Tasks: 11 (limit: 99)
[   58.902808] testsuite-07.sh[695]:      Memory: 3.2M (peak: 3.5M)
[   58.902808] testsuite-07.sh[695]:         CPU: 235ms
[   58.902808] testsuite-07.sh[695]:      CGroup: /aux.slice/test-aux-scope.service
[   58.902808] testsuite-07.sh[695]:              ├─680 /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope
[   58.902808] testsuite-07.sh[695]:              ├─681 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─682 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─683 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─684 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─685 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─686 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─687 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─688 "(worker)"
[   58.902808] testsuite-07.sh[695]:              ├─689 "(worker)"
[   58.902808] testsuite-07.sh[695]:              └─690 "(worker)"
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: test-aux-scope.service: Enqueued job test-aux-scope.service/start as 277
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: test-aux-scope.service: Will spawn child (service_enter_start): /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: test-aux-scope.service: Passing 0 fds to service
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: test-aux-scope.service: About to execute: /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: test-aux-scope.service: Forked /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope as 680
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: test-aux-scope.service: Changed dead -> start
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd[1]: Starting test-aux-scope.service...
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H systemd-executor[680]: SELinux enabled state cached to: disabled
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H (ux-scope)[680]: Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
[   58.902808] testsuite-07.sh[695]: Feb 01 04:53:57 H (ux-scope)[680]: Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
[   58.979659] testsuite-07.sh[701]: ++ ps -eo pid,unit
[   59.014968] testsuite-07.sh[702]: ++ grep -c test-aux-scope.service
[   59.729453] systemd[1]: Cannot find unit for notify message of PID 691, ignoring.
[   60.321547] testsuite-07.sh[675]: + test 11 = 1
[   60.332496] testsuite-07.sh[669]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-07.aux-scope.sh failed'

21 months agoMerge pull request #31032 from yuwata/pam-session-close
Yu Watanabe [Fri, 2 Feb 2024 00:51:08 +0000 (09:51 +0900)] 
Merge pull request #31032 from yuwata/pam-session-close

pam: fix warning "Attempted to close sd-bus after fork, this should not happen." on session close

21 months agocoredump: log minimal metadata early
Harald Brinkmann [Tue, 28 Nov 2023 12:48:59 +0000 (13:48 +0100)] 
coredump: log minimal metadata early

21 months agoMerge pull request #31166 from mrc0mmand/vpick-tweaks
Yu Watanabe [Fri, 2 Feb 2024 00:37:13 +0000 (09:37 +0900)] 
Merge pull request #31166 from mrc0mmand/vpick-tweaks

vpick: make a working copy of the current dname

21 months agotest-network: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:29:10 +0000 (09:29 +0900)] 
test-network: fix typo

Follow-up for d4c8de21a07d015f2f2c787e0735be5e4d02fb3c.

21 months agotest: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:27:49 +0000 (09:27 +0900)] 
test: fix typo

Follow-up for fa8ff98ea4886442bebecd337da78e4dac3d0cb1.

21 months agoman/creds: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:25:51 +0000 (09:25 +0900)] 
man/creds: fix typo

Follow-up for 7704c3474d0f3176f5d84efee5f44f9d815e615f.

21 months agoman: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:24:22 +0000 (09:24 +0900)] 
man: fix typo

Follow-up for 34bbda18a5f07fa5a52e8d85d20637ce1c00c4ec.

21 months agosd-bus: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:22:40 +0000 (09:22 +0900)] 
sd-bus: fix typo

Follow-up for 25fd5343ca3a3481d2e0d3f3aebab2fcf4e42bc7.

21 months agosd-bus: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:21:15 +0000 (09:21 +0900)] 
sd-bus: fix typo

Follow-up for 71be64064c9e22c9edcb0c25d7ccc9e3c9ed1978.

21 months agocreds: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:20:02 +0000 (09:20 +0900)] 
creds: fix typo

Follow-up for 8464f7cbd652af75566017c62bec5308d1c30775.

21 months agolocal-addresses: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:18:35 +0000 (09:18 +0900)] 
local-addresses: fix typo

Follow-up for 5cb56068d0aae4c85e97a4ae16e33a7614cdc0bb.

21 months agotpm2-util: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:17:22 +0000 (09:17 +0900)] 
tpm2-util: fix typo

Follow-up for d37c312b87aeba4a470ad720eda56cdbc9ea2290.

21 months agonetwork/ndisc: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:15:59 +0000 (09:15 +0900)] 
network/ndisc: fix typo

Follow-up for d4c8de21a07d015f2f2c787e0735be5e4d02fb3c.

21 months agorepart: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:14:46 +0000 (09:14 +0900)] 
repart: fix typo

Follow-up for a575f2148f5bf619c75b3c2edadd7a94518ae74d.

21 months agocore/unit: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:13:00 +0000 (09:13 +0900)] 
core/unit: fix typo

Follow-up for 16b6af6adefa4068b10e1a04f46fc895cb9a3af7.

21 months agocgroup-util: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:11:40 +0000 (09:11 +0900)] 
cgroup-util: fix typo

Follow-up for 677e6c14b199c1fa637b7c4c8cae39c31213a79d.

21 months agouser-util: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:09:55 +0000 (09:09 +0900)] 
user-util: fix typo

Follow-up for 75673cd8aee5c6174538e71dd36c7a353c836973.

21 months agoTODO: fix typo
Yu Watanabe [Fri, 2 Feb 2024 00:07:28 +0000 (09:07 +0900)] 
TODO: fix typo

Follow-up for fd40e7da6e005644445d2f6cb3363daf1e170b8c.

21 months agocore: use PidRef in exec_spawn
Luca Boccassi [Fri, 12 Jan 2024 21:18:27 +0000 (21:18 +0000)] 
core: use PidRef in exec_spawn

21 months agovpick: use prefix_roota() to avoid double slash in log messages 31166/head
Frantisek Sumsal [Thu, 1 Feb 2024 13:00:48 +0000 (14:00 +0100)] 
vpick: use prefix_roota() to avoid double slash in log messages

If the toplevel_path is empty we end up with doubled leading slash,
which looks weird:

[ 4737.028985] testsuite-74.sh[102]: Inode '//var/lib/machines/mytree.v/mytree_37.0_arm64+2-3' has wrong type, found 'dir'.
[ 4737.028985] testsuite-74.sh[102]: Failed to pick version for '/var/lib/machines/mytree.v': Is a directory
...
[ 4316.957536] testsuite-74.sh[99]: Failed to open '//var/lib/machines/mytree.v/mytree_37.0': No such file or directory
...

21 months agovpick: make a working copy of the current dname
Frantisek Sumsal [Thu, 1 Feb 2024 12:56:37 +0000 (13:56 +0100)] 
vpick: make a working copy of the current dname

Since we might edit the string later on by inserting NULs, which then
leads up to using an invalid dname when opening the potential chosen
directory:

[ 4316.957536] testsuite-74.sh[99]: make_choice: entry: mytree_37.0_arm64+2-3
[ 4316.957536] testsuite-74.sh[99]: make_choice: best_version: 37.0
[ 4316.957536] testsuite-74.sh[99]: make_choice: best_filename: mytree_37.0
[ 4316.957536] testsuite-74.sh[99]: Failed to open '//var/lib/machines/mytree.v/mytree_37.0': No such file or directory

Uncovered by vpick tests from TEST-74-AUX-UTILS when run on aarch64.

21 months agohomework: Use minimal pbkdf2 parameters without benchmark.
Ondrej Kozina [Wed, 31 Jan 2024 15:12:58 +0000 (16:12 +0100)] 
homework: Use minimal pbkdf2 parameters without benchmark.

21 months agobuild(deps): bump actions/upload-artifact from 4.0.0 to 4.3.0
dependabot[bot] [Thu, 1 Feb 2024 09:47:34 +0000 (09:47 +0000)] 
build(deps): bump actions/upload-artifact from 4.0.0 to 4.3.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.0.0 to 4.3.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/c7d193f32edcb7bfad88892161225aeda64e9392...26f96dfa697d77e81fd5907df203aa23a56210a8)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
21 months agoMerge pull request #31107 from yuwata/pam-setcred-vs-close-session
Mike Yuan [Thu, 1 Feb 2024 11:02:40 +0000 (19:02 +0800)] 
Merge pull request #31107 from yuwata/pam-setcred-vs-close-session

core/exec-invoke: call pam_setcred(PAM_DELETE_CRED) after pam_close_session()

21 months agobuild(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
dependabot[bot] [Thu, 1 Feb 2024 09:47:37 +0000 (09:47 +0000)] 
build(deps): bump redhat-plumbers-in-action/advanced-issue-labeler

Bumps [redhat-plumbers-in-action/advanced-issue-labeler](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler) from 2.0.6 to 3.0.0.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/compare/71bcf99aef4b9ea844db9a43755e8ac02c8e661e...9e55064634b67244f7deb4211452b4a7217b93de)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/advanced-issue-labeler
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
21 months agotest: check pam warning message 31032/head
Yu Watanabe [Sun, 21 Jan 2024 04:14:15 +0000 (13:14 +0900)] 
test: check pam warning message

21 months agopam: do not warn closing bus connection which is opened after the fork
Yu Watanabe [Sun, 21 Jan 2024 04:11:09 +0000 (13:11 +0900)] 
pam: do not warn closing bus connection which is opened after the fork

In pam_systemd.so and pam_systemd_home.so, we open a bus connection on
session close, which is called after fork. Closing the connection is
harmless, and should not warn about that.

This suppresses the following log message:
===
(sd-pam)[127]: PAM Attempted to close sd-bus after fork, this should not happen.
===

21 months agoexec-invoke: update log message a bit 31107/head
Yu Watanabe [Mon, 29 Jan 2024 04:37:57 +0000 (13:37 +0900)] 
exec-invoke: update log message a bit

21 months agocore/exec-invoke: call pam_setcred(PAM_DELETE_CRED) after pam_close_session()
Yu Watanabe [Thu, 25 Jan 2024 18:09:13 +0000 (03:09 +0900)] 
core/exec-invoke: call pam_setcred(PAM_DELETE_CRED) after pam_close_session()

The man page pam_setcred(3) states:
> The credentials should be deleted after the session has been closed
> (with pam_close_session(3)).

Follow-up for 3bb39ea936a51a6a63a8b65a135521df098c32c4.

21 months agoresolve: include interface name in org.freedesktop.resolve1 polkit checks
networkException [Mon, 29 Jan 2024 21:31:59 +0000 (22:31 +0100)] 
resolve: include interface name in org.freedesktop.resolve1 polkit checks

this patch adds the interface name of the interface to be modified
to *details* when verifying dbus calls to the `org.freedesktop.resolve1`
D-Bus interface for all `Set*` and the `Revert` method.

when defining a polkit rule, this allows limiting the access to a specific
interface:

```js
// This rule prevents the user "vpn" to disable DNSoverTLS for any
// other interface than "vpn0". The vpn service should be allowed
// to disable DNSoverTLS on its own as it provides a local DNS
// server with search domains on the interface and this server does
// not support DNSoverTLS.
polkit.addRule(function(action, subject) {
  if (action.id == "org.freedesktop.resolve1.set-dns-over-tls" &&
      action.lookup("interface") == "vpn0" &&
      subject.user == "vpn") {
    return polkit.Result.YES;
  }
});
```

21 months agoMerge pull request #31141 from poettering/resolvectl-more-json
Lennart Poettering [Wed, 31 Jan 2024 17:59:11 +0000 (18:59 +0100)] 
Merge pull request #31141 from poettering/resolvectl-more-json

resolvectl: add JSON output support for "resolvectl query"

21 months agoresolvectl: add basic ANSI markup to --help text 31141/head
Lennart Poettering [Wed, 31 Jan 2024 14:56:58 +0000 (15:56 +0100)] 
resolvectl: add basic ANSI markup to --help text

Underline the sections, as we nowadays do.

21 months agoresolvectl: add JSON output support for "resolvectl query"
Lennart Poettering [Wed, 31 Jan 2024 10:28:12 +0000 (11:28 +0100)] 
resolvectl: add JSON output support for "resolvectl query"

It's easy to add. Let's do so.

This only covers record lookups, i.e. with the --type= switch.

The higher level lookups are not covered, I opted instead to print a
message there to use --type= instead.

I am a bit reluctant to defining a new JSON format for the high-level
lookups, hence I figured for now a helpful error is good enough, that
points people to the right use.

Fixes: #29755
21 months agoMerge pull request #31144 from poettering/less-loopback
Lennart Poettering [Wed, 31 Jan 2024 15:05:37 +0000 (16:05 +0100)] 
Merge pull request #31144 from poettering/less-loopback

don't try to setup a loopback network device unless CLONE_NEWNET is selected (i.e. not in CLONE_NEWIPC case)

21 months agotest: use a dropin for the journald snippet
Frantisek Sumsal [Wed, 31 Jan 2024 09:45:13 +0000 (10:45 +0100)] 
test: use a dropin for the journald snippet

The original way of appending to /etc/systemd/journald.conf doesn't work
anymore, since we no longer ship the default configs in /etc/.

21 months agotest-namespace: SOCK_CLOEXEC'ify all the things 31144/head
Lennart Poettering [Wed, 31 Jan 2024 12:22:33 +0000 (13:22 +0100)] 
test-namespace: SOCK_CLOEXEC'ify all the things

21 months agonamespace: don't invoke loopback_setup() unless we allocate a CLONE_NEWNET namespace
Lennart Poettering [Wed, 31 Jan 2024 12:19:45 +0000 (13:19 +0100)] 
namespace: don't invoke loopback_setup() unless we allocate a CLONE_NEWNET namespace

It doesn't really make sense to initialize the loopback device if we are
not called for a network namespace.

Follow-up for 54c2459d560283f556e331246f64776cebd6eba6

21 months agoman: always install bootctl
Franck Bui [Wed, 31 Jan 2024 07:33:22 +0000 (08:33 +0100)] 
man: always install bootctl

Since dedb925eafee8214ae565b861dfacfc02085f158 /usr/bin/bootctl is always built
so does its man page.

21 months agoMerge pull request #30847 from keszybz/some-docs-updates
Lennart Poettering [Wed, 31 Jan 2024 10:09:56 +0000 (11:09 +0100)] 
Merge pull request #30847 from keszybz/some-docs-updates

Some docs updates

21 months agoupdate TODO
Lennart Poettering [Wed, 31 Jan 2024 09:10:49 +0000 (10:10 +0100)] 
update TODO

21 months agomkosi: Stop using file provides with CentOS/Fedora
Daan De Meyer [Tue, 30 Jan 2024 21:36:12 +0000 (22:36 +0100)] 
mkosi: Stop using file provides with CentOS/Fedora

dnf5 does not download filelists metadata by default anymore as this
consists of a pretty big chunk of the repository metadata. Let's make
sure the filelists metadata doesn't have to be downloaded by dnf5 by
removing any usage of file provides from our package lists.

21 months agohomed: Add InhibitSuspend() method
Adrian Vovk [Sun, 21 Jan 2024 01:29:40 +0000 (20:29 -0500)] 
homed: Add InhibitSuspend() method

This returns an FD that can be used to temporarily inhibit the automatic
locking on system suspend behavior of homed. As long as the FD is open,
LockAllHomes() won't lock that home directory on suspend. This allows
desktop environments to implement custom more complicated behavior

21 months agoMerge pull request #31039 from AdrianVovk/slice-freeze-thaw
Lennart Poettering [Wed, 31 Jan 2024 08:48:05 +0000 (09:48 +0100)] 
Merge pull request #31039 from AdrianVovk/slice-freeze-thaw

Rework slice recursive freeze/thaw

21 months agoMerge pull request #30968 from poettering/per-user-creds
Lennart Poettering [Wed, 31 Jan 2024 08:47:12 +0000 (09:47 +0100)] 
Merge pull request #30968 from poettering/per-user-creds

per-user encrypted credentials

21 months agomeson: fix installation of html doc aliases
Franck Bui [Tue, 30 Jan 2024 08:34:17 +0000 (09:34 +0100)] 
meson: fix installation of html doc aliases

Apparently since 9289e093ae6fd5484f9119e1ee07d1dffe37cd10, "ln_s" takes
*absolute* paths only.

21 months agomeson: don't install broken tmpfiles config with sshd?confdir == 'no'
Frantisek Sumsal [Tue, 30 Jan 2024 10:25:19 +0000 (11:25 +0100)] 
meson: don't install broken tmpfiles config with sshd?confdir == 'no'

20-systemd-ssh-generator.conf expands SSHCONFDIR, which is bogus when we
build with -Dsshconfdir=no. Similarly, avoid expanding SSHDCONFDIR in
20-systemd-userdb.conf when building with -Dsshconfdir=no.

Follow-up 6c7fc5d5f2.

21 months agotest: explicitly set nsec3-iterations to 0
Frantisek Sumsal [Tue, 30 Jan 2024 15:27:58 +0000 (16:27 +0100)] 
test: explicitly set nsec3-iterations to 0

knot v3.2 and later does this by default. knot v3.1 still has the default set to
10, but it also introduced a warning that the default will be changed to 0 in
later versions, so it effectively complains about its own default, which then
fails the config check. Let's just set the value explicitly to zero to avoid
that.

~# knotc --version
knotc (Knot DNS), version 3.1.6
~# grep nsec3-iterations test/knot-data/knot.conf || echo nope
nope
~# knotc -c /build/test/knot-data/knot.conf conf-check
warning: config, policy[auto_rollover_nsec3].nsec3-iterations defaults to 10, since version 3.2 the default becomes 0
Configuration is valid

Follow-up to 0652cf8e7b.

21 months agocore: Fail to start/stop/reload unit if frozen 31039/head
Adrian Vovk [Wed, 24 Jan 2024 00:50:21 +0000 (19:50 -0500)] 
core: Fail to start/stop/reload unit if frozen

Previously, unit_{start,stop,reload} would call the low-level cgroup
unfreeze function whenever a unit was started, stopped, or reloaded. It
did so with no error checking. This call would ultimately recurse up the
cgroup tree, and unfreeze all the parent cgroups of the unit, unless an
error occurred (in which case I have no idea what would happen...)

After the freeze/thaw rework in a previous commit, this can no longer
work. If we recursively thaw the parent cgroups of the unit, there may
be sibling units marked as PARENT_FROZEN which will no longer actually
have frozen parents. Fixing this is a lot more complicated than simply
disallowing start/stop/reload on a frozen unit

Fixes https://github.com/systemd/systemd/issues/15849

21 months agocore: Rework recursive freeze/thaw
Adrian Vovk [Sun, 21 Jan 2024 20:05:20 +0000 (15:05 -0500)] 
core: Rework recursive freeze/thaw

This commit overhauls the way freeze/thaw works recursively:

First, it introduces new FreezerActions that are like the existing
FREEZE and THAW but indicate that the action was initiated by a parent
unit. We also refactored the code to pass these FreezerActions through
the whole call stack so that we can make use of them. FreezerState was
extended similarly, to be able to differentiate between a unit that's
frozen manually and a unit that's frozen because a parent is frozen.

Next, slices were changed to check recursively that all their child
units can be frozen before it attempts to freeze them. This is different
from the previous behavior, that would just check if the unit's type
supported freezing at all. This cleans up the code, and also ensures
that the behavior of slices corresponds to the unit's actual ability
to be frozen

Next, we make it so that if you FREEZE a slice, it'll PARENT_FREEZE
all of its children. Similarly, if you THAW a slice it will PARENT_THAW
its children.

Finally, we use the new states available to us to refactor the code
that actually does the cgroup freezing. The code now looks at the unit's
existing freezer state and the action being requested, and decides what
next state is most appropriate. Then it puts the unit in that state.
For instance, a RUNNING unit with a request to PARENT_FREEZE will
put the unit into the PARENT_FREEZING state. As another example, a
FROZEN unit who's parent is also FROZEN will transition to
PARENT_FROZEN in response to a request to THAW.

Fixes https://github.com/systemd/systemd/issues/30640
Fixes https://github.com/systemd/systemd/issues/15850

21 months agoMerge pull request #31109 from yuwata/nspawn-resolve-network-interface-before-move
Lennart Poettering [Tue, 30 Jan 2024 16:09:11 +0000 (17:09 +0100)] 
Merge pull request #31109 from yuwata/nspawn-resolve-network-interface-before-move

nspawn: resolve network interface names before move to container namespace

21 months agoMerge pull request #31120 from YHNdnzj/strv-env-non-pure
Lennart Poettering [Tue, 30 Jan 2024 16:08:49 +0000 (17:08 +0100)] 
Merge pull request #31120 from YHNdnzj/strv-env-non-pure

env-util: drop _pure_ for strv_env_get_n

21 months agoMerge pull request #31124 from keszybz/various-small-tweaks
Lennart Poettering [Tue, 30 Jan 2024 16:08:21 +0000 (17:08 +0100)] 
Merge pull request #31124 from keszybz/various-small-tweaks

Various small tweaks

21 months agoupdate TODO 30968/head
Lennart Poettering [Mon, 15 Jan 2024 14:03:09 +0000 (15:03 +0100)] 
update TODO

21 months agoman: document new user-scoped credentials
Lennart Poettering [Tue, 16 Jan 2024 15:56:12 +0000 (16:56 +0100)] 
man: document new user-scoped credentials

21 months agotest: add integration test for per-user creds
Lennart Poettering [Tue, 16 Jan 2024 14:22:31 +0000 (15:22 +0100)] 
test: add integration test for per-user creds

21 months agocreds: go via IPC service when unprivileged and trying to access services
Lennart Poettering [Tue, 16 Jan 2024 10:05:22 +0000 (11:05 +0100)] 
creds: go via IPC service when unprivileged and trying to access services

Fixes: #30191
21 months agocreds-util: add IPC client wrapper for new varlink apis
Lennart Poettering [Wed, 17 Jan 2024 20:45:12 +0000 (21:45 +0100)] 
creds-util: add IPC client wrapper for new varlink apis