]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 months agosystemctl: drop chain invocation of telinit
Michael Biebl [Thu, 8 Feb 2024 13:06:00 +0000 (14:06 +0100)] 
systemctl: drop chain invocation of telinit

This functionality relied on telinit being available in a different path
then the compat symlink shipped by systemd itself. This is no longer the
case for any known distro, so remove that code.

Fixes: #31220
Replaces: #31249

3 months agoman: enchance sd_bus_set_watch_bind() example to handle one more failure
Luca Boccassi [Wed, 14 Feb 2024 17:14:21 +0000 (17:14 +0000)] 
man: enchance sd_bus_set_watch_bind() example to handle one more failure

In case the D-Bus policy is not set up correctly the example just
loops forever. Check the return of sd_bus_request_name_async() in
a callback and exit if the error is not temporary.

Follow-up for 34bbda18a5f07fa5a52e8d85d20637ce1c00c4ec

3 months agokeyring-util: Use reported key size to resize buf
Adrian Vovk [Thu, 1 Feb 2024 22:53:01 +0000 (17:53 -0500)] 
keyring-util: Use reported key size to resize buf

According to keyctl(2), the return value for KEYCTL_READ is:

    The amount of data that is available in the key,
    irrespective of the provided buffer size

So, we could pass in a NULL buffer to query the size, then allocate the
exact right amount of space, then call keyctl again to get the key data.
However, we must still keep the for loop to avoid TOCTOU issues: the key
might have been replaced with something bigger while we're busy
allocating the buffer to store it.

Thus, we can actually save a syscall by picking some reasonable default
buffer size and skipping the NULL call to keyctl. If our default is big
enough, we're done and have saved a syscall! If not, then the first call
behaves essentially the same as the NULL call, and we use the size it
returns to reallocate the buffer appropriately.

3 months agonspawn: add support for owneridmap bind option
Benjamin Franzke [Fri, 17 Nov 2023 07:03:57 +0000 (08:03 +0100)] 
nspawn: add support for owneridmap bind option

owneridmap bind option will map the target directory owner from inside the
container to the owner of the directory bound from the host filesystem.
This will ensure files and directories created in the container will be owned
by the directory owner of the host filesystem. All other users will remain
unmapped. Files to be written as other users in the container will not be
allowed.

Resolves: #27037

3 months agolog: reorder arguments of internal macro
Yu Watanabe [Thu, 15 Feb 2024 01:49:49 +0000 (10:49 +0900)] 
log: reorder arguments of internal macro

To make the order matches with log_internal().

No functional change. Hopefully silence coverity issues like
CID#1534478, CID#1534479, CID#1534480, CID#1534482.

3 months agotest: fix cleanup function
Yu Watanabe [Thu, 15 Feb 2024 03:11:06 +0000 (12:11 +0900)] 
test: fix cleanup function

Follow-up for 8349bbdfd829c80fc5eabaca6c9d0afed28d1b3f.

3 months agohomed: Pass in username and uid as Polkit details
Adrian Vovk [Fri, 2 Feb 2024 19:53:01 +0000 (14:53 -0500)] 
homed: Pass in username and uid as Polkit details

This lets the Javascript polkit policies to decide whether to
allow/deny/authenticate based on the user that's being operated on.

3 months agovmspawn: fix alignment of merged initrd
Yu Watanabe [Thu, 15 Feb 2024 01:44:21 +0000 (10:44 +0900)] 
vmspawn: fix alignment of merged initrd

Follow-up for 811ad9e6b2b243428165c239aeb4791bc65b93dd.

Fixes CID#1534481.

3 months agoMerge pull request #31330 from yuwata/sd-journal-trivial-cleanups
Daan De Meyer [Thu, 15 Feb 2024 07:56:56 +0000 (08:56 +0100)] 
Merge pull request #31330 from yuwata/sd-journal-trivial-cleanups

sd-journal: trivial cleanups

3 months agocopy: rebreak comment and fix typo
Yu Watanabe [Thu, 15 Feb 2024 01:19:02 +0000 (10:19 +0900)] 
copy: rebreak comment and fix typo

3 months agosd-journal: fix potential memory leak 31330/head
Yu Watanabe [Wed, 14 Feb 2024 00:21:13 +0000 (09:21 +0900)] 
sd-journal: fix potential memory leak

Though, hopefully, the memory leak is hypothetical, as we always close
journal file with the timer by journal_file_offline_close().

3 months agojournal-file-util: drop unused template argument for journal_file_open_reliably()
Yu Watanabe [Fri, 9 Feb 2024 11:21:25 +0000 (20:21 +0900)] 
journal-file-util: drop unused template argument for journal_file_open_reliably()

I understand that the original motivation to introduce the template
argument here is to make journal_file_open() and _reliabrly() take the
same arguments. But, yeah, that's completely unused, not necessary to
complicate the code even the difference is not big.

3 months agosd-journal: use -EBADF for journal_file_open()
Yu Watanabe [Wed, 14 Feb 2024 21:06:20 +0000 (06:06 +0900)] 
sd-journal: use -EBADF for journal_file_open()

3 months agosd-journal: shorten code a bit
Yu Watanabe [Fri, 9 Feb 2024 11:07:22 +0000 (20:07 +0900)] 
sd-journal: shorten code a bit

3 months agotest-network: show interface status again when wait-online failed
Yu Watanabe [Wed, 14 Feb 2024 20:51:14 +0000 (05:51 +0900)] 
test-network: show interface status again when wait-online failed

Fixes a bug in 10d670a3c1c4b06782a76fc50e70a4719f7bb7ed.

This also makes wait_online() show a short message when a requested
interface not found.

3 months agoMerge pull request #31173 from yuwata/network-route-check-conflict
Yu Watanabe [Wed, 14 Feb 2024 23:12:42 +0000 (08:12 +0900)] 
Merge pull request #31173 from yuwata/network-route-check-conflict

network/route: check if existing route can be updated

3 months agologin: fix typo
Yu Watanabe [Wed, 14 Feb 2024 20:38:44 +0000 (05:38 +0900)] 
login: fix typo

Follow-up for 6e9bf0ad29f4027586f854763c27a35fedcb75df.

3 months agoMerge pull request #31286 from poettering/bootctl-varlink
Luca Boccassi [Wed, 14 Feb 2024 18:59:33 +0000 (18:59 +0000)] 
Merge pull request #31286 from poettering/bootctl-varlink

bootctl: add simple varlink IPC interface

3 months agoMerge pull request #31317 from fbuihuu/update-tests-for-suse
Luca Boccassi [Wed, 14 Feb 2024 17:31:40 +0000 (17:31 +0000)] 
Merge pull request #31317 from fbuihuu/update-tests-for-suse

Update tests for SUSE

3 months agoImprove IgnoreSIGPIPE description
Winterhuman [Wed, 14 Feb 2024 15:02:35 +0000 (15:02 +0000)] 
Improve IgnoreSIGPIPE description

Reword the description of the `IgnoreSIGPIPE=` service option to be more grammatical.

3 months agosystemctl: don't warn unit needs reload if --no-warn
Mike Yuan [Wed, 14 Feb 2024 13:19:21 +0000 (21:19 +0800)] 
systemctl: don't warn unit needs reload if --no-warn

3 months agoMerge pull request #30226 from poettering/homed-fallback-shell
Lennart Poettering [Wed, 14 Feb 2024 16:08:04 +0000 (17:08 +0100)] 
Merge pull request #30226 from poettering/homed-fallback-shell

homed: allow logging into home areas via ssh without unlocking them locally first

3 months agotest-network: add test for advertised hop limit 31173/head
Yu Watanabe [Thu, 8 Feb 2024 09:49:44 +0000 (18:49 +0900)] 
test-network: add test for advertised hop limit

For issue #28437.

3 months agonetwork/ndisc: also set sysctl hop_limit value
Matt Muggeridge [Wed, 7 Feb 2024 21:21:58 +0000 (06:21 +0900)] 
network/ndisc: also set sysctl hop_limit value

Otherwise, the hop limit set to the routes may not be used in some
situations.

Fixes #28437.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
3 months agotest-network: add test case for removing conflicting routes
Yu Watanabe [Thu, 8 Feb 2024 09:24:33 +0000 (18:24 +0900)] 
test-network: add test case for removing conflicting routes

For issue #28439.

3 months agotest-network: drop unnecessary IPv6SendRA=yes setting
Yu Watanabe [Thu, 8 Feb 2024 10:01:27 +0000 (19:01 +0900)] 
test-network: drop unnecessary IPv6SendRA=yes setting

3 months agonetwork/ndisc: remove conflicting routes on configuring routes based on newly received RA
Yu Watanabe [Fri, 2 Feb 2024 03:30:32 +0000 (12:30 +0900)] 
network/ndisc: remove conflicting routes on configuring routes based on newly received RA

The linux kernel does not update several parameters, e.g. RTA_PREF.
Hence, when we configure routes based on a RA, we need to remove
existing conflicting routes.

Fixes #28426 and #28439.

3 months agonetwork/route: remove existing route if some property conflict with requested ones
Yu Watanabe [Fri, 2 Feb 2024 03:18:33 +0000 (12:18 +0900)] 
network/route: remove existing route if some property conflict with requested ones

Fixes #28853.

3 months agonetwork: rename link_drop_managed_xyz() -> link_drop_static_xyz()
Yu Watanabe [Fri, 9 Feb 2024 05:33:07 +0000 (14:33 +0900)] 
network: rename link_drop_managed_xyz() -> link_drop_static_xyz()

As networkd does not configure nexthops, neighbors, or routing policy rules
dynamically, this only changes link_drop_managed_addresses(). Previously
it also removed dynamic addresses, but with this commit, now it only
removes static addresses. Note, link_drop_managed_routes() has removed
only static routes, so this commit only changes its name.

Note. as commented in the code, the dynamic addresses will be removed
on lease expiration or stopping client, and link_drop_managed_xyz() are
called on reconfiguration or so, and at that time, all dynamic
addressing clients are stopped or restarted, so this should not
effective behavior change.

3 months agonetwork/ndisc: also drop SLAAC addresses and routes on reconfiguring
Yu Watanabe [Fri, 9 Feb 2024 05:50:46 +0000 (14:50 +0900)] 
network/ndisc: also drop SLAAC addresses and routes on reconfiguring

Especially, this is important for routes, as link_drop_managed_routes()
removes only static routes, rather than non-foreign routes.

3 months agotest-network: allow to specify multiple interfaces to wait_online() without square...
Yu Watanabe [Fri, 9 Feb 2024 09:26:37 +0000 (18:26 +0900)] 
test-network: allow to specify multiple interfaces to wait_online() without square bracket

3 months agobootctl: add a Varlink interface 31286/head
Lennart Poettering [Mon, 12 Feb 2024 16:30:31 +0000 (17:30 +0100)] 
bootctl: add a Varlink interface

For now, just super basic functionality: return the list of boot menu
entries, and read/write the reboot to firmware flag

3 months agobootspec: split out helper that turns BootEntry into a JSON object
Lennart Poettering [Mon, 12 Feb 2024 16:29:17 +0000 (17:29 +0100)] 
bootspec: split out helper that turns BootEntry into a JSON object

We can use that later for returning the boot loader entry list as JSON
via Varlink.

3 months agoefi-loader: make efi_loader_get_entries() handling missing NUL termination gracefully
Lennart Poettering [Mon, 12 Feb 2024 16:23:59 +0000 (17:23 +0100)] 
efi-loader: make efi_loader_get_entries() handling missing NUL termination gracefully

Our function so far assumed that the LoaderEntries's last string is or
is not NUL terminated. But if it was, then we'd debug log about this,
claiming there was an invalid id. sd-boot actually ends the list in a
properly NUL-terminated string, hence we should just accept that. Handle
that case gracefully, and add comments explaining why we have two ways
why we exit the loop.

This is cosmetic only, just suppresses a misleading debug log message.

3 months agoupdate TODO 30226/head
Lennart Poettering [Mon, 27 Nov 2023 14:09:05 +0000 (15:09 +0100)] 
update TODO

3 months agotest: add test that ensures homed logins via SSH work
Lennart Poettering [Tue, 28 Nov 2023 14:44:41 +0000 (15:44 +0100)] 
test: add test that ensures homed logins via SSH work

3 months agopam_systemd_home: make sure we handle RefUnit() returning HomeBusy properly
Lennart Poettering [Tue, 28 Nov 2023 14:42:13 +0000 (15:42 +0100)] 
pam_systemd_home: make sure we handle RefUnit() returning HomeBusy properly

RefUnit() only succeeds it a home dir is fully up. We already dealt with
it not being up at all, but let's also cover the case where it is
currently busy with changing state, and in that case fall back to
RefUnrestricted(), with the usual implications.

This has the effect that two subsequent ssh logins one-after-the-other
will work correctly.

3 months agoman: update D-Bus docs with new calls
Lennart Poettering [Mon, 27 Nov 2023 21:34:12 +0000 (22:34 +0100)] 
man: update D-Bus docs with new calls

3 months agohomed: generate fallback data in user record, for inactive homes
Lennart Poettering [Fri, 13 May 2022 16:38:56 +0000 (18:38 +0200)] 
homed: generate fallback data in user record, for inactive homes

3 months agopam_systemd_home: in ssh logins and similar, ask via fallback shall for home password
Lennart Poettering [Mon, 27 Nov 2023 22:00:12 +0000 (23:00 +0100)] 
pam_systemd_home: in ssh logins and similar, ask via fallback shall for home password

ssh runs PAM session hooks before they allocate a pty for the session.
(That's because they allow multiplexed connections, and hence might run
multiple ptys over the same same session). This means PAM modules cannot
interactively ask the user for additional information as they deem fit.
That's a problem for us, since generally during an SSH login no
authentication token (aka "password") is supplied to us which we could
use to unlock the user's home dir.

With this commit we implement a way out: we allow the login to proceed,
but without the home dir activated, and then override the user's shell
with our fallback shell, which will ask for the user's password and then
chainload the actual shell.

This will of course only work if the login actually involves invoking
the configured interactive shell of the user. For other logins (such as
sftp or so), this cannot work, and they'll see an empty home dir
instead.

3 months agohomectl: implement fallback shell stub
Lennart Poettering [Fri, 13 May 2022 22:03:16 +0000 (00:03 +0200)] 
homectl: implement fallback shell stub

3 months agohomed: add a ActivateHomeIfReferenced() bus call
Lennart Poettering [Mon, 27 Nov 2023 16:05:54 +0000 (17:05 +0100)] 
homed: add a ActivateHomeIfReferenced() bus call

This is very similar to ActivateHome() but will fail if the home
directory is not referenced yet. Or in other words, this doesn't add any
new reference, but simply is the other side of RefUnrestricted(): if we
allowed a home dir to be referenced without it actually being active,
then this can catch up with things and activated what was previously
referenced already.

This also relaxes access rights to that users can always activate their
own home dirs. This is useful once we allow user code to run without the
home dir being activated.

3 months agohomed: add bus call that allows referencing a home without activating it
Lennart Poettering [Mon, 27 Nov 2023 16:08:17 +0000 (17:08 +0100)] 
homed: add bus call that allows referencing a home without activating it

This is useful for allowing users to login without the ability to unlock
their home dir. Usecase is ssh: ssh might grant access without giving
us the chance to unlock the home dir for the user (because it doesn't
allow us asking questions during authentication), hence with this call
we can pin the home dir, but not activate it and then allow the
activation to be delayed until later.

3 months agouser-record-show: show if fallback data is used
Lennart Poettering [Fri, 13 May 2022 16:38:35 +0000 (18:38 +0200)] 
user-record-show: show if fallback data is used

3 months agouser-record: add fields for a fallback home dir + shell
Lennart Poettering [Fri, 13 May 2022 16:21:01 +0000 (18:21 +0200)] 
user-record: add fields for a fallback home dir + shell

This adds fields to the user record logic to allow a "fallback" home
directory and shell to be set as part of the "status" section of the
user record, i.e. supplied by the manager of the user record.

The idea is that if the fallback homedir/shell is set it will take
precedence over the real one in most ways.

Usecase: let's try to make ssh logins into homed directories work.
systemd-homed would set a fallback shell/homedir for inactive home dirs.
Thus, when ssh logins take place via key auth, we can allow them, and
these fallback session params would be used because the real home cannot
be activated just yet becasue we cannot acquire any password for it from
the user.

3 months agologind: add ability to upgrade session class from 'user-incomplete' to 'user'
Lennart Poettering [Mon, 27 Nov 2023 16:48:37 +0000 (17:48 +0100)] 
logind: add ability to upgrade session class from 'user-incomplete' to 'user'

3 months agopam-systemd: automatically enable "incomplete" user session if XDG_SESSION_INCOMPLETE...
Lennart Poettering [Mon, 27 Nov 2023 16:30:15 +0000 (17:30 +0100)] 
pam-systemd: automatically enable "incomplete" user session if XDG_SESSION_INCOMPLETE env var is set

This allows earlier PAM modules (i.e. pam_systemd_home) to inform
pam_systemd that the session is not "complete" yet (i.e. doesn't have
the home dir set up properly yet).

3 months agologind: add new 'user-incomplete' session class
Lennart Poettering [Mon, 27 Nov 2023 17:36:06 +0000 (18:36 +0100)] 
logind: add new 'user-incomplete' session class

3 months agoMerge pull request #28761 from esposem/cmdline_manager
Luca Boccassi [Wed, 14 Feb 2024 13:56:31 +0000 (13:56 +0000)] 
Merge pull request #28761 from esposem/cmdline_manager

bootctl: handle UKI cmdline addons

3 months agoMerge pull request #31283 from CodethinkLabs/vmspawn/start_from_template
Luca Boccassi [Wed, 14 Feb 2024 13:55:04 +0000 (13:55 +0000)] 
Merge pull request #31283 from CodethinkLabs/vmspawn/start_from_template

vmspawn: Support being invoked from a template unit

3 months agoMerge pull request #31319 from poettering/journal-tighten-memfd-flags
Lennart Poettering [Wed, 14 Feb 2024 13:40:46 +0000 (14:40 +0100)] 
Merge pull request #31319 from poettering/journal-tighten-memfd-flags

journald: tighten checks on incoming memfds a bit

3 months agoMerge pull request #31314 from yuwata/network-ndisc-check-conflicting-address
Yu Watanabe [Wed, 14 Feb 2024 13:19:05 +0000 (22:19 +0900)] 
Merge pull request #31314 from yuwata/network-ndisc-check-conflicting-address

network/ndisc: check conflicting address

3 months agomeson: do not attempt to install tests when they are disabled
Luca Boccassi [Tue, 13 Feb 2024 13:43:49 +0000 (13:43 +0000)] 
meson: do not attempt to install tests when they are disabled

If -Dtests=false but -Dinstall-tests=true the build will fail, as some tests will
be pulled in the build but not their prerequisites. It doesn't make sense to ask
for tests to be installed if they are disabled.

FAILED: test-acd
cc  -o test-acd test-acd.p/src_libsystemd-network_test-acd.c.o -flto -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector -Wl,-z,relro -specs=/usr/share/debhelper/dh_package_notes/debian-package-notes.specs -g -O2 -ffile-prefix-map=/tmp/s=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffat-lto-objects -Wdate-time -D_FORTIFY_SOURCE=2 '-Wl,-rpath,$ORIGIN/src/shared:XXXXXXXXXXXXXXX' -Wl,-rpath-link,/tmp/s/obj-x86_64-linux-gnu/src/shared -Wl,--start-group src/shared/libsystemd-shared-255.so src/libsystemd-network/libsystemd-network.a -Wl,--end-group -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections
/usr/bin/ld: /tmp/cc0oYwFZ.ltrans0.ltrans.o: in function `main':
./obj-x86_64-linux-gnu/./obj-x86_64-linux-gnu/<artificial>:85:(.text.startup+0x33): undefined reference to `test_setup_logging'
collect2: error: ld returned 1 exit status

3 months agojournald: rebreak some comments 31319/head
Lennart Poettering [Wed, 14 Feb 2024 09:56:09 +0000 (10:56 +0100)] 
journald: rebreak some comments

3 months agojournald: when getting journal data via memfd, check flags are valid
Lennart Poettering [Wed, 14 Feb 2024 09:55:22 +0000 (10:55 +0100)] 
journald: when getting journal data via memfd, check flags are valid

Add some extra safety checks: refuse weird open flags.

And while we are at it, also use stat_verify_regular()

3 months agobootctl: discover and pring global UKI PE addons 28761/head
Emanuele Giuseppe Esposito [Thu, 21 Sep 2023 11:59:24 +0000 (07:59 -0400)] 
bootctl: discover and pring global UKI PE addons

An UKI final command line is not just made of the content of .cmdline,
but also from the addons that are inserted in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d (local addons) and /boot/efi/loader/addons
(global addons).

Therefore bootclt "status" and "list" should also include these addons
when printing the UKI command line.

Support for /boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d is already present,
so now cover addons present in /boot/efi/loader/addons (global addons).

Example (assume UKI_NAME=devel):
$ bootctl
ukiCmdline: console=tty0 console=ttyS0
  globalAddon: loader/addons/global.addon.efi
      cmdline: └─quiet
   localAddon: devel.efi.extra.d/rpm_addon.addon.efi
      cmdline: └─this is a normal addon
 finalCmdline: console=tty0 console=ttyS0 quiet this is a normal addon

3 months agobootctl: discover local UKI PE addons
Emanuele Giuseppe Esposito [Thu, 21 Sep 2023 06:21:42 +0000 (02:21 -0400)] 
bootctl: discover local UKI PE addons

An UKI final command line is not just made of the content of .cmdline,
but also from the addons that are inserted in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d (local addons) and
/boot/efi/loader/addons (global addons).

Therefore bootclt "status" and "list" should also include these addons
when printing the UKI command line.

Right now, discover addons present in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d.

Example output (assume UKI_NAME=devel):
$ bootctl
ukiCmdline: console=tty0 console=ttyS0
   localAddon: devel.efi.extra.d/rpm_addon.addon.efi
      cmdline: └─this is a normal addon
 finalCmdline: console=tty0 console=ttyS0 this is a normal addon

3 months agobootspec: refactor find_sections
Emanuele Giuseppe Esposito [Thu, 21 Sep 2023 06:18:32 +0000 (02:18 -0400)] 
bootspec: refactor find_sections

Prepare for the incoming changes that introduce PE addons support.
Addons will contain a .cmdline section, but not .osrel.

3 months agoupdate TODO
Lennart Poettering [Wed, 14 Feb 2024 09:56:35 +0000 (10:56 +0100)] 
update TODO

3 months agotest: make sure to install the filesystem package in the test image on SUSE 31317/head
Franck Bui [Wed, 14 Feb 2024 09:01:57 +0000 (10:01 +0100)] 
test: make sure to install the filesystem package in the test image on SUSE

Othewise test images are missing the tmpfiles snippets used to create the very
basic files at boot, which can be useful when a test wants to reuse the OS tree
(is already running in) for spawning a new container in pristine state.

3 months agohashmap: Add helper to dump sorted keys
Adrian Vovk [Fri, 19 Jan 2024 01:48:24 +0000 (20:48 -0500)] 
hashmap: Add helper to dump sorted keys

Currently, hashmap_dump_sorted sorts by key and then returns the values
in order sorted by key. This commit adds another helper that does the
same but returns the sorted keys instead

3 months agosd-journal: drop unused function prototype
Yu Watanabe [Wed, 14 Feb 2024 01:32:33 +0000 (10:32 +0900)] 
sd-journal: drop unused function prototype

Follow-up for 8b4fbbb0a121028c9304e96df322ce491f551e34.

The function was renamed and moved by
035b0f8fe8c1883b17d864f15f99846ab206099d.
Maybe the prototype is mistakenly re-introduced on rebase.

3 months agocore/load-fragment: modernize config_parse_socket_listen
Mike Yuan [Tue, 13 Feb 2024 19:35:37 +0000 (03:35 +0800)] 
core/load-fragment: modernize config_parse_socket_listen

Prompted by #31304

3 months agoMerge pull request #31206 from AdrianVovk/user-record-fields
Lennart Poettering [Wed, 14 Feb 2024 08:22:23 +0000 (09:22 +0100)] 
Merge pull request #31206 from AdrianVovk/user-record-fields

Added some more user record fields

3 months agoenv-util: Add helper to store current log level
Adrian Vovk [Sat, 20 Jan 2024 00:46:07 +0000 (19:46 -0500)] 
env-util: Add helper to store current log level

This is useful after a fork but before an exec into a binary that uses
systemd's logging utilities. For example, this should be used in dbus
services that fork off worker processes: currently, the log level set by
the LogControl dbus API will be lost because of the exec, and the worker
process will not have the correct log level set.

3 months agoMerge pull request #31297 from AdrianVovk/sha256-util-lib
Lennart Poettering [Wed, 14 Feb 2024 08:19:56 +0000 (09:19 +0100)] 
Merge pull request #31297 from AdrianVovk/sha256-util-lib

basic: Add some sha256 helper functions

3 months agocore: allow to specify /dev/rfkill for ListenSpecial=
Yu Watanabe [Tue, 13 Feb 2024 19:13:32 +0000 (04:13 +0900)] 
core: allow to specify /dev/rfkill for ListenSpecial=

Follow-up for 8049bce6195f8dc5901cb4f60f1ac56206de887b.

Fixes #31294.

3 months agoformat-utils: Expose FORMAT_UID and FORMAT_GID
Adrian Vovk [Fri, 2 Feb 2024 20:03:54 +0000 (15:03 -0500)] 
format-utils: Expose FORMAT_UID and FORMAT_GID

This pulls this generally useful helper out of sysusers and into the
util lib, and updates the places throughout the codebase where it makes
sense to use it.

3 months agohomed: Add some missing asserts
Adrian Vovk [Thu, 1 Feb 2024 16:16:44 +0000 (11:16 -0500)] 
homed: Add some missing asserts

These functions expect secrets to be passed in (some even dereference
the variables), but fail to assert that they're non-null. So this commit
adds some assertions

3 months agonetwork/ndisc: check if there exists a conflicting address 31314/head
Yu Watanabe [Wed, 14 Feb 2024 04:39:48 +0000 (13:39 +0900)] 
network/ndisc: check if there exists a conflicting address

Follow-up for 0a0c2672dbd22dc85d660e5baa7e1bef701beb88.

Before the commit, if a conflicting address exists or already requested,
then the configuration of newly requested address (especially, prefix
length) is mostly ignored silently.

However, after the commit, even if there exists a conflicting address,
networkd anyway tries to configure the newly requested address, and
enter failed state. Such situation can be triggered, e.g. when the DHCPv6
client is started earlier than NDisc, by WithoutRA=solicit.

Fixes #31263.

3 months agonetwork/ndisc: drop unnecessary ownership transfer
Yu Watanabe [Wed, 14 Feb 2024 04:46:51 +0000 (13:46 +0900)] 
network/ndisc: drop unnecessary ownership transfer

Follow-up for e217da13803518fb9592a18b0ec7dade513878a0.

3 months agonetwork/dhcp6: use address_can_update() at one more place
Yu Watanabe [Wed, 14 Feb 2024 04:27:00 +0000 (13:27 +0900)] 
network/dhcp6: use address_can_update() at one more place

In address_can_update(), only prefix length is checked for IPv6
addresses. So, this should not change any behavior.

3 months agonetwork/address: drop requirement of Address.link and .network in address_can_update()
Yu Watanabe [Wed, 14 Feb 2024 04:02:56 +0000 (13:02 +0900)] 
network/address: drop requirement of Address.link and .network in address_can_update()

This also rename arguments.
No functional change, just refactoring.

3 months agouser-record: Add languages field 31206/head
Adrian Vovk [Sun, 4 Feb 2024 17:27:01 +0000 (12:27 -0500)] 
user-record: Add languages field

This field is like preferredLanguage, but takes a priority list of
languages instead. If an app isn't translated into a user's primary
language, it can fall back to one of the other languages in the list
thus making the app more accessible to the user.

For instance: in my experience, many Ukrainians are fluent in Russian,
often significantly better than English (especially if they are of a
generation that grew up during the USSR). Such a person might set this
new variable to ["uk_UA.UTF-8", "ru_UA.UTF-8"] so that software that
lacks Ukrainian translations will first try Russian translations before
defaulting to English.

Fixes #31290

3 months agolocale-util: Restrict valid locales
Adrian Vovk [Sun, 4 Feb 2024 17:18:08 +0000 (12:18 -0500)] 
locale-util: Restrict valid locales

This further restricts the charset of locales to better reflect what
locales actually look like.

This allows us to safely join locale names using the `:` character, for
instance, which cannot appear in a locale name and is used by the
`$LANGUAGE` env var

3 months agopam_systemd: Let user record override env vars
Adrian Vovk [Sun, 4 Feb 2024 16:56:05 +0000 (11:56 -0500)] 
pam_systemd: Let user record override env vars

The user record should be the source of truth for the user's environment
variables, and the user should be able to override them in much the same
way that they can if they simply append the variable to their ~/.profile

For example, before $LANG would never get set to the user's preferred
language, because the service manager always ensures that $LANG is set
to something (either the localed config, or a compiled-in default). Thus
the user's preferredLanguage setting was always ignored

3 months agovarlink: fix dead code
Luca Boccassi [Tue, 13 Feb 2024 17:42:59 +0000 (17:42 +0000)] 
varlink: fix dead code

'e' is already checked in the previous branch, no need to check it again,
it cannot be NULL.

CID#1534465

Follow-up for 9bca9891834e0e71484e2e1b38ac59b3ce257043

3 months agotest: fix typo
Yu Watanabe [Tue, 13 Feb 2024 19:04:09 +0000 (04:04 +0900)] 
test: fix typo

Follow-up for d02018afdb15ca84f02775c5c5ed0ade39475ffa.

3 months agotest: fix typo
Yu Watanabe [Tue, 13 Feb 2024 19:03:07 +0000 (04:03 +0900)] 
test: fix typo

Follow-up for 3456c89ac26872f4befa2bdf7c260529932e3909.

3 months agocryptsetup: fix typo
Yu Watanabe [Tue, 13 Feb 2024 19:01:36 +0000 (04:01 +0900)] 
cryptsetup: fix typo

Follow-up for c5daf14c88ba44cefabe052de93a29d28b6b0175.

3 months agobasic: Add some sha256 helper functions 31297/head
Adrian Vovk [Sat, 13 Jan 2024 16:08:12 +0000 (11:08 -0500)] 
basic: Add some sha256 helper functions

Adds a util function to sha256 an open fd (moved from dissect). Also
adds functions to check if a string contains a valid sha256 hash, and
parse it into a sha256 array.

3 months agotools: fix typo
Yu Watanabe [Tue, 13 Feb 2024 18:58:31 +0000 (03:58 +0900)] 
tools: fix typo

Follow-up for 6d55e3a3641b35dd2bb4306711b4db4004bf6817.

3 months agocore: escape spaces when serializing as well
Frantisek Sumsal [Mon, 12 Feb 2024 17:32:03 +0000 (18:32 +0100)] 
core: escape spaces when serializing as well

Otherwise they might get stripped when reading the serialized data back.

Resolves: #31214

3 months agofundamental: Add overflow-safe math helpers 31296/head
Adrian Vovk [Wed, 17 Jan 2024 19:48:45 +0000 (14:48 -0500)] 
fundamental: Add overflow-safe math helpers

ADD_SAFE/SUB_SAFE/MUL_SAFE do addition/subtraction/multiplication
respectively with an overflow check. If an overflow occurs these return
false, otherwise true. Example: (c = a + b) would become ADD_SAFE(&c, a,
b)

INC_SAFE/DEC_SAFE/MUL_ASSIGN_SAFE are like above but they also reassign
the first argument. Example: (a += b) would become INC_SAFE(&a, b)

3 months agotest: make sure that sd-boot is installed before testing bootctl
Franck Bui [Tue, 13 Feb 2024 17:16:19 +0000 (18:16 +0100)] 
test: make sure that sd-boot is installed before testing bootctl

bootctl can be installed also non uefi systems so its sole presence doesn't
mean that we can test installation of sd-boot.

3 months agoUse tilde for rc tag versioning
Daan De Meyer [Tue, 13 Feb 2024 13:00:50 +0000 (14:00 +0100)] 
Use tilde for rc tag versioning

tilde sorts lower in the version comparison spec:
https://uapi-group.org/specifications/specs/version_format_specification/

➜  systemd git:(strip) systemd-analyze compare-versions 249\~rc1 249
249\~rc1 < 249
➜  systemd git:(strip) systemd-analyze compare-versions 249-rc1 249
249-rc1 > 249

Also update tools/meson-vcs-tag.sh to use carets instead of hyphens
for the git part of the version as carets are allowed to be part of
a version by pacman while hyphens are not and both sort higher than
a version without the git part.

3 months agotest: install systemd-boot in openSUSE test images
Franck Bui [Tue, 13 Feb 2024 17:12:42 +0000 (18:12 +0100)] 
test: install systemd-boot in openSUSE test images

Needed since 87282a337d1ba7dc7d755f53b46c64b43718dcf7.

3 months agovmspawn: add template unit to start systemd-vmspawn -M 31283/head
Sam Leonard [Wed, 7 Feb 2024 17:22:39 +0000 (17:22 +0000)] 
vmspawn: add template unit to start systemd-vmspawn -M

3 months agovmspawn: search for machines when only passed -M/--machine=
Sam Leonard [Wed, 7 Feb 2024 14:51:21 +0000 (14:51 +0000)] 
vmspawn: search for machines when only passed -M/--machine=

3 months agovmspawn: discover bootloader for directory type images
Sam Leonard [Wed, 7 Feb 2024 13:38:37 +0000 (13:38 +0000)] 
vmspawn: discover bootloader for directory type images

3 months agovmspawn: support multiple initrds via merging
Sam Leonard [Thu, 8 Feb 2024 16:42:02 +0000 (16:42 +0000)] 
vmspawn: support multiple initrds via merging

3 months agopo: Translated using Weblate (Korean)
김인수 [Tue, 13 Feb 2024 09:36:49 +0000 (10:36 +0100)] 
po: Translated using Weblate (Korean)

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main

3 months agoMerge pull request #30380 from keszybz/tmpfiles-dry-run
Lennart Poettering [Tue, 13 Feb 2024 08:45:50 +0000 (09:45 +0100)] 
Merge pull request #30380 from keszybz/tmpfiles-dry-run

Make tmpfiles/sysusers nicer with local files and implement tmpfiles --dry-run

3 months agocryptsetup: Add optional support for linking volume key in keyring.
Ondrej Kozina [Wed, 31 Jan 2024 12:11:21 +0000 (13:11 +0100)] 
cryptsetup: Add optional support for linking volume key in keyring.

cryptsetup 2.7.0 adds feature to link effective volume key in custom
kernel keyring during device activation. It can be used later to pass
linked volume key to other services.

For example: kdump enabled systems installed on LUKS2 device.
This feature allows it to store volume key linked in a kernel keyring
to the kdump reserved memory and reuse it to reactivate LUKS2 device
in case of kernel crash.

3 months agoupdate TODO
Lennart Poettering [Tue, 13 Feb 2024 08:12:49 +0000 (09:12 +0100)] 
update TODO

3 months agoMerge pull request #31271 from fbuihuu/test-69-debugging-improvements
Frantisek Sumsal [Mon, 12 Feb 2024 20:14:43 +0000 (21:14 +0100)] 
Merge pull request #31271 from fbuihuu/test-69-debugging-improvements

Test 69 debugging improvements

3 months agoMerge pull request #31284 from poettering/btrfs-alignment
Lennart Poettering [Mon, 12 Feb 2024 16:50:13 +0000 (17:50 +0100)] 
Merge pull request #31284 from poettering/btrfs-alignment

btrfs: various clean-ups including alignment fixes

3 months agoFix OOMPolicy= version in manpage of systemd.scope
cunshunxia [Wed, 24 Jan 2024 03:23:19 +0000 (11:23 +0800)] 
Fix OOMPolicy= version in manpage of systemd.scope

OOMPolicy in scope units is separately supported in
version v253, so I think it cannot be directly used
in the manpage with the version from the service.

fix:#30836

3 months agoMerge pull request #31162 from poettering/tint-tweaks
Luca Boccassi [Mon, 12 Feb 2024 16:47:09 +0000 (16:47 +0000)] 
Merge pull request #31162 from poettering/tint-tweaks

ptyfwd: some tweaks to terminal handling

3 months agotest/test-shutdown.py: optionally display the test I/Os in a dedicated log file 31271/head
Franck Bui [Thu, 8 Feb 2024 15:12:41 +0000 (16:12 +0100)] 
test/test-shutdown.py: optionally display the test I/Os in a dedicated log file

Given that the test involves screen(1), sending various control sequences to
resize/clear the screen, most of the logs sent from the python script were
nearly impossible to read or mixed with other messages sent to the console
hence making the debug harder when the test is run manually.

This patch introduces an option to redirect the pexpect IOs into a file (to be
used in $STATEDIR/TEST-69-SHUTDOWN/run-nspawn).

The pexpect logs are also enabled later so the boot logs are skipped since
those are already included in the journal.