]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agodocs: polish the text about Portable Services a bit 20667/head
Zbigniew Jędrzejewski-Szmek [Tue, 7 Sep 2021 17:14:19 +0000 (19:14 +0200)] 
docs: polish the text about Portable Services a bit

No semantic changes, just removal of repetitions and unnecessary words, and
some more formatting.

4 years agodocs: portablectl is in bin/
Zbigniew Jędrzejewski-Szmek [Tue, 7 Sep 2021 16:43:58 +0000 (18:43 +0200)] 
docs: portablectl is in bin/

Follow-up for 80f39b81f3876ed3816061f1093db991f72269ec.

4 years agotest: udev storage tests
Frantisek Sumsal [Fri, 30 Jul 2021 14:56:10 +0000 (16:56 +0200)] 
test: udev storage tests

4 years agonetwork: fix wrong flag: manage_foreign_routes -> manage_foreign_rules
Yu Watanabe [Tue, 7 Sep 2021 12:46:50 +0000 (21:46 +0900)] 
network: fix wrong flag: manage_foreign_routes -> manage_foreign_rules

Fixes a bug in d94dfe7053d49fa62c4bfc07b7f3fc2227c10aff.

4 years agoMerge pull request #20618 from yuwata/path-find-component
Lennart Poettering [Tue, 7 Sep 2021 08:02:44 +0000 (10:02 +0200)] 
Merge pull request #20618 from yuwata/path-find-component

use path_find_{first,last}_component() at more several places

4 years agotest: do not try to remove /dev 20618/head
Yu Watanabe [Fri, 3 Sep 2021 15:29:11 +0000 (00:29 +0900)] 
test: do not try to remove /dev

4 years agofs-util: rewrite rmdir_parents() with path_find_last_component()
Yu Watanabe [Thu, 2 Sep 2021 04:41:15 +0000 (13:41 +0900)] 
fs-util: rewrite rmdir_parents() with path_find_last_component()

4 years agomkdir: rewrite mkdir_parents() with path_find_{first,last}_component()
Yu Watanabe [Thu, 2 Sep 2021 07:12:16 +0000 (16:12 +0900)] 
mkdir: rewrite mkdir_parents() with path_find_{first,last}_component()

4 years agoMerge pull request #20465 from bluca/portable_validate_sysext
Lennart Poettering [Mon, 6 Sep 2021 19:10:15 +0000 (21:10 +0200)] 
Merge pull request #20465 from bluca/portable_validate_sysext

portabled: validate SYSEXT_LEVEL when attaching

4 years agoMerge pull request #20527 from systemd/wip/hadess/usb-analysers-uaccess
Lennart Poettering [Mon, 6 Sep 2021 19:06:40 +0000 (21:06 +0200)] 
Merge pull request #20527 from systemd/wip/hadess/usb-analysers-uaccess

hwdb: Allow end-users root-less access to USB analysers

4 years agosystemd-analyze: add new option to generate JSON output of security analysis table
Maanya Goenka [Thu, 26 Aug 2021 07:17:32 +0000 (00:17 -0700)] 
systemd-analyze: add new option to generate JSON output of security analysis table

The new option --json= works with the 'security' verb and takes in one of three format flags.
These are off which is the default, pretty and short which use JSON format flags for output.
When set to true, it generates a JSON formatted output of the security analysis table. The
format is a JSON array with objects containing the following fields: set which indicates if
the id has been set or not, name which is what is used to refer to the id, json_field
which is the equivalent JSON formatted id name only used for JSON outputs, description which
is an outline of the id state, and exposure which is an unsigned integer in the range 0.0..10.0,
where a higher value corresponds to a higher security threat. The JSON version of the table is
printed on the standard output file.

Example Run:

The unit file testfile.service was created to test the --json= option

maanya-goenka@debian:~/systemd (json-security)$ cat <<EOF >testfile.service

> [Service]
> ExecStart = echo hello
> PrivateNetwork = yes
> PrivateMounts = yes
> PrivateDevices = yes
> EOF

Both the JSON output and the security analysis table below have been truncated to increase readability.
1. Testing for when --json=off

maanya-goenka@debian:~/systemd (json-security)$ sudo build/systemd-analyze security --json=off --root= --offline=true
testfile.service --no-pager

/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/home/maanya-goenka/systemd/foo.service:2: Unknown key name 'foo' in section 'Unit', ignoring.

    NAME                                                      DESCRIPTION                                                       EXPOSURE
✓   PrivateNetwork=                                           Service has no access to the host's network
✗   User=/DynamicUser=                                        Service runs as root user                                              0.4
✗   CapabilityBoundingSet=~CAP_SET(UID|GID|PCAP)              Service may change UID/GID identities/capabilities                     0.3
✗   CapabilityBoundingSet=~CAP_NET_ADMIN                      Service has administrator privileges                                   0.3

→ Overall exposure level for testfile.service: 8.3 EXPOSED 🙁

2. Testing for when --json=pretty

maanya-goenka@debian:~/systemd (json-security)$ sudo build/systemd-analyze security --json=pretty --root= --offline=true
testfile.service

/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/home/maanya-goenka/systemd/foo.service:2: Unknown key name 'foo' in section 'Unit', ignoring.

[
        {
                "set" : true,
                "name" : "PrivateNetwork=",
"json-field" : "PrivateNetwork",
                "description" : "Service has no access to the host's network",
                "exposure" : null
        },
        {
                "set" : false,
                "name" : "User=/DynamicUser=",
"json-field" : "UserOrDynamicUser",
                "decsription" : "Service runs as root user",
                "exposure" : "0.4"
        },
        {
                "set" : false,
                "name" : "CapabilityBoundingSet=~CAP_SET(UID|GID|PCAP)",
"json_field" : "CapabilityBoundingSet_CAP_SET_UID_GID_PCAP",
                "description" : "Service may change UID/GID identities/capabilities",
                "exposure" : "0.3"
        },
        {
                "set" : false,
                "name" : "CapabilityBoundingSet=~CAP_NET_ADMIN",
"json_field" : "CapabilityBoundingSet_CAP_NET_ADMIN",
                "description" : "Service has administrator privileges",
                "exposure" : "0.3"
        },
        ...
]

3. Testing for when --json=short

maanya-goenka@debian:~/systemd (json-security)$ sudo build/systemd-analyze security --json=short --root= --offline=true
testfile.service

/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/home/maanya-goenka/systemd/foo.service:2: Unknown key name 'foo' in section 'Unit', ignoring.

[{"set":true,"name":"PrivateNetwork=", "json_field":"PrivateNetwork", "description":"Service has no access to the host's network","exposure":null}, ...]

4 years agosystemd-analyze: use config value in RestrictNamespaces id (#20645)
Kyle Laker [Mon, 6 Sep 2021 15:33:16 +0000 (11:33 -0400)] 
systemd-analyze: use config value in RestrictNamespaces id (#20645)

For most fields, the text shown by `.id` is the value that should be set
in the unit file; however, for RestrictNamespaces, it is not. Changing
this to show the actual text makes it more clear to a user what the
actual change that needs to be made to the unit file is.

4 years agoFix volume control keys for LG Gram (#20644)
Ross Jennings [Mon, 6 Sep 2021 14:55:11 +0000 (10:55 -0400)] 
Fix volume control keys for LG Gram (#20644)

Fix volume control keys for LG Gram

4 years agoportabled: refactor extraction/validation into a common helper 20465/head
Luca Boccassi [Mon, 6 Sep 2021 12:19:47 +0000 (13:19 +0100)] 
portabled: refactor extraction/validation into a common helper

4 years agoportabled: validate SYSEXT_LEVEL when attaching
Luca Boccassi [Wed, 4 Aug 2021 14:00:06 +0000 (15:00 +0100)] 
portabled: validate SYSEXT_LEVEL when attaching

When attaching a portable service with extensions, immediately validate
that the os-release and extension-release metadata values match, rather
than letting it fail when the units are started

4 years agoportabled: error out if there are no units only after parsing all images
Luca Boccassi [Wed, 18 Aug 2021 15:37:13 +0000 (16:37 +0100)] 
portabled: error out if there are no units only after parsing all images

It's ok if the OS image doesn't have matching units, if we find them
in the extensions. Tidies up the parsing logic a bit.

4 years agodissect-image: add extension-specific validation flag
Luca Boccassi [Wed, 18 Aug 2021 15:08:14 +0000 (16:08 +0100)] 
dissect-image: add extension-specific validation flag

Allows callers to specify which image type they are looking for

4 years agoFix esc, volume control keys and Fn+F1 for Samsung Galaxy Book
lainahai [Sun, 5 Sep 2021 16:48:08 +0000 (19:48 +0300)] 
Fix esc, volume control keys and Fn+F1 for Samsung Galaxy Book

4 years agoFix volume control keys for Lenovo Ideapad Flex 5
saikat0511 [Sat, 4 Sep 2021 18:24:34 +0000 (23:54 +0530)] 
Fix volume control keys for Lenovo Ideapad Flex 5

Fixes the keys not creating release events

4 years agotmpfiles: minor modernization
Yu Watanabe [Sat, 4 Sep 2021 20:46:21 +0000 (05:46 +0900)] 
tmpfiles: minor modernization

4 years agohome: 'secret' argument of handle_generic_user_record_error may be null
Yu Watanabe [Sun, 5 Sep 2021 02:16:26 +0000 (11:16 +0900)] 
home: 'secret' argument of handle_generic_user_record_error may be null

When RefHome() bus method is called in acquire_home(), secret is NULL.

Fixes #20639.

4 years agotree-wide: fix typo
Yu Watanabe [Sat, 4 Sep 2021 22:12:50 +0000 (07:12 +0900)] 
tree-wide: fix typo

4 years agoMerge pull request #20626 from yuwata/network-keep-master
Luca Boccassi [Sat, 4 Sep 2021 14:08:56 +0000 (15:08 +0100)] 
Merge pull request #20626 from yuwata/network-keep-master

network: introduce KeepMaster= setting

4 years agomeson.build: change operator combining bools from + to and
Dan Streetman [Fri, 3 Sep 2021 16:43:33 +0000 (12:43 -0400)] 
meson.build: change operator combining bools from + to and

upstream meson stopped allowing combining boolean with the plus
operator, and now requires using the logical and operator

reference:
https://github.com/mesonbuild/meson/commit/43302d3296baff6aeaf8e03f5d701b0402e37a6c

Fixes: #20632
4 years agonetwork: add 80-container-vb.network 20626/head
Yu Watanabe [Thu, 2 Sep 2021 23:47:49 +0000 (08:47 +0900)] 
network: add 80-container-vb.network

4 years agotest-network: add tests for KeepMaster=
Yu Watanabe [Fri, 3 Sep 2021 15:23:55 +0000 (00:23 +0900)] 
test-network: add tests for KeepMaster=

4 years agoMerge pull request #20629 from keszybz/mkosi-host-distro-by-default
Zbigniew Jędrzejewski-Szmek [Fri, 3 Sep 2021 15:46:35 +0000 (17:46 +0200)] 
Merge pull request #20629 from keszybz/mkosi-host-distro-by-default

mkosi: build for the host distro by default

4 years agonetwork: introduce KeepMaster= setting
Yu Watanabe [Thu, 2 Sep 2021 21:10:07 +0000 (06:10 +0900)] 
network: introduce KeepMaster= setting

Closes #20624.

4 years agonetwork: assume enslaved when master ifindex is positive
Yu Watanabe [Thu, 2 Sep 2021 23:04:29 +0000 (08:04 +0900)] 
network: assume enslaved when master ifindex is positive

4 years agonetwork: use master ifindex to check if the interface is enslaved
Yu Watanabe [Thu, 2 Sep 2021 22:24:15 +0000 (07:24 +0900)] 
network: use master ifindex to check if the interface is enslaved

4 years agoman: drop unnecessary white space
Yu Watanabe [Thu, 2 Sep 2021 21:09:54 +0000 (06:09 +0900)] 
man: drop unnecessary white space

4 years agoformat-table: allow to explicitly override JSON field names
Lennart Poettering [Fri, 3 Sep 2021 09:11:18 +0000 (11:11 +0200)] 
format-table: allow to explicitly override JSON field names

In some cases it's useful to explicitly generate the JSON field names to
generate for table columns, instead of auto-mangling them from table
header names that are intended for human consumption.

This adds the infra and a test for it.

It's intended to be used by #20544, for the first column, which in text
mode should have an empty header field, but have an explicit name in
json output mode.

4 years agomkosi: move distro files to mkosi.default.d/ 20629/head
Zbigniew Jędrzejewski-Szmek [Thu, 2 Sep 2021 12:39:37 +0000 (14:39 +0200)] 
mkosi: move distro files to mkosi.default.d/

With this change, "mkosi build" will automatically build systemd for the
current distro without any further configuration. If people want to do a
cross-distro build by default, they can still create mkosi.default, but I
assume that this is relatively rare.

If people have symlinked mkosi.default to one of the files in .mkosi/, they'll
need to adjust the symlink.

(Building without configuration would always fail, since systemd has many many
required dependencies. I think it's nicer to do the most commonly expected
thing by default, i.e. rebuild for the current distro.)

Mkosi is nowadays packaged for most distros, so recommend installing of distro
packages as the primary installation mechanism.

4 years agogitignore: only ignore *local*.conf" under mkosi.default.d/
Zbigniew Jędrzejewski-Szmek [Thu, 2 Sep 2021 12:33:55 +0000 (14:33 +0200)] 
gitignore: only ignore *local*.conf" under mkosi.default.d/

The pattern was added in 6242cda99d9194efec20997697d703c0c005dbd4, with the
idea that users will have local configuration files for mkosi and git should
not bother them about those. But let's make this narrower, and only match
files with "local". This way we reduce the risk that some unrelated file
will be ignored by accident.

.gitignore in the parent directory is used, because mkosi apparently tries
to load all files under mkosi.default.d/, without looking at the extension.
This is probably something to fix in mkosi too.

4 years agojournalctl: Use constants in some more places
Jan Janssen [Thu, 2 Sep 2021 11:28:55 +0000 (13:28 +0200)] 
journalctl: Use constants in some more places

4 years agomkosi: make mkosi.build shellcheck-clean
Zbigniew Jędrzejewski-Szmek [Thu, 2 Sep 2021 12:22:19 +0000 (14:22 +0200)] 
mkosi: make mkosi.build shellcheck-clean

Also remove the space after redirection operators. (Some redirections
were with, some without, and I think it's nicer without.)

4 years agomkosi: drop the code to determine nobody user name
Zbigniew Jędrzejewski-Szmek [Thu, 2 Sep 2021 12:19:19 +0000 (14:19 +0200)] 
mkosi: drop the code to determine nobody user name

The comments were outdated: at least "nfsnobody" is not used in Fedora since a
few years. So I hope we don't need this anymore. The meson build scripts do
autodetection on their own.

4 years agoMerge pull request #20603 from yuwata/udev-node-cleanups
Yu Watanabe [Thu, 2 Sep 2021 20:33:06 +0000 (05:33 +0900)] 
Merge pull request #20603 from yuwata/udev-node-cleanups

udev: cleanups for creating/removing device node symlinks

4 years agohwdb: Allow end-users root-less access to USB analyzers 20527/head
Bastien Nocera [Tue, 24 Aug 2021 11:54:02 +0000 (13:54 +0200)] 
hwdb: Allow end-users root-less access to USB analyzers

Procotol analyzers are external devices used to capture traffic over a
wire so that it could be analysed. End-users at the console should be
able to access those devices without requiring root access.

This change obsoletes the need to install Total Phase's "Linux drivers",
which are really just udev rules and hotplug usermap files to do that:
https://www.totalphase.com/products/usb-drivers-linux/

4 years agosd-journal: use FILE streams to buffer write_uint64()
Vito Caputo [Tue, 31 Aug 2021 01:20:53 +0000 (18:20 -0700)] 
sd-journal: use FILE streams to buffer write_uint64()

journal_file_verify() uses a set of tmpfs files to create lists
of object positions by type.

The existing code used a bare write() call for every object
position written, incurring a syscall per listed object.

This commit encapsulates the bare file descriptors in FILE *'s
and replaces the bare write with fwrite, buffering the writes so
there's less syscalls.

Cached `journalctl --verify` tests showed a ~8% faster runtime
with this change on a release build, verifying 1.3GiB of
production journals across 16 files.

4 years agoxattr-util: drop unused path_getcrtime()
Yu Watanabe [Thu, 2 Sep 2021 03:10:59 +0000 (12:10 +0900)] 
xattr-util: drop unused path_getcrtime()

4 years agofs-util: use futimens_opath() helper function
Yu Watanabe [Thu, 2 Sep 2021 03:05:33 +0000 (12:05 +0900)] 
fs-util: use futimens_opath() helper function

4 years agofs-util: drop unnecessary initialization
Yu Watanabe [Thu, 2 Sep 2021 03:05:14 +0000 (12:05 +0900)] 
fs-util: drop unnecessary initialization

4 years agoudev-node: drop redundant trial of devlink creation 20603/head
Yu Watanabe [Wed, 1 Sep 2021 00:29:42 +0000 (09:29 +0900)] 
udev-node: drop redundant trial of devlink creation

Previously, the devlink was created based on the priority saved in udev
database. So, we needed to reevaluate devlinks after database is saved.

But now the priority is stored in the symlink under /run/udev/links, and
the loop of devlink creation is controlled with the timestamp of the
directory. So, the double evaluation is not necessary anymore.

4 years agoudev-node: add random delay on conflict in updating device node symlink
Yu Watanabe [Tue, 31 Aug 2021 19:34:48 +0000 (04:34 +0900)] 
udev-node: add random delay on conflict in updating device node symlink

To make multiple workers not update the same device node symlink
simultaneously.

4 years agoudev-node: shorten code a bit and update log message
Yu Watanabe [Wed, 1 Sep 2021 23:23:35 +0000 (08:23 +0900)] 
udev-node: shorten code a bit and update log message

4 years agoudev-node: check stack directory change even if devlink is removed
Yu Watanabe [Wed, 1 Sep 2021 00:44:26 +0000 (09:44 +0900)] 
udev-node: check stack directory change even if devlink is removed

Otherwise, when multiple device additions and removals occur
simultaneously, symlink to unexisting devnode may be created.

Hopefully fixes #19946.

4 years agoudev-node: always atomically create symlink to device node
Yu Watanabe [Tue, 31 Aug 2021 17:20:33 +0000 (02:20 +0900)] 
udev-node: always atomically create symlink to device node

By the previous commit, it is not necessary to distinguish if the devlink
already exists. Also, I cannot find any significant advantages of the
previous complecated logic, that is, first try to create directly, and then
fallback to atomically creation. Moreover, such logic increases the chance
of conflicts between multiple udev workers.

This makes devlinks always created atomically. Hopefully, this reduces the
conflicts between the workers.

4 years agoudev-node: assume no new claim to a symlink if /run/udev/links is not updated
Yu Watanabe [Wed, 1 Sep 2021 21:58:59 +0000 (06:58 +0900)] 
udev-node: assume no new claim to a symlink if /run/udev/links is not updated

During creating a symlink to a device node, if another device node which
requests the same symlink is added/removed, `stat_inode_unmodified()`
should always detects that. We do not need to continue the loop
unconditionally.

4 years agoudev-node: always update timestamp of stack directory
Yu Watanabe [Wed, 1 Sep 2021 03:57:40 +0000 (12:57 +0900)] 
udev-node: always update timestamp of stack directory

Please see the comments in the code.

4 years agoudev-node: save information about device node and priority in symlink
Yu Watanabe [Tue, 31 Aug 2021 19:16:21 +0000 (04:16 +0900)] 
udev-node: save information about device node and priority in symlink

Previously, we only store device IDs in /run/udev/links, and when
creating/removing device node symlink, we create sd_device object
corresponds to the IDs and read device node and priority from the
object. That requires parsing uevent and udev database files.

This makes link_find_prioritized() get the most prioritzed device node
without parsing the files.

4 years agoudev-node: stack directory must exist when adding device node symlink
Yu Watanabe [Tue, 31 Aug 2021 19:14:42 +0000 (04:14 +0900)] 
udev-node: stack directory must exist when adding device node symlink

4 years agoudev-node: split out permission handling from udev_node_add()
Yu Watanabe [Wed, 1 Sep 2021 00:24:15 +0000 (09:24 +0900)] 
udev-node: split out permission handling from udev_node_add()

And then merge udev_node_add() and udev_node_update_old_links().

4 years agosd-device: introduce device_has_devlink()
Yu Watanabe [Wed, 1 Sep 2021 00:22:15 +0000 (09:22 +0900)] 
sd-device: introduce device_has_devlink()

4 years agoMerge pull request #20614 from poettering/efi-clean-ups
Yu Watanabe [Wed, 1 Sep 2021 23:30:07 +0000 (08:30 +0900)] 
Merge pull request #20614 from poettering/efi-clean-ups

two minor clean-ups for the efi code

4 years agonspawn: fix type to pass to connect()
Lennart Poettering [Wed, 1 Sep 2021 12:41:37 +0000 (14:41 +0200)] 
nspawn: fix type to pass to connect()

It expects a generic "struct sockaddr", not a "struct sockaddr_un".
Pass the right member of the union.

Not sure why gcc/llvm never complained about this...

4 years agoefi: drop spaces between function name and "(" 20614/head
Lennart Poettering [Wed, 1 Sep 2021 12:40:33 +0000 (14:40 +0200)] 
efi: drop spaces between function name and "("

When pulling in the SHA256 implementation from glibc, only some of the
coding style was adjusted to ours, other was not. Let's make things a
bit more consistent.

4 years agoefi: make EFI_GUID generally constant
Lennart Poettering [Wed, 1 Sep 2021 09:33:06 +0000 (11:33 +0200)] 
efi: make EFI_GUID generally constant

The GUIDs we usually deal with should be considered constant. Hence make
them so. Unfortunately the prototypes for various functions doesn't mark
them as const (but still decorates them with "IN", clarifying they are
input-only), hence we need to cast things at various places. We already
cast in similar fashion in many other cases, hence unify things here in
one style.

Making the EFI_GUID constant (and in particular so when specified in C99
compound literal style) allows compilers to merge multiple instances of
them.

4 years agorepart: Support volatile-root for finding the root partition
Kristian Klausen [Wed, 1 Sep 2021 13:59:04 +0000 (15:59 +0200)] 
repart: Support volatile-root for finding the root partition

The automatic logic can't always find the original root partition (ex:
if the rootfs is copied to a ext4 fs backed by zram in the initramfs),
so we want to support "/run/systemd/volatile-root" which is a symlink to
the original root partition.

Fix #20610

4 years agotest: make sure to include all haveged unit files
Franck Bui [Tue, 31 Aug 2021 13:49:43 +0000 (15:49 +0200)] 
test: make sure to include all haveged unit files

Recent versions of haveged relies on haveged-switch-root.service too.

4 years agoMerge pull request #20575 from vcaputo/verify_field_object_hash
Lennart Poettering [Wed, 1 Sep 2021 13:56:05 +0000 (15:56 +0200)] 
Merge pull request #20575 from vcaputo/verify_field_object_hash

sd-journal: verify field object hash

4 years agoudev: Import hwdb matches for USB devices
Bastien Nocera [Mon, 30 Aug 2021 12:08:06 +0000 (14:08 +0200)] 
udev: Import hwdb matches for USB devices

Import hwdb matches for USB devices (not interfaces) which don't usually
have a modalias so that it's possible to, for example, make them
available for unprivileged users.

4 years agoudev: do not remove control socket on exit
Yu Watanabe [Tue, 31 Aug 2021 13:32:41 +0000 (22:32 +0900)] 
udev: do not remove control socket on exit

As we usually do, remove old unix socket before bind.

Note that systemd-udevd-control.socket has `RemoveOnStop=yes`.
So, it is not necessary to be removed when the service exits.

Replaces #20584 and #20588.

4 years agoMerge pull request #20537 from yuwata/sd-netlink-more-attributes
Lennart Poettering [Wed, 1 Sep 2021 11:25:54 +0000 (13:25 +0200)] 
Merge pull request #20537 from yuwata/sd-netlink-more-attributes

udev: use link info obtained through netlink

4 years agoMerge pull request #20521 from DaanDeMeyer/analyze-condition-units
Lennart Poettering [Wed, 1 Sep 2021 11:25:31 +0000 (13:25 +0200)] 
Merge pull request #20521 from DaanDeMeyer/analyze-condition-units

analyze: Support passing unit files to systemd-analyze condition

4 years agomkosi: Add zsh to Arch packages 20521/head
Daan De Meyer [Mon, 23 Aug 2021 15:44:58 +0000 (16:44 +0100)] 
mkosi: Add zsh to Arch packages

Useful for testing zsh completion changes.

4 years agomkosi: Install bash-completion in Arch image
Daan De Meyer [Mon, 23 Aug 2021 15:26:46 +0000 (16:26 +0100)] 
mkosi: Install bash-completion in Arch image

Useful for testing bash completion changes.

4 years agomkosi: Add man-db to arch packages
Daan De Meyer [Mon, 23 Aug 2021 13:31:56 +0000 (14:31 +0100)] 
mkosi: Add man-db to arch packages

Required to test systemd-analyze verify.

4 years agopo: Translated using Weblate (Finnish)
Jan Kuparinen [Tue, 31 Aug 2021 20:04:56 +0000 (22:04 +0200)] 
po: Translated using Weblate (Finnish)

Currently translated at 48.6% (92 of 189 strings)

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main

4 years agoMerge pull request #20525 from maanyagoenka/custom-security
Luca Boccassi [Tue, 31 Aug 2021 20:15:41 +0000 (21:15 +0100)] 
Merge pull request #20525 from maanyagoenka/custom-security

systemd-analyze: add option to enable users to custom define security requirements in the form of a .json file

4 years agoupdate TODO
Lennart Poettering [Tue, 31 Aug 2021 15:11:10 +0000 (17:11 +0200)] 
update TODO

4 years agonetwork: print Ethernet Link-Layer DHCP client ID with leading 0's
Alvin Šipraga [Tue, 31 Aug 2021 12:17:33 +0000 (14:17 +0200)] 
network: print Ethernet Link-Layer DHCP client ID with leading 0's

This is a small cosmetic change.

Before:

   Offered DHCP leases: 192.168.0.183 (to 0:9:a7:36:bc:89)

After:

   Offered DHCP leases: 192.168.0.183 (to 00:09:a7:36:bc:89)

4 years agotest: add integration tests for systemd-analyze 20525/head
Maanya Goenka [Wed, 25 Aug 2021 16:44:26 +0000 (09:44 -0700)] 
test: add integration tests for systemd-analyze

4 years agosystemd-analyze: allow parsing of JSON file to obtain custom security requirements...
Maanya Goenka [Mon, 23 Aug 2021 21:21:50 +0000 (14:21 -0700)] 
systemd-analyze: allow parsing of JSON file to obtain custom security requirements for comparison

The 'security' verb of systemd-analyze needs to be able to parse JSON files to be able to read in
the user-defined requirements and use them to determine the overall exposure level of the specified unit
file(s). The JSON files are expected to have a specific format where the keys in the file are the
unit ids consisting of only alphanumeric characters and underscores and the values are JSON objects
again consisting of key value pairs. The keys in these objects may include one or more of the following
properties: description_na, description_good, description_bad, weight, and range. The first three of these
are expected to be strings and the latter two are expected to be unsigned integer values. If one or more
of these properties is missing from the JSON object, then the default values of the properties as specified
in the hard coded set of security directives is used. The other properties that assess() needs to determine
overall exposure levels for a unit file for example, the assess function and parameter type among others,
are not to be included in the JSON files defined by the user because the values assigned to these fields
are expected to be consistent across unit files for each id.

4 years agosystemd-analyze: add new 'security' option to allow user to choose custom requirements
Maanya Goenka [Mon, 23 Aug 2021 21:20:10 +0000 (14:20 -0700)] 
systemd-analyze: add new 'security' option to allow user to choose custom requirements

A new option --security-policy= is added to work with the 'security' verb in order to enable
users to create and pass in a JSON file consisting of user defined requirements
against which to compare the specified unit file(s). These requirements then serve
as the measure of security threats for the file instead of the initial hard coded set of
requirements that the 'security' verb of systemd-analyze relied on.

Example Run:

A snapshot of the user defined testfile.json file is shown below instead of the complete file
for readability purposes.

{
"PrivateDevices":
    {"description_good": "Service has no access to hardware devices",
    "description_bad": "Service potentially has access to hardware devices",
    "weight": 1000,
    "range": 1
    },
"PrivateMounts":
    {"description_good": "Service cannot install system mounts",
    "description_bad": "Service may install system mounts",
    "weight": 1000,
    "range": 1
    },
"PrivateNetwork":
    {"description_good": "Service has no access to the host's network",
    "description_bad": "Service has access to the host's network",
    "weight": 2500,
    "range": 1
    },
"PrivateTmp":
    {"description_good": "Service has no access to other software's temporary files",
    "description_bad": "Service has access to other software's temporary files",
    "weight": 1000,
    "range": 1
    },
"PrivateUsers":
    {"description_good": "Service does not have access to other users",
    "description_bad": "Service has access to other users",
    "weight": 1000,
    "range": 1
    }
}

1. I created the jsontest.service file in order to test the --security-policy= option as follows:

maanya-goenka@debian:~/systemd (custom-security)$ cat<<EOF>jsontest.service
> [Service]
> ExecStart = echo hello
> PrivateNetwork = yes
> PrivateDevices = yes
> PrivateMounts = yes
> EOF

The security analysis table outputted below has been truncated to include only the first few lines for readability.

maanya-goenka@debian:~/systemd (custom-security)$ sudo build/systemd-analyze security --root= --offline=true
--security-policy=src/analyze/testfile.json jsontest.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

  NAME                                                         DESCRIPTION
✓ PrivateNetwork                                               Service has no access to the host's network
✗ UserOrDynamicUser                                            Service runs as root user
✗ CapabilityBoundingSet_CAP_SET_UID_GID_PCAP                   Service may change UID/GID identities/capabilities
✓ PrivateMounts                                                Service cannot install system mounts
✓ PrivateDevices                                               Service has no access to hardware devices

→ Overall exposure level for jsontest.service: 8.3 EXPOSED 🙁

maanya-goenka@debian:~/systemd (custom-security)$ echo $? 0

2. In order to ensure that the JSON data was actually being correctly parsed, I made some changes to the JSON
file, specifically to the id "PrivateNetwork" as follows:

Before:
--------

"PrivateNetwork":
    {"description_good": "Service has no access to the host's network",
    "description_bad": "Service has access to the host's network",
    "weight": 2500,
    "range": 1
    }

After:
--------

"PrivateNetwork":
    {"description_good": "Service runs without access to host network",
    "description_bad": "Service has access to the host's network",
    "weight": 6000,
    "range": 1
    }

As expected, the new description for the description_good field of the Private Network id was updated in
the analysis table outputted below and the overall exposure level of the unit file decreased because
the weight assigned to 'Private Network' (which is set to yes) increased from 2500 to 6000.

maanya-goenka@debian:~/systemd (custom-security)$ sudo build/systemd-analyze security --root= --offline=true
--security-policy=src/analyze/testfile.json jsontest.service

/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

  NAME                                                         DESCRIPTION
✓ PrivateNetwork                                               Service runs without access to the host's network
✗ UserOrDynamicUser                                            Service runs as root user
✗ CapabilityBoundingSet_CAP_SET_UID_GID_PCAP                   Service may change UID/GID identities/capabilities
✓ PrivateMounts                                                Service cannot install system mounts
✓ PrivateDevices                                               Service has no access to hardware devices

→ Overall exposure level for jsontest.service: 7.8 EXPOSED 🙁

maanya-goenka@debian:~/systemd (custom-security)$ echo $? 0

3. When paired with security's --threshold= option, systemd-analyze exits with a non-zero error status indicating
that the overall exposure level for the unit file (=78) is greater than the set threshold (=70). The same
jsontest.service file is used for the demo run below:

maanya-goenka@debian:~/systemd (custom-security)$ sudo build/systemd-analyze security --root= --offline=true
--security-policy=src/analyze/testfile.json --threshold=70 jsontest.service

/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

  NAME                                                         DESCRIPTION
✓ PrivateNetwork                                               Service runs without access to host network
✗ UserOrDynamicUser                                            Service runs as root user
✗ CapabilityBoundingSet_CAP_SET_UID_GID_PCAP                   Service may change UID/GID identities/capabilities
✓ PrivateMounts                                                Service cannot install system mounts
✓ PrivateDevices                                               Service has no access to hardware devices

→ Overall exposure level for jsontest.service: 7.8 EXPOSED 🙁

maanya-goenka@debian:~/systemd (custom-security)$ echo $? 1

new option

4 years agoudev: use link information obtained through netlink 20537/head
Yu Watanabe [Mon, 30 Aug 2021 15:41:36 +0000 (00:41 +0900)] 
udev: use link information obtained through netlink

4 years agoudev: introduce link_info_get()
Yu Watanabe [Fri, 27 Aug 2021 08:02:59 +0000 (17:02 +0900)] 
udev: introduce link_info_get()

4 years agoudev: rename struct netnames -> NetNames
Yu Watanabe [Mon, 23 Aug 2021 17:22:12 +0000 (02:22 +0900)] 
udev: rename struct netnames -> NetNames

4 years agoudev: use passed rtnl in net_setup_link builtin command
Yu Watanabe [Sun, 29 Aug 2021 23:30:12 +0000 (08:30 +0900)] 
udev: use passed rtnl in net_setup_link builtin command

4 years agoudev: pass rtnl to builtin commands
Yu Watanabe [Sun, 29 Aug 2021 23:20:05 +0000 (08:20 +0900)] 
udev: pass rtnl to builtin commands

4 years agoudev: simplify get_virtfn_info()
Yu Watanabe [Fri, 27 Aug 2021 08:53:27 +0000 (17:53 +0900)] 
udev: simplify get_virtfn_info()

4 years agoMerge pull request #20592 from poettering/homed-fix-smb
Lennart Poettering [Tue, 31 Aug 2021 12:20:53 +0000 (14:20 +0200)] 
Merge pull request #20592 from poettering/homed-fix-smb

various fixes to make homed's smb backend work correctly again

4 years agoudev: drop redundant chase_symlinks()
Yu Watanabe [Fri, 27 Aug 2021 08:36:22 +0000 (17:36 +0900)] 
udev: drop redundant chase_symlinks()

`sd_device_new_from_syspath()` internally calls chase_symlinks().

4 years agoudev: fix potential memleak
Yu Watanabe [Fri, 27 Aug 2021 08:27:26 +0000 (17:27 +0900)] 
udev: fix potential memleak

4 years agosd-netlink: introduce sd_netlink_message_get_max_attribute()
Yu Watanabe [Fri, 27 Aug 2021 07:30:19 +0000 (16:30 +0900)] 
sd-netlink: introduce sd_netlink_message_get_max_attribute()

4 years agosd-netlink: specify appropriate netlink attribute type
Yu Watanabe [Wed, 25 Aug 2021 16:29:21 +0000 (01:29 +0900)] 
sd-netlink: specify appropriate netlink attribute type

4 years agosd-netlink: support more rtnl attributes
Yu Watanabe [Wed, 25 Aug 2021 16:20:39 +0000 (01:20 +0900)] 
sd-netlink: support more rtnl attributes

4 years agobasic/linux: add more bridge headers
Yu Watanabe [Wed, 25 Aug 2021 07:52:32 +0000 (16:52 +0900)] 
basic/linux: add more bridge headers

4 years agonetwork/netdev: append IFLA_INFO_DATA attribute only when it is necessary
Yu Watanabe [Wed, 25 Aug 2021 16:05:11 +0000 (01:05 +0900)] 
network/netdev: append IFLA_INFO_DATA attribute only when it is necessary

4 years agotmpfiles.d: remove .Test-unix, it's obsolete
Peter Hutterer [Tue, 31 Aug 2021 05:20:12 +0000 (15:20 +1000)] 
tmpfiles.d: remove .Test-unix, it's obsolete

See libxtrans commit 0794b1b712a90b40e2b019c9edc6f96874493c52. The code
to generate this socket was removed 5 years ago and even before it was
conditional on #define TEST_t. There is no reference to that #define in
either the X server nor libX11's git history, or in any of the current
libX*.

Let's assume this is well and truly obsolete.

4 years agohomed: remove misplaced assert() 20592/head
Lennart Poettering [Tue, 31 Aug 2021 08:47:40 +0000 (10:47 +0200)] 
homed: remove misplaced assert()

4 years agohomed: add missing SYNTHETIC_ERRNO()
Lennart Poettering [Tue, 31 Aug 2021 08:47:29 +0000 (10:47 +0200)] 
homed: add missing SYNTHETIC_ERRNO()

4 years agohomed: fix log message referring to fsck, when we actually mean mount
Lennart Poettering [Tue, 31 Aug 2021 08:47:02 +0000 (10:47 +0200)] 
homed: fix log message referring to fsck, when we actually mean mount

4 years agohomed: make sure to use right asssesors for GID + access mode
Lennart Poettering [Tue, 31 Aug 2021 08:46:06 +0000 (10:46 +0200)] 
homed: make sure to use right asssesors for GID + access mode

Don't reach directly into the UserRecord struct, but use the right
assessors, so that the "unspecified" case is covered.

4 years agohomed: add missing capabilities for SMB/CIFS backend
Lennart Poettering [Tue, 31 Aug 2021 08:04:06 +0000 (10:04 +0200)] 
homed: add missing capabilities for SMB/CIFS backend

In 2020 mount.cifs started to require a bunch for caps to work. let's
add them to the capability bounding set.

Also, SMB support obviously needs network access, hence open that up.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1962920
4 years agoMerge pull request #20257 from bluca/seqno
Luca Boccassi [Tue, 31 Aug 2021 08:06:33 +0000 (09:06 +0100)] 
Merge pull request #20257 from bluca/seqno

Use new diskseq block device property

4 years agoMerge pull request #20567 from yuwata/socket-additional-cmsg-buffer
Yu Watanabe [Tue, 31 Aug 2021 04:54:18 +0000 (13:54 +0900)] 
Merge pull request #20567 from yuwata/socket-additional-cmsg-buffer

socket-util: add additional cmsg buffer for 64bit timeval or timespec

4 years agogpt-auto-generator: Use volatile-root by default and automatic logic as fallback
Kristian Klausen [Mon, 30 Aug 2021 07:55:41 +0000 (09:55 +0200)] 
gpt-auto-generator: Use volatile-root by default and automatic logic as fallback

Previously volatile-root was only checked if "/" wasn't backed by a
block device, but the block device isn't necessarily original root block
device (ex: if the rootfs is copied to a ext4 fs backed by zram in the
initramfs), so we always want volatile-root checked.

So shuffle the code around so volatile-root is checked first and
fallback to the automatic logic.

Fix #20557

4 years agoMerge pull request #20583 from poettering/pk-no-tty
Yu Watanabe [Tue, 31 Aug 2021 04:45:04 +0000 (13:45 +0900)] 
Merge pull request #20583 from poettering/pk-no-tty

some polkit agent tweaks

4 years agoman: Don't leak memory in path-documents example
Thomas Mühlbacher [Mon, 30 Aug 2021 14:16:30 +0000 (16:16 +0200)] 
man: Don't leak memory in path-documents example

The `sd_path_lookup(3)` man page states that the returned string shall be
`free(3)`'d but then doesn't do so in the example code.

Also add basic error handling as well.