1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

50874 Commits

Author SHA1 Message Date
Yu Watanabe
086a351ad9 network: ndisc: fix ipv6 route preference for routes with Gateway=_ipv6ra 2021-04-29 08:50:54 +09:00
Yu Watanabe
27a213392f network: neighbor: downgrade log level
As commented in the code, kernel sends messages about neighbors after
a link is removed.
2021-04-29 03:16:30 +09:00
Yu Watanabe
83e7c37b19 network: link: downgrade log level
The error is harmless, and will be ignored. Let's downgrade log level.
2021-04-29 03:16:30 +09:00
Yu Watanabe
dec2ed3e75 network: dhcp4: downgrade log level
It is not necessary to log such information on higher level.
2021-04-29 03:12:29 +09:00
Yu Watanabe
e110d0f0f6 systemctl: fix build failure
Follow-up for 255b1fc8a3.
2021-04-29 03:03:55 +09:00
Yu Watanabe
255b1fc8a3 bus-print-property: introduce BusPrintPropertyFlags
Follow-ups for 1ceaad6937.
2021-04-28 17:36:09 +02:00
Lennart Poettering
feb10c665f docs: document that one shouldn't pass the audit caps to containers
Apparently this is not well know, so let' document this.
2021-04-28 17:29:09 +02:00
Lennart Poettering
e6f1d7f4ec
Merge pull request #19316 from keszybz/mkosi-f34
Bump mkosi config for F34
2021-04-28 15:12:59 +02:00
Lennart Poettering
53515c6939
Merge pull request #19446 from poettering/logind-trigger-new
logind/dissect: use sd_device_trigger() more
2021-04-28 13:26:29 +02:00
Perry.Yuan
5ed0ea2928
hwdb: 60-keyboard:: Update Dell Privacy Local Mic Mute Hotkey (#19261)
This patch fix scancode 0x120001 mapping to key code F20 micmute
The previous scancode is not correct, it will cause the micmute
hotkey no function when testing the mic mute
2021-04-28 12:37:39 +02:00
Zbigniew Jędrzejewski-Szmek
686fd8f619 mkosi: do not pull in perl dependencies
It was added in e2c5e698c0, but nobody remembers why exactly.
2021-04-28 11:32:58 +02:00
Zbigniew Jędrzejewski-Szmek
ecd1bfdd3c hwdb-test: pass an explit path to systemd-hwdb
https://github.com/systemd/systemd/pull/19316 failed with:
[1065/1670] Linking target systemd-hwdb
--- command ---
14:28:29 /root/src/test/hwdb-test.sh
--- stdout ---
./systemd-hwdb does not exist, please build first

I'm not sure what is going on here… In principle meson says that tests may be
called from any directory, but in practice is was always the build directory.
So far we were relying on systemd-hwdb being present in '.', and this worked.
Either way, it's nicer to pass the exact path, so let's do that.
2021-04-28 11:32:58 +02:00
Zbigniew Jędrzejewski-Szmek
fe12f036fe mkosi,man: bump fedora version
F34 was just released and should be fine for systemd builds.

Cloud-1.2 is the latest version.
2021-04-28 11:32:48 +02:00
Uwe Kleine-König
cbcdcaaa0e Add support for conditions on the machines firmware
This allows to limit units to machines that run on a certain firmware
type. For device tree defined machines checking against the machine's
compatible is also possible.
2021-04-28 10:55:55 +02:00
Lennart Poettering
b64c4ece74 dissect-image: use sd_device_trigger() API
Let's use the new API here too.
2021-04-28 10:24:20 +02:00
Lennart Poettering
d8021ea1da logind: use new sd_device_trigger() API
This is a follow-up for 21012e20a4 and
related commits, i.e. one more occasion we can use the
sd_device_trigger() API.
2021-04-28 09:48:42 +02:00
William A. Kennington III
192a9d95ea network: neighbor: Always add neighbors with replace
We were duplicating setting flags for the message and a combination of
NLM_F_APPEND and NLM_F_CREATE which does not make sense. We should have
been using NLM_F_REPLACE and NLM_F_CREATE since the kernel can
dynamically create neighbors prior to us adding an entry. Otherwise, we
can end up with cases where the message will time out after ~25s even
though the neighbor still gets added. This delays the rest of the setup
of the interface even though the error is ultimately ignored.
2021-04-28 00:06:20 +09:00
Franck Bui
45b1fc3a88 system-conf: drop reference to ShutdownWatchdogUsec=
Commit 65224c1d0e renamed ShutdownWatchdogUsec
into RebootWatchdogUsec but left a reference of ShutdownWatchdogUsec in
system.conf.
2021-04-27 12:38:57 +01:00
Zbigniew Jędrzejewski-Szmek
862e01d70f
Merge pull request #17655 from wat-ze-hex/bpf-build-rule
Introduce SocketBind{Allow|Deny}= properties powered by source compiled BPF
2021-04-27 12:52:30 +02:00
Frantisek Sumsal
1ceaad6937 systemctl: hide some empty properties without --all
Fixes: #19423
2021-04-27 12:16:50 +09:00
Julia Kartseva
7dc1707aab fuzz: add SocketBind{Allow|Deny}= directive 2021-04-26 16:26:28 -07:00
Julia Kartseva
c308025875 readme: update README with requirements for bpf 2021-04-26 16:26:28 -07:00
Julia Kartseva
6359811021 man: add SocketBind{Allow|Deny}= documentation 2021-04-26 16:26:28 -07:00
Julia Kartseva
18ef723ef6 systemctl: show SocketBind{Allow|Deny} properties 2021-04-26 16:26:28 -07:00
Julia Kartseva
dcf4781caf dbus: add dbus-cgroup for SocketBind{Allow|Deny}= 2021-04-26 16:26:28 -07:00
Julia Kartseva
28b76fc82a tests: add test program for SocketBind{Allow|Deny}=
Verify that service exited correctly if valid ports are passed to
SocketBind{Allow|Deny}=
Use `ncat` program starting a listening service binding to a specified
port, e.g.
"timeout --preserve-status -sSIGTERM 1s /bin/nc -l -p ${port} -vv"
2021-04-26 16:26:28 -07:00
Julia Kartseva
3d027d4d60 shared, bpf: add bpf link serialization
core: serialize socket_bind bpf links
2021-04-26 16:26:24 -07:00
Julia Kartseva
8dd210ab66 core: add SocketBind{Allow|Deny} fragment parser 2021-04-26 16:21:59 -07:00
Julia Kartseva
a8e5eb1788 core: add socket-bind cgroup mask harness
Standard cgroup harness for bpf feature.
2021-04-26 16:21:59 -07:00
Julia Kartseva
91ce91c76c core, bpf: add socket-bind feature to unit
Add supported and install unit interface for socket-bind feature.

supported verifies that
- unified cgroup hierarchy (cgroup v2) is used
- BPF_FRAMEWORK (libbpf + clang + llvm + bpftool) was available in
compile time
- kernel supports BPF_PROG_TYPE_CGROUP_SOCK_ADDR
- bpf programs can be loaded into kernel
- bpf link can be used

install:
- load bpf_object from bpf skeleton
- resize rules map to fit socket_bind_allow and socket_bind deny rules
from cgroup context
- populate cgroup-bpf maps with rules
- get bpf programs from bpf skeleton
- attach programs to unit cgroup using bpf link
- save bpf link in the unit
2021-04-26 16:21:59 -07:00
Julia Kartseva
b18e9fc167 cgroup: add socket-bind to cgroup context 2021-04-26 16:21:59 -07:00
Julia Kartseva
43b3f0fb00 shared, bpf: add bpf link helpers
add can_link_bpf_program and bpf_link_free helpers.
2021-04-26 16:21:59 -07:00
Julia Kartseva
09fc220c52 meson, bpf: add build rule for socket-bind program 2021-04-26 16:21:59 -07:00
Julia Kartseva
7d861e1263 meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.

For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.

If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.

libbpf dependency is dynamic followed by the common pattern in systemd.

meson, bpf: add build rule for socket_bind program
2021-04-26 16:20:58 -07:00
Julia Kartseva
cf4f9a57f2 bpf: add build script for bpf programs
Add a build script to compile bpf source code. A program in restricted
C is compiled into an object file. Object file is converted to BPF
skeleton [0] header file.
If build with custom meson build rule, the target header will reside in
build/ directory (not in source tree), e.g the path for socket_bind:
`build/src/core/bpf/socket_bind/socket-bind.skel.h`

Script runs the phases:
* clang to generate *.o from restricted C
* llvm-strip to remove useless DWARF info
* bpf skeleton generation with bpftool
These phases are logged to stderr for debug purposes.

To include BTF debug information, -g option is passed to clang.

[0] https://lwn.net/Articles/806911/
2021-04-26 16:07:41 -07:00
Julia Kartseva
58a33faf80 bpf: add socket-bind BPF program code sources
Introduce BPF program compiled from BPF source code in
restricted C - socket-bind.
It addresses feature request [0].

The goal is to allow systemd services to bind(2) only to a predefined set
of ports. This prevents assigning socket address with unallowed port
to a socket and creating servers listening on that port.

This compliments firewalling feature presenting in systemd:
whereas cgroup/{egress|ingress} hooks act on packets, this doesn't
protect from untrusted service or payload hijacking an important port.

While ports in 0-1023 range are restricted to root only, 1024-65535
range is not protected by any mean.

Performance is another aspect of socket_bind feature since per-packet
cost can be eliminated for some port-based filtering policies.

The feature is implemented with cgroup/bind{4|6} hooks [1].
In contrast to the present systemd approach using raw bpf instructions,
this program is compiled from sources. Stretch goal is to
make bpf ecosystem in systemd more friendly for developer and to clear
path for more BPF programs.

[0] https://github.com/systemd/systemd/pull/13496#issuecomment-570573085
[1] https://www.spinics.net/lists/netdev/msg489054.html
2021-04-26 16:07:41 -07:00
Zbigniew Jędrzejewski-Szmek
ea1036e253
Merge pull request #19416 from mrc0mmand/test-id-detection
test: "detect" the test number automagically
2021-04-26 23:03:13 +02:00
Frantisek Sumsal
9abef4b1b4 test: reorganize the TEST-52 a bit 2021-04-26 19:24:47 +02:00
Frantisek Sumsal
6695c41c31 test: add a couple of hooks for the check_result_*() functions
So we don't have to duplicate the whole functions if we need to inject
some test-specific checks.
2021-04-26 19:24:41 +02:00
Frantisek Sumsal
c4cd6205e0 test: "detect" the test number automagically
Specifying the test number manually is tedious and prone to errors (as
recently proven). Since we have all the necessary data to work out the
test number, let's do it automagically.
2021-04-26 19:20:18 +02:00
Frantisek Sumsal
732a487fad
Merge pull request #19383 from keszybz/test58-fixes
Fixes for TEST-58-REPART and ExecStart deserialization logic
2021-04-26 19:16:44 +02:00
Zbigniew Jędrzejewski-Szmek
35243b7736 test-unit-serialize: add a very basic test that command deserialization works
We should test both serialization and deserialization works properly.
But the serialization/deserialization code is deeply entwined with the
manager state, and I think quite a bit of refactoring will be required before
this is possible. But let's at least add this simple test for now.
2021-04-26 16:15:26 +02:00
Zbigniew Jędrzejewski-Szmek
2b4d791e41
Merge pull request #19286 from yuwata/network-dhcp-routes-to-dns-19077
network: dhcp4: set gateway for route to dns server if it is not in the same network
2021-04-26 15:10:41 +02:00
Yu Watanabe
0e27527170 network: update comment and log message
After 4b30f2e135, reading stable_secret
sysctl property fails with -ENOMEM, instead of -EIO.
This is due to read_full_virtual_file() uses read() as the backend while
read_one_line_file() uses fgetc(). And each functions return different
error on fails.

Anyway, the failure is harmless here. So, the log message and comment is
updated.

Closes one of the issues in #19410.
2021-04-26 10:08:41 +01:00
Luca Boccassi
bb35478bf9
Merge pull request #19421 from yuwata/fix-typo
core, network: Fix typo
2021-04-26 10:08:07 +01:00
Yu Watanabe
25054e1bfb network: add missing sections
Follow-up for 4e26a5baa0.

Fixes one of issues in #19410.
2021-04-26 10:07:52 +02:00
Yu Watanabe
8170992a79 core/service: fix typo
Follow-up for bbe19f6884.
2021-04-26 09:20:30 +09:00
Yu Watanabe
cead8ed66e network: fix typo
Follow-up for 4b409e855b.
2021-04-26 09:19:41 +09:00
Lennart Poettering
be8fc0ef2e
Merge pull request #19411 from poettering/homectl-fixes
homectl password caching fixes
2021-04-24 09:17:38 +02:00
Lennart Poettering
57bb9bcba5 homectl: pick up cached/credential store/env var passwords *before* issuing first request
Previously, we'd generally attempt the operation first, without any
passwords, and only query for a password if that operation then fails
and asks for one. This is done to improve compatibility with
password-less authentication schemes, such as security tokens and
similar.

This patch modifies this slightly: if a password can be acquired cheaply
via the keyring password cache, the $CREDENTIALS_PATH credential store,
or the $PASSWORD/$PIN environment variables, acquire it *before* issuing
the first requested.

This should save us a pointless roundtrip, and should never hurt.
2021-04-23 23:22:37 +02:00