]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoMerge pull request #20321 from bluca/state_dir_symlink
Lennart Poettering [Thu, 28 Oct 2021 18:52:56 +0000 (20:52 +0200)] 
Merge pull request #20321 from bluca/state_dir_symlink

core: add [State|Runtime|Cache|Logs]DirectorySymlink

2 years agoMerge pull request #20609 from DaanDeMeyer/recursive-template
Lennart Poettering [Thu, 28 Oct 2021 17:23:17 +0000 (19:23 +0200)] 
Merge pull request #20609 from DaanDeMeyer/recursive-template

core: Try to prevent infinite recursive template instantiation

2 years agonspawn: add filesystem id mapping support to --bind and --bind-ro
Andreas Valder [Sat, 5 Jun 2021 16:39:38 +0000 (18:39 +0200)] 
nspawn: add filesystem id mapping support to --bind and --bind-ro

2 years agoMerge pull request #21135 from poettering/homed-uidmap
Lennart Poettering [Thu, 28 Oct 2021 17:18:18 +0000 (19:18 +0200)] 
Merge pull request #21135 from poettering/homed-uidmap

homed: make use of uidmap'ped mounts for avoiding recursive chown()

2 years agodocs: document what integer range we expect from JSON parsers
Lennart Poettering [Thu, 28 Oct 2021 11:38:59 +0000 (13:38 +0200)] 
docs: document what integer range we expect from JSON parsers

2 years agocore: correct SELinux label of service credential directory
Christian Göttsche [Wed, 27 Oct 2021 17:47:49 +0000 (19:47 +0200)] 
core: correct SELinux label of service credential directory

Label the service root credential directory so write_credential() will
create entries with the label of their parent directory.

Resolves: #21134

2 years agointegritysetup: Check args to prevent assert
Tony Asleson [Wed, 27 Oct 2021 17:00:59 +0000 (12:00 -0500)] 
integritysetup: Check args to prevent assert

The utility function parse_integrity_options is used to both validate
integritytab options or validate and return values.  In the case where
we are validating only and we have specific value options we will
assert.

2 years agoudev: net_id: introduce predictable names for xen-netfront
Benjamin Herrenschmidt [Wed, 20 Oct 2021 04:18:59 +0000 (15:18 +1100)] 
udev: net_id: introduce predictable names for xen-netfront

Those devices show up as /sys/devices/vif-N, let's use that number
to name them enXN.

Without this, all schemes fail and they keep the kernel names, which can
be racy.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2 years agocore: Try to prevent infinite recursive template instantiation 20609/head
Daan De Meyer [Wed, 1 Sep 2021 09:21:28 +0000 (11:21 +0200)] 
core: Try to prevent infinite recursive template instantiation

To prevent situations like in #17602 from happening, let's drop
direct recursive template dependencies. These will almost certainly
lead to infinite recursion so let's drop them immediately to avoid
instantiating potentially thousands of irrelevant units.

Example of a template that would lead to infinite recursion which
is caught by this check:

notify@.service:

```
[Unit]
Wants=notify@%n.service
```

2 years agoMerge pull request #21167 from poettering/various-doc-tweaks
Luca Boccassi [Thu, 28 Oct 2021 10:12:09 +0000 (11:12 +0100)] 
Merge pull request #21167 from poettering/various-doc-tweaks

Four documentation tweaks

2 years agocore: add [State|Runtime|Cache|Logs]Directory symlink as second parameter 20321/head
Luca Boccassi [Wed, 14 Jul 2021 17:22:21 +0000 (18:22 +0100)] 
core: add [State|Runtime|Cache|Logs]Directory symlink as second parameter

When combined with a tmpfs on /run or /var/lib, allows to create
arbitrary and ephemeral symlinks for StateDirectory or RuntimeDirectory.
This is especially useful when sharing these directories between
different services, to make the same state/runtime directory 'backend'
appear as different names to each service, so that they can be added/removed
to a sharing agreement transparently, without code changes.

An example (simplified, but real) use case:

foo.service:
StateDirectory=foo

bar.service:
StateDirectory=bar

foo.service.d/shared.conf:
StateDirectory=
StateDirectory=shared:foo

bar.service.d/shared.conf:
StateDirectory=
StateDirectory=shared:bar

foo and bar use respectively /var/lib/foo and /var/lib/bar. Then
the orchestration layer decides to stop this sharing, the drop-in
can be removed. The services won't need any update and will keep
working and being able to store state, transparently.

To keep backward compatibility, new DBUS messages are added.

2 years agoman: document that daemons can close fds they receive via sd_listen_fds() if they... 21167/head
Lennart Poettering [Thu, 28 Oct 2021 09:05:22 +0000 (11:05 +0200)] 
man: document that daemons can close fds they receive via sd_listen_fds() if they like

Fixes: #18872
2 years agoman: document how nss-resolve and systemd-resolved communicate
Lennart Poettering [Thu, 28 Oct 2021 08:53:55 +0000 (10:53 +0200)] 
man: document how nss-resolve and systemd-resolved communicate

Fixes: #20925
2 years agodocs: document $PASSWORD in ENVIRONMENT.md
Lennart Poettering [Thu, 28 Oct 2021 08:51:12 +0000 (10:51 +0200)] 
docs: document $PASSWORD in ENVIRONMENT.md

Fixes: #20955
2 years agoman: clarify the situation of unit templates regarding "systemctl list-units" + ...
Lennart Poettering [Thu, 28 Oct 2021 08:45:02 +0000 (10:45 +0200)] 
man: clarify the situation of unit templates regarding "systemctl list-units" + "systemctl list-unit-files"

Fixes: #21075
2 years agoupdate TODO 21135/head
Lennart Poettering [Tue, 26 Oct 2021 16:41:12 +0000 (18:41 +0200)] 
update TODO

2 years agohomework: teach luks backend uid mapping
Lennart Poettering [Tue, 26 Oct 2021 16:34:57 +0000 (18:34 +0200)] 
homework: teach luks backend uid mapping

This teachs the LUKS backend UID mapping, similar to the existing
logic for the "directory", "subvolume" and "fscrypt" backends: the files
will be owned by "nobody" on the fs itself, but will be mapped to
logging in user via uidmapped mounts.

This way LUKS home dirs become truly portable: no local UID info will
leak onto the images anymore, and the need to recursively chown them on
activation goes away. This means activation is always as performant as
it should be.

2 years agohomework: also move to using .image_fd field of HomeSetup in home_create_luks()
Lennart Poettering [Tue, 26 Oct 2021 15:44:14 +0000 (17:44 +0200)] 
homework: also move to using .image_fd field of HomeSetup in home_create_luks()

One last resource we can manage with HomeSetup, instead of doing that
manually.

2 years agohomework: get rid of manual error path in home_create_luks()
Lennart Poettering [Tue, 26 Oct 2021 15:40:21 +0000 (17:40 +0200)] 
homework: get rid of manual error path in home_create_luks()

Now that all objects we need to destroy are managed by the HomeSetup
object we can drop our manual destruction path and just use the normal
clean-up logic implemented for HomeSetup anyway. More unification, yay!

2 years agohomework: move destruction of temporary image file into HomeSetup
Lennart Poettering [Tue, 26 Oct 2021 15:36:36 +0000 (17:36 +0200)] 
homework: move destruction of temporary image file into HomeSetup

Let's simplify things further a bit and move the destruction of the
temporary image file we operate on when creating a LUKS home into
HomeSetup, like all our other resources.

2 years agohomework: get rid of manual clean up path in home_setup_luks()
Lennart Poettering [Tue, 26 Oct 2021 15:28:51 +0000 (17:28 +0200)] 
homework: get rid of manual clean up path in home_setup_luks()

Now that we stored all our different objects inside the HomeSetup
structure, we can get rid of our manual clean-up path, since
home_setup_done() will clean up everything stored therein anyway, in the
right order.

This is the main reason we moved everything into HomeSetup in the
previous commits: so that we can share clean-up paths for these objects
with everything else.

2 years agohomework: move image_fd field in home_setup_luks() also into HomeSetup
Lennart Poettering [Tue, 26 Oct 2021 15:27:28 +0000 (17:27 +0200)] 
homework: move image_fd field in home_setup_luks() also into HomeSetup

Let's unify even more codepaths, and let's reuse the .image_fd field we
already maintain.

2 years agohomework: rework home_setup_luks() to store its root_fd also in HomeSetup
Lennart Poettering [Tue, 26 Oct 2021 15:20:56 +0000 (17:20 +0200)] 
homework: rework home_setup_luks() to store its root_fd also in HomeSetup

2 years agohomework: always pass HomeSetup param first, PasswordCache second
Lennart Poettering [Tue, 26 Oct 2021 15:16:13 +0000 (17:16 +0200)] 
homework: always pass HomeSetup param first, PasswordCache second

Some of our operations did it one way, most the other. Let's unify on
the order that is more popular.

2 years agohomework: replace homegrown syncfs_path() reimplementation by syncfs_path()
Lennart Poettering [Tue, 26 Oct 2021 11:40:16 +0000 (13:40 +0200)] 
homework: replace homegrown syncfs_path() reimplementation by syncfs_path()

2 years agohomework: unify similar code for opening existing LUKS DM devices
Lennart Poettering [Tue, 26 Oct 2021 09:07:04 +0000 (11:07 +0200)] 
homework: unify similar code for opening existing LUKS DM devices

Let's introduce a new helper acquire_open_luks_device() that combines a
few steps we keep doing at three places into one.

2 years agohomework: move all LoopDevice handling into HomeSetup too
Lennart Poettering [Tue, 26 Oct 2021 08:52:21 +0000 (10:52 +0200)] 
homework: move all LoopDevice handling into HomeSetup too

Similar story as with the DM objects: let's maintain it all as part of
HomeSetup. We do that for  part of the operations already, let's unify
that.

2 years agohomework: move all DM detachment/freeing into HomeSetup
Lennart Poettering [Mon, 25 Oct 2021 19:33:08 +0000 (21:33 +0200)] 
homework: move all DM detachment/freeing into HomeSetup

We actually already detach/free the LUKS DM devices for most operations
via HomeSetup, let's move the creation logic to also do this, in order
to unify behaviour between operations.

2 years agohomework: teach home_lock() + home_unlock() + home_deactivate() to use HomeSetup...
Lennart Poettering [Tue, 26 Oct 2021 07:18:39 +0000 (09:18 +0200)] 
homework: teach home_lock() + home_unlock() + home_deactivate() to use HomeSetup, too

This is just some minor refactoring, to make these two operations work
like the rest.

home_lock_luks() will now use the root_fd field of HomeSetup already,
but for home_unlock_luks() + home_deactivate() this change has no effect for now. (But a
later commit will change this.)

2 years agohomework: make use of .undo_mount field of HomeSetup for LUKS backend too
Lennart Poettering [Mon, 25 Oct 2021 13:10:54 +0000 (15:10 +0200)] 
homework: make use of .undo_mount field of HomeSetup for LUKS backend too

Let's move more stuff to common infra for the backends.

2 years agohomework: use HomeSetup in home_create_luks() too
Lennart Poettering [Mon, 25 Oct 2021 13:03:34 +0000 (15:03 +0200)] 
homework: use HomeSetup in home_create_luks() too

We use it for all other LUKS operations these days, and for all
home_create_xyz() calls for other backends, let's use it for the LUKS
backend too.

2 years agoMerge pull request #21162 from poettering/homed-cifs-improvements
Lennart Poettering [Thu, 28 Oct 2021 06:17:05 +0000 (08:17 +0200)] 
Merge pull request #21162 from poettering/homed-cifs-improvements

homed: various cifs backend improvements

2 years agoMerge pull request #21161 from poettering/homed-uidmap-fscrypt
Lennart Poettering [Thu, 28 Oct 2021 06:15:44 +0000 (08:15 +0200)] 
Merge pull request #21161 from poettering/homed-uidmap-fscrypt

homed: teach the fscrypt backend uidmap too

2 years agoMerge pull request #21157 from yuwata/network-address-label-verify
Yu Watanabe [Wed, 27 Oct 2021 22:13:12 +0000 (07:13 +0900)] 
Merge pull request #21157 from yuwata/network-address-label-verify

network: verify [IPv6AddressLabel] section

2 years agocore: make DynamicUser=1 and StateDirectory= work with TemporaryFileSystem=/var/lib
Luca Boccassi [Tue, 27 Jul 2021 15:41:38 +0000 (16:41 +0100)] 
core: make DynamicUser=1 and StateDirectory= work with TemporaryFileSystem=/var/lib

The /var/lib/private/foo -> /var/lib/foo symlink for StateDirectory and
DynamicUser is set up on the host filesystem, before the mount namespacing
is brought up. If an empty /var/lib is used, to ensure the service does not
see other services data, the symlink is then not available despite
/var/lib/private being set up as expected.

Make a list of symlinks that need to be set up, and create them after all
the namespaced filesystems have been created, but before any eventual
read-only switch is flipped.

2 years agohomework: allow specifying explicit additional mount options when using CIFS backend 21162/head
Lennart Poettering [Tue, 26 Oct 2021 14:58:56 +0000 (16:58 +0200)] 
homework: allow specifying explicit additional mount options when using CIFS backend

This is useful since certain shares can only be mounted with additional
mount flags. For example the SMB share in modern AVM Fritz!Boxes
requires "noserverino" to be set to work from Linux.

2 years agohomework: actually try all supplied passwords
Lennart Poettering [Tue, 26 Oct 2021 14:41:31 +0000 (16:41 +0200)] 
homework: actually try all supplied passwords

Unfortunately mount.cifs doesn't really let us know much about the
reason for the failure. Hence, assume it's caused by a bad password, and
retry on any failure with additional passwords that we might have.

A loop to do this was always in place, but none of the possible
codepaths actually allowed to iterate more than once. Fix that.

2 years agohomework: allow specifying a dir component in CIFS services
Lennart Poettering [Fri, 22 Oct 2021 13:52:23 +0000 (15:52 +0200)] 
homework: allow specifying a dir component in CIFS services

Allow specifying CIFS services in the format //host/service/subdir/… to
allow multiple homedirs on the same share, and not in the main dir of
the share.

All other backends allow placing the data store at arbitrary places,
let's allow this too for the CIFS backend. This is particularly useful
for testing.

2 years agohomework: make home_move_mount() a bit more generic by renaming first parameter
Lennart Poettering [Fri, 22 Oct 2021 13:51:00 +0000 (15:51 +0200)] 
homework: make home_move_mount() a bit more generic by renaming first parameter

No actual code change, let's just rename the first parameter, to make it
more generically useful in case the first argument is an arbitrary path,
not necessarily a username/realm.

2 years agohomectl: validate CIFS service name before accepting it
Lennart Poettering [Fri, 22 Oct 2021 13:49:42 +0000 (15:49 +0200)] 
homectl: validate CIFS service name before accepting it

2 years agofs-util: add helper that can split CIFS services names
Lennart Poettering [Fri, 22 Oct 2021 13:49:00 +0000 (15:49 +0200)] 
fs-util: add helper that can split CIFS services names

2 years agohomework: apply mount flags also for CIFS mounts
Lennart Poettering [Thu, 21 Oct 2021 16:48:30 +0000 (18:48 +0200)] 
homework: apply mount flags also for CIFS mounts

2 years agohomework: move check for CIFS service field initialization to home_setup_cifs()
Lennart Poettering [Thu, 21 Oct 2021 16:47:24 +0000 (18:47 +0200)] 
homework: move check for CIFS service field initialization to home_setup_cifs()

We need this field not only during activation but any kind of setup,
hence let's move it into the setup code.

2 years agohomework: rework home_setup_cifs() to store "mounted" variable in HomeSetup
Lennart Poettering [Thu, 21 Oct 2021 16:45:27 +0000 (18:45 +0200)] 
homework: rework home_setup_cifs() to store "mounted" variable in HomeSetup

We already have a field for that, let's use it. Let's also reduce the
indentation level a bit.

No change in behaviour.

2 years agohomework: pass header user record in home_activate_cifs()
Lennart Poettering [Thu, 21 Oct 2021 16:40:39 +0000 (18:40 +0200)] 
homework: pass header user record in home_activate_cifs()

Of course unlike in the LUKS case there's not actually any user record
stored in the LUKS header, so what we pass here will always be NULL.

The reason why I am changing is to make this more alike the other
home_activate_xyz() calls, and passing this around doesn't hurt.

(A later commit will replace all backend-specific home_activate_xyz()
calls by a single one)

2 years agohomework: support uidmaps in fscrypt backend 21161/head
Lennart Poettering [Thu, 21 Oct 2021 15:32:51 +0000 (17:32 +0200)] 
homework: support uidmaps in fscrypt backend

2 years agohomework: add new helper home_setup_undo_mount()
Lennart Poettering [Thu, 21 Oct 2021 11:58:10 +0000 (13:58 +0200)] 
homework: add new helper home_setup_undo_mount()

2 years agohomework: make sure fscrypt backend takes a HomeSetup object for all calls
Lennart Poettering [Thu, 21 Oct 2021 11:46:01 +0000 (13:46 +0200)] 
homework: make sure fscrypt backend takes a HomeSetup object for all calls

Similar to the same chage we did for the directory backend. Let's always
path the setup context object, i.e. HomeSetup, and store whatever we set
up in there.

No actual change in behaviour.

2 years agoMerge pull request #20344 from poettering/revert-close-all
Lennart Poettering [Wed, 27 Oct 2021 20:02:38 +0000 (22:02 +0200)] 
Merge pull request #20344 from poettering/revert-close-all

Alternative to #20288 – close_all_fds() reworking

2 years agotest: update comment
Yu Watanabe [Wed, 27 Oct 2021 19:11:19 +0000 (04:11 +0900)] 
test: update comment

Follow-up for 8524db502134135d96219ecd6df0d0fc5c475b9d.

2 years agoMerge pull request #21153 from yuwata/network-lifetime-fix
Yu Watanabe [Wed, 27 Oct 2021 19:52:25 +0000 (04:52 +0900)] 
Merge pull request #21153 from yuwata/network-lifetime-fix

network: fix lifetime handling

2 years agosystemctl: drop redundant "else"
Yu Watanabe [Wed, 27 Oct 2021 14:22:12 +0000 (23:22 +0900)] 
systemctl: drop redundant "else"

2 years agoMerge pull request #21150 from yuwata/sd-radv-shorten-default-lifetime-2
Yu Watanabe [Wed, 27 Oct 2021 19:51:45 +0000 (04:51 +0900)] 
Merge pull request #21150 from yuwata/sd-radv-shorten-default-lifetime-2

sd-radv: shorten default lifetime

2 years agoMerge pull request #21136 from poettering/homed-uidmap-dir-only
Yu Watanabe [Wed, 27 Oct 2021 19:51:31 +0000 (04:51 +0900)] 
Merge pull request #21136 from poettering/homed-uidmap-dir-only

homed uidmapping (just for the directory backend)

2 years agodoc: fix typo in command
Yu Watanabe [Wed, 27 Oct 2021 15:40:35 +0000 (00:40 +0900)] 
doc: fix typo in command

Follow-up for #21147.

2 years agorun: do not validate exe early if MountImages/ExtensionImages are used
Luca Boccassi [Wed, 27 Oct 2021 10:59:19 +0000 (11:59 +0100)] 
run: do not validate exe early if MountImages/ExtensionImages are used

Same as with RootImage&friends, the executable might be in the
image, so it's not visible in the host before the unit is set up.

2 years agoMerge pull request #21138 from bluca/show_extensions
Yu Watanabe [Wed, 27 Oct 2021 18:56:04 +0000 (03:56 +0900)] 
Merge pull request #21138 from bluca/show_extensions

systemctl: pretty-print ExtensionImages property

2 years agotest: do not use alloca() in function call
Yu Watanabe [Sat, 23 Oct 2021 15:16:57 +0000 (00:16 +0900)] 
test: do not use alloca() in function call

2 years agotest-network: add more tests for [Address] section 21157/head
Yu Watanabe [Wed, 27 Oct 2021 17:00:34 +0000 (02:00 +0900)] 
test-network: add more tests for [Address] section

2 years agotest-network: add tests for invalid [IPv6AddressLabel] section
Yu Watanabe [Wed, 27 Oct 2021 16:40:19 +0000 (01:40 +0900)] 
test-network: add tests for invalid [IPv6AddressLabel] section

2 years agonetwork: verify [IPv6AddressLabel] section
Yu Watanabe [Wed, 27 Oct 2021 16:38:04 +0000 (01:38 +0900)] 
network: verify [IPv6AddressLabel] section

2 years agotest-network: add tests for invalid IPv6 token
Yu Watanabe [Wed, 27 Oct 2021 16:17:14 +0000 (01:17 +0900)] 
test-network: add tests for invalid IPv6 token

2 years agotest-fd-util: extend close_all_fds() test to trigger all fallback codepaths 20344/head
Lennart Poettering [Thu, 12 Aug 2021 09:22:50 +0000 (11:22 +0200)] 
test-fd-util: extend close_all_fds() test to trigger all fallback codepaths

This extends the close_all_fds() logic to overmount /proc with an empty
tmpfs, and/or to block close_range() via seccomp, so that we run the
test case for the function with the fallback paths.

This should make sure that we don't regress in limited environments or
older kernels.

2 years agofd-util: export get_max_fd() so that we can use it in tests
Lennart Poettering [Thu, 12 Aug 2021 08:46:10 +0000 (10:46 +0200)] 
fd-util: export get_max_fd() so that we can use it in tests

2 years agoexec-util: use close_all_fds_without_malloc() from freeze()
Lennart Poettering [Thu, 29 Jul 2021 14:50:44 +0000 (16:50 +0200)] 
exec-util: use close_all_fds_without_malloc() from freeze()

2 years agofd-util: split out close_all_fds() special case handling and call it from close_all_f...
Lennart Poettering [Tue, 12 Oct 2021 14:11:46 +0000 (16:11 +0200)] 
fd-util: split out close_all_fds() special case handling and call it from close_all_fds_without_malloc(), too

The optimization is useful there too.

2 years agofd-util: close_all() check d_type
Lennart Poettering [Tue, 12 Oct 2021 13:50:39 +0000 (15:50 +0200)] 
fd-util: close_all() check d_type

Tiny optimization: check dirent's d_type before trying to parse
/proc/self/fd/ filenames, given we have that anyway.

2 years agofd-util: always return 0 on success in close_all_fds()
Lennart Poettering [Tue, 12 Oct 2021 13:54:54 +0000 (15:54 +0200)] 
fd-util: always return 0 on success in close_all_fds()

We never make use of the return value, and in case of close_range() we
don't even know how many fds got closed, hence don't pretend we knew.

2 years agofd-util: special case invocation of close_all_fds() with single exception fd
Lennart Poettering [Tue, 12 Oct 2021 13:53:55 +0000 (15:53 +0200)] 
fd-util: special case invocation of close_all_fds() with single exception fd

Add special case optimization for a single exception fd. It's a
pretty common case in our codebase, and the optimization is simple
and means we don't need to copy/sort the exception array, so do it.

2 years agofd-util: split out inner fallback loop of close_all_fds() as close_all_fds_without_ma...
Lennart Poettering [Tue, 12 Oct 2021 13:53:27 +0000 (15:53 +0200)] 
fd-util: split out inner fallback loop of close_all_fds() as close_all_fds_without_malloc()

2 years agoRevert "basic/fd-util: sort the 'except' array in place"
Lennart Poettering [Thu, 29 Jul 2021 14:36:15 +0000 (16:36 +0200)] 
Revert "basic/fd-util: sort the 'except' array in place"

This reverts commit 9c46228b7deb53d6384545535b37b2844a102b2b.

2 years agoRevert "Add variant of close_all_fds() that does not allocate and use it in freeze()"
Lennart Poettering [Thu, 29 Jul 2021 14:34:45 +0000 (16:34 +0200)] 
Revert "Add variant of close_all_fds() that does not allocate and use it in freeze()"

This reverts commit cbcf371abc328167fa869721c1add4850c793240.

2 years agohomework: support uidmapping in the "directory" backend 21136/head
Lennart Poettering [Wed, 20 Oct 2021 20:18:12 +0000 (22:18 +0200)] 
homework: support uidmapping in the "directory" backend

2 years agohomework: add new helper call that can shift home dir UID/GID ranges
Lennart Poettering [Wed, 20 Oct 2021 20:12:16 +0000 (22:12 +0200)] 
homework: add new helper call that can shift home dir UID/GID ranges

This new helper is not used yet, but it's useful for apply UID/GID
shifts so that the underlying home dir can use an arbitrary UID (for
example "nobody") and we'll still make it appear as owned by the target
UID.

This operates roughly like this:

1. The relevant underlying UID is mapped to the target UID
2. Everything in the homed UID range except for the target UID is left
   unmapped (and thus will appear as "nobody")
3. Everything in the 16bit UID range outside of the homed UID
   range/target UID/nobody user is mapped to itself
4. Everything else is left unmapped (in particular everything outside of
   the 16 bit range).

Why do it like this?

The 2nd rule done to ensure that any files from homed's managed UID
range that do not match the user's own UID will be shown as "unmapped"
basically. Of course, IRL this should never happen, except if people
managed to manipulate the underlying fs directly.

The 3rd rule is to allow that if devs untar an OS image it more or
less just works as before: 16bit UIDs outside of the homed range will
be mapped onto themselves: you can untar things and tar it back up and
things will just work.

2 years agohomework: rework directory backend to set up mounts in /run/systemd/user-home-mount...
Lennart Poettering [Wed, 20 Oct 2021 20:07:57 +0000 (22:07 +0200)] 
homework: rework directory backend to set up mounts in /run/systemd/user-home-mount before moving them to /home

This does what we already do for the LUKS backend: instead of mounting
the source directory directly to the final home dir, we instead bind
mount it to /run/systemd/user-home-mount (where /run/ is unshared and
specific to our own mount namespace), then adjust its mount flags and
then bind mount it in a single atomic operation into the final
destination, fully set up.

This doesn't improve much on its own, but it makes things a tiny bit
more correct: this way MS_NODEV/MS_NOEXEC/MS_NOSUID will already be
applied when the bind mount appears in the host mount namespace, instead
of being adjusted after the fact.

Doing things this way also makes things work more like the LUKS backend,
reducing surprises. Most importantly it's preparation for doing
uidmapping for directory homes, added in a later commit.

2 years agohomework: when activating a directory, include info about it in resulting record
Lennart Poettering [Wed, 20 Oct 2021 20:03:30 +0000 (22:03 +0200)] 
homework: when activating a directory, include info about it in resulting record

For the other backends we synthesize a "binding" section in the json
record of the user that stores meta info how a user record is "bound" to
the local host. It declares storage info and such. Let's do the same for
the directory/subvolume backends.

2 years agohomework: port home_create_directory_or_subvolume() to use HomeSetup
Lennart Poettering [Wed, 20 Oct 2021 19:45:51 +0000 (21:45 +0200)] 
homework: port home_create_directory_or_subvolume() to use HomeSetup

Let's migrate home_create_directory_or_subvolume() to also use HomeSetup
for storing its runtime objects we'd like to destroy in case of failure.

In the beginning this is just the root_fd, but later on we can add more.

No change in behaviour, just shifting things around.

2 years agohomed: move HOME_UID_{MIN,MAX} into a header we can reuse in homework.c
Lennart Poettering [Wed, 20 Oct 2021 14:14:27 +0000 (16:14 +0200)] 
homed: move HOME_UID_{MIN,MAX} into a header we can reuse in homework.c

2 years agobasic: Make ret_names param to unit_file_find_fragment() optional
Daan De Meyer [Wed, 27 Oct 2021 15:02:56 +0000 (16:02 +0100)] 
basic: Make ret_names param to unit_file_find_fragment() optional

2 years agonetwork: radv: shorten default lifetime of prefix, route prefix, DNS, and domains 21150/head
Yu Watanabe [Sun, 24 Oct 2021 19:32:05 +0000 (04:32 +0900)] 
network: radv: shorten default lifetime of prefix, route prefix, DNS, and domains

See draft-ietf-6man-slaac-renum-02 section 4.1.1.

2 years agosd-radv: shorten the default lifetime for prefix/route prefix
Yu Watanabe [Sun, 24 Oct 2021 19:13:14 +0000 (04:13 +0900)] 
sd-radv: shorten the default lifetime for prefix/route prefix

See draft-ietf-6man-slaac-renum-02 section 4.1.1.

2 years agosd-radv: make prefix/route prefix lifetime can be specified with independently with...
Yu Watanabe [Sun, 24 Oct 2021 17:44:29 +0000 (02:44 +0900)] 
sd-radv: make prefix/route prefix lifetime can be specified with independently with valid_until

Previously, valid_until (or preferred_until for preferred lifetime) was
calculated from lifetime. So, when an upstream interface acquire a
dynamic prefix (e.g. through DHCPv6-PD) with long lifetime, then sd-radv
advertise the same lifetime. It may not be desired for some situations.

2 years agonetwork: route: update lifetime of existing route 21153/head
Yu Watanabe [Wed, 27 Oct 2021 14:37:26 +0000 (23:37 +0900)] 
network: route: update lifetime of existing route

Otherwise, the route whose lifetime is managed by the sd-event's timer
event source will be removed when the initial lifetime expires.

2 years agonetwork: address: use passed Address object if possible
Yu Watanabe [Wed, 27 Oct 2021 14:34:40 +0000 (23:34 +0900)] 
network: address: use passed Address object if possible

Then, we can avoid unnecessary duplication.

2 years agoMerge pull request #21143 from yuwata/sd-radv-router-lifetime 21112/head
Yu Watanabe [Wed, 27 Oct 2021 13:14:35 +0000 (22:14 +0900)] 
Merge pull request #21143 from yuwata/sd-radv-router-lifetime

sd-radv: several cleanups for router lifetime

2 years agobootctl: refuse parsing unknown special '@' entry ids
Lennart Poettering [Wed, 27 Oct 2021 08:30:29 +0000 (10:30 +0200)] 
bootctl: refuse parsing unknown special '@' entry ids

Let's make sure '@' is never written as entry ID into any EFI variable,
as we want the ability to add new ids like this later on, with them
resulting in a clear error on older implementations.

2 years agoMerge pull request #21147 from DaanDeMeyer/hacking-docs
Zbigniew Jędrzejewski-Szmek [Wed, 27 Oct 2021 12:09:46 +0000 (14:09 +0200)] 
Merge pull request #21147 from DaanDeMeyer/hacking-docs

docs: Clean up HACKING.md

2 years agodocs: Specify code block language for mkosi boot instructions 21147/head
Daan De Meyer [Wed, 27 Oct 2021 11:21:57 +0000 (12:21 +0100)] 
docs: Specify code block language for mkosi boot instructions

2 years agodocs: Make mkosi install instructions generic
Daan De Meyer [Wed, 27 Oct 2021 11:08:59 +0000 (12:08 +0100)] 
docs: Make mkosi install instructions generic

2 years agodocs: Extend builddep instructions to include more distros
Daan De Meyer [Wed, 27 Oct 2021 10:30:47 +0000 (11:30 +0100)] 
docs: Extend builddep instructions to include more distros

2 years agosystemctl: small fixes for MountImages pretty printing 21138/head
Luca Boccassi [Wed, 27 Oct 2021 10:17:02 +0000 (11:17 +0100)] 
systemctl: small fixes for MountImages pretty printing

2 years agosystemctl: pretty-print ExtensionImages property
Luca Boccassi [Tue, 26 Oct 2021 21:55:30 +0000 (22:55 +0100)] 
systemctl: pretty-print ExtensionImages property

Complex type, so without explicit support 'systemctl show' just prints [unprintable]

2 years agoMerge pull request #21144 from yuwata/sd-radv-trivial-cleanups
Yu Watanabe [Wed, 27 Oct 2021 10:52:57 +0000 (19:52 +0900)] 
Merge pull request #21144 from yuwata/sd-radv-trivial-cleanups

sd-radv: trivial cleanups

2 years agoconf-parse: make config_parse_many() optionally save 'struct stat' for each file
Yu Watanabe [Mon, 25 Oct 2021 02:13:27 +0000 (11:13 +0900)] 
conf-parse: make config_parse_many() optionally save 'struct stat' for each file

Fixes #21113.

2 years agodocs/COREDUMP_PACKAGE_METADATA: ELF section should be allocated and 0-padded
Luca Boccassi [Wed, 27 Oct 2021 10:27:50 +0000 (11:27 +0100)] 
docs/COREDUMP_PACKAGE_METADATA: ELF section should be allocated and 0-padded

2 years agonetwork: radv: refuse invalid router lifetime in conf parser 21143/head
Yu Watanabe [Wed, 27 Oct 2021 04:22:49 +0000 (13:22 +0900)] 
network: radv: refuse invalid router lifetime in conf parser

2 years agosd-radv: update how to calculate interval of sending advertisements
Yu Watanabe [Wed, 27 Oct 2021 07:08:22 +0000 (16:08 +0900)] 
sd-radv: update how to calculate interval of sending advertisements

2 years agosd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
Yu Watanabe [Sun, 24 Oct 2021 16:21:22 +0000 (01:21 +0900)] 
sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds

See RFC 4861 section 6.2.1.

2 years agodocs: Remove mkosi symlink instruction from HACKING
Daan De Meyer [Wed, 27 Oct 2021 09:54:53 +0000 (10:54 +0100)] 
docs: Remove mkosi symlink instruction from HACKING

mkosi automatically builds for the host distro which seems a much
better default to encourage since dnf won't be installed on any host
system that's not Fedora anyway.

2 years agodocs: Simplify git instructions in HACKING slightly
Daan De Meyer [Wed, 27 Oct 2021 09:54:24 +0000 (10:54 +0100)] 
docs: Simplify git instructions in HACKING slightly