1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-18 06:03:42 +03:00

55103 Commits

Author SHA1 Message Date
Yu Watanabe
38ef464e41 network/wireguard: search valid address of the endpoint from all struct addrinfo entries 2021-12-02 08:39:37 +09:00
Yu Watanabe
8bf7e3b61c network/wireguard: cleanups for resolving endpoints
This makes
- drop peers_with_unresolved_endpoint and peers_with_failed_endpoint,
- drop destroy handler for sd_resolve_query, and manage each query by peer,
- add random fluctuation to the timeout for retry handler,
- retry timer event source is now managed by peer,
- use sd_event_source_disable_unref().
2021-12-02 08:39:32 +09:00
Yu Watanabe
4a897d29f1 network/wireguard: do not resolve Endpoint= if an IP address is specified
Also verify the domain name and port.
2021-12-02 08:36:22 +09:00
Yu Watanabe
4c9bb70854 parse-util: refuse leading white space in port number
When parse_ip_port() is directly used in a conf parser, then that's
fine, as the rvalue is already truncated.

When parse_ip_port() is used when e.g. parsing IP address with port,
then we should really refuse white space after colon.
2021-12-02 08:36:22 +09:00
Yu Watanabe
bf1e65a4fd
Merge pull request #21585 from yuwata/network-radv-uplink-interface-auto-with-dhcp6-pd
network: cleanups for uplink interface handling for RADV and DHCP6-PD
2021-12-02 08:16:23 +09:00
Yu Watanabe
9db6a416dd
Merge pull request #21583 from bluca/bpf_assert
cgroup: don't emit BPF firewall warning when manager is in test mode
2021-12-02 07:47:17 +09:00
Luca Boccassi
6b88743c22
Merge pull request #21591 from yuwata/core-bpf-firewall-unsupported-reason
core/bpf-firewall: make bpf_firewall_supported() always set unsupport…
2021-12-01 21:20:30 +00:00
Luca Boccassi
541b127170 elf-util: do not ignore prctl() errors
We want to avoid loops, so fail and return if we can't disable
core dumping

CID#1467004
2021-12-01 16:00:26 +00:00
Xiaotian Wu
9fd3bf7733 syscalls: run ninja update-syscall-tables 2021-12-01 23:53:17 +08:00
Yu Watanabe
a783421498 tree-wide: fix typo 2021-12-02 00:51:02 +09:00
Xiaotian Wu
89f60c217c syscalls: add LoongArch 64bit syscalls 2021-12-01 23:48:30 +08:00
KennthStailey
2ed6297f71 Fixed typo
`ip set dev eth0` should be `ip link set dev eth0`
2021-12-02 00:02:37 +09:00
Yu Watanabe
8751bb6f5e core/bpf-firewall: make bpf_firewall_supported() always set unsupported reason when BPF_FIREWALL_UNSUPPORTED is returned
Otherwise, log_unit_full_errno() in emit_bpf_firewall_warning() will
trigger an assertion.
2021-12-01 21:39:21 +09:00
Yu Watanabe
ad13559e8d core/cgroup: propagate errors on detecting supported features 2021-12-01 21:39:21 +09:00
Yu Watanabe
3de3fd3d16 core/restrict-netif: make restrict_network_interfaces_supported() return negative errno only when critical error
Other errors are handled as the functionality is not supported.

This also drops unnecessary SYNTHETIC_ERRNO().
2021-12-01 21:38:54 +09:00
Luca Boccassi
cb94244406 test: run commands with debug level logs in TEST-65-ANALYZE 2021-12-01 12:06:36 +00:00
Luca Boccassi
a42232a18c cgroup: don't emit BPF firewall warning when manager is in test mode
Support for BPF might not have been checked, since it's not necessary
in test mode (eg: running offline analysis of units). This causes an
assert:

Assertion '(_error) != 0' failed at src/core/bpf-firewall.c:914, function emit_bpf_firewall_warning(). Aborting.

Export SYSTEMD_LOG_LEVEl=debug in TEST-65-ANALYZE is enough to trigger
this assert while doing an offline analysis of a unit that has some
firewall/network restrictions set.

Skip the warning if the manager is in test mode.
2021-12-01 12:06:36 +00:00
Zbigniew Jędrzejewski-Szmek
684e0a5605 ci: temporarily set -Wno-deprecated-declarations in Packit
to suppress OpenSSL 3.0 deprecation warnings (until a proper solution is
deployed): RSA_free, EC_KEY_free, RSA_set0_key, RSA_size, EVP_PKEY_assign,
EC_KEY_set_group, and others are deprecated.
2021-12-01 12:36:57 +01:00
Zbigniew Jędrzejewski-Szmek
6e7323137a resolved: do not use BN_dup() unnecessarilly
Suggested in https://github.com/systemd/systemd/pull/21170#discussion_r738696794
2021-12-01 12:36:57 +01:00
Zbigniew Jędrzejewski-Szmek
7e8facb36b port string_hashsum from libgcrypt to openssl^gcrypt
This allows resolved and importd to be built without libgcrypt.

Note that we now say either 'cryptographic library' or 'cryptolib'.

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2021-12-01 12:36:57 +01:00
Kevin Kuehler
fc169a6fb2 basic/openssl-util: Add sha256 hash wrapper 2021-12-01 12:36:57 +01:00
Kevin Kuehler
1736344e9e resolve: Port nsec3 code to openssl^gcrypt
Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2021-12-01 12:36:45 +01:00
Yu Watanabe
6016f1cfbb test-network: re-arrange DHCP6-PD subnet IDs to test searching free subnet ID 2021-12-01 20:35:03 +09:00
Yu Watanabe
6c8d6bdd40 test-network: add testcases for uplink interface detection for RADV with DHCPv6-PD 2021-12-01 20:35:03 +09:00
Yu Watanabe
1a4ca0e2f3 network: dhcp6-pd: exclude all explicitly specified subnet IDs when searching free IDs
When the upstream link gained a lease, then several downstream links may
not appear yet. Previously, the explicitly specified subnet ID for a
downstream link which appears later may be already assigned to an
interface which does not request specific subnet ID.

To avoid such situation, this makes all specified IDs are excluded when
searching free IDs.

As a side effect, we can avoid the second call of
dhcp6_pd_distribute_prefix().
2021-12-01 20:35:03 +09:00
Yu Watanabe
a74229c58e network: dhcp6-pd: introduce dhcp6_pd_is_uplink()
This also merges dhcp6_pd_resolve_uplink() with dhcp6_pd_find_uplink()
2021-12-01 20:35:03 +09:00
Yu Watanabe
926fc8ee63 network: dhcp6: make UplinkInterface=:self take effect only when DHCPv6PrefixDelegation= is enabled 2021-12-01 20:35:03 +09:00
Yu Watanabe
f6032ff3e0 network: radv: use the uplink interface used in DHCPv6-PD 2021-12-01 20:35:03 +09:00
Arvid E. Picciani
312dac2869 docs: document that systemd closes console during normal runtime
fixes #21451

Signed-off-by: Arvid E. Picciani <aep@exys.org>
2021-12-01 10:16:15 +01:00
Luca Boccassi
81513b382b core: add Condition[Memory/CPU/IO]Pressure
By default checks PSI on /proc/pressure, and causes a unit to be skipped
if the threshold is above the given configuration for the avg300
measurement.
Also allow to pass a custom timespan, and a particular slice unit to
check under.

Fixes #20139
2021-12-01 09:53:18 +01:00
Yu Watanabe
99f8a6d7f5
Merge pull request #21581 from keszybz/really-random-fixlets
Really random fixlets
2021-12-01 12:54:00 +09:00
Yu Watanabe
361bf5fb77
Merge pull request #21564 from yuwata/errno-eagain-eintr
tree-wide: introduce ERRNO_IS_TRANSIENT() and use it
2021-12-01 12:52:27 +09:00
Yu Watanabe
db58f6a933
Merge pull request #21536 from medhefgo/test
test: Introduce TEST_RET macro
2021-12-01 12:52:10 +09:00
Yu Watanabe
c8cbe8e0eb
Merge pull request #21288 from loongarch64/la64/main
Add support for the LoongArch architecture.
2021-12-01 12:51:48 +09:00
Luca Boccassi
c7b5d3b5e4
Merge pull request #21553 from yuwata/network-wireguard-add-routes-to-allowed-ips
network: wireguard: add routes to AllowedIPs=
2021-11-30 23:30:31 +00:00
Luca Boccassi
917e655457 analyze: add inspect-elf verb to parse package metadata
Parses and prints package metadata from executables, libraries and core files

$ systemd-analyze inspect-elf /tmp/core ../fsverity-utils/fsverityb /bin/bash --json=off --no-pager
__________________________
           path: /tmp/core
        elfType: coredump
elfArchitecture: AMD x86-64

    module name: /tmp/crash
           type: deb
           name: hello
        version: 1.0
   architecture: amd64
             os: debian
      osVersion: 11
        buildId: b33541096a09c29a0ba4ec5c69364a2711b7c269

    module name: /usr/lib/x86_64-linux-gnu/libc-2.31.so
           type: deb
           name: hello
        version: 1.0
   architecture: amd64
             os: debian
      osVersion: 11
        buildId: 54eef5ce96cf37cb175b0d93186836ca1caf470c

    module name: /usr/lib/x86_64-linux-gnu/ld-2.31.so
           type: deb
           name: hello
        version: 1.0
   architecture: amd64
             os: debian
      osVersion: 11
        buildId: 32438eb3b034da54caf58c7a65446639f7cfe274
__________________________________________________________________
           path: /home/luca/git/systemd/../fsverity-utils/fsverity
        elfType: executable
elfArchitecture: AMD x86-64

           type: deb
           name: fsverity-utils
        version: 1.3-1
   architecture: amd64
             os: debian
   debugInfoUrl: https://debuginfod.debian.net
        buildId: 05b899e6ee0d3653e20458719b202ed3ca8d566f
_________________________
           path: /bin/bash
        elfType: executable
elfArchitecture: AMD x86-64

        buildId: 4fef260f60e257d2dbd4126bf8add83837aea190
$
$ systemd-analyze inspect-elf /tmp/core ../fsverity-utils/fsverity /bin/bash /tmp/core.test-condition.1000.f9b9a84a9fd1482c9702d6afa6f6934b.37640.1637083078000000 --json=pretty --no-pager
{
	"elfType" : "coredump",
	"elfArchitecture" : "AMD x86-64",
	"/home/bluca/git/fsverity-utils/fsverity" : {
		"type" : "deb",
		"name" : "fsverity-utils",
		"version" : "1.3-1",
		"buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee"
	},
	"/home/bluca/git/fsverity-utils/libfsverity.so.0" : {
		"type" : "deb",
		"name" : "fsverity-utils",
		"version" : "1.3-1",
		"buildId" : "b5e428254abf14237b0ae70ed85fffbb98a78f88"
	}
}
{
	"elfType" : "executable",
	"elfArchitecture" : "AMD x86-64",
	"/home/bluca/git/systemd/../fsverity-utils/fsverity" : {
		"type" : "deb",
		"name" : "fsverity-utils",
		"version" : "1.3-1",
		"buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee"
	}
}
{
	"elfType" : "executable",
	"elfArchitecture" : "AMD x86-64",
	"/bin/bash" : {
		"buildId" : "3313b4cb119dcce16927a9b6cc61dcd97dfc4d59"
	}
}
{
	"elfType" : "coredump",
	"elfArchitecture" : "AMD x86-64"
}
2021-11-30 23:14:07 +00:00
Luca Boccassi
d48c2721b6 elf-util: add function to parse metadata out of ELF objects
Parse the packaging metadata from an ELF object, if any, and
print a pretty table following the spec defined at:
https://systemd.io/COREDUMP_PACKAGE_METADATA/
2021-11-30 23:14:07 +00:00
Kevin Kuehler
1cd7a2c172 resolve: Port dnskey verification by ds to openssl^gcrypt
Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2021-11-30 23:00:21 +01:00
Kevin Kuehler
0351cbb9e4 resolve: Port dnssec verify from gcrypt to openssl^gcrypt
Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2021-11-30 23:00:21 +01:00
Zbigniew Jędrzejewski-Szmek
667dac6ed6 resolved: split out function to hash signature
dnssec_verify_rrset() is just too long.
2021-11-30 23:00:21 +01:00
Zbigniew Jędrzejewski-Szmek
cc1ecbaaf3 resolved: split out function to generate signature
dnssec_verify_rrset() is just too long.
2021-11-30 23:00:21 +01:00
Kevin Kuehler
bf4b1adf6f resolve: Add coverage for dnssec ecdsa (rfc6605) 2021-11-30 23:00:21 +01:00
Zbigniew Jędrzejewski-Szmek
6214d42bd2 import: port importd from libgcrypt to openssl^gcrypt
This is heavily based on Kevin Kuehler's work, but the logic is also
significantly changed: instead of a straighforward port to openssl, both
versions of the code are kept, and at compile time we pick one or the other.

The code is purposefully kept "dumb" — the idea is that the libgcrypt codepaths
are only temporary and will be removed after everybody upgrades to openssl 3.
Thus, a separate abstraction layer is not introduced. Instead, very simple
ifdefs are used to select one or the other. If we added an abstraction layer,
we'd have to remove it again afterwards, and it don't think it makes sense to
do that for a temporary solution.

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>

# Conflicts:
#	meson.build
2021-11-30 23:00:21 +01:00
Zbigniew Jędrzejewski-Szmek
57633d2376 meson: add config setting to select between openssl and gcrypt
This is not pretty, but it is supposed to be only a temporary measure.
2021-11-30 23:00:21 +01:00
Kevin Kuehler
ade99252e2 repart: port to our home-grown hmac_sha256
This reduces dependencies. The speed of the code here is uimportant, because we
hash only a tiny amount of input data.

Debian and Ubuntu currently build without repart, see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976959
> repart requires openssl and so far I tried to avoid linking against
> both gnutls and openssl.

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2021-11-30 23:00:21 +01:00
Zbigniew Jędrzejewski-Szmek
160dadc035 tmpfiles: 'st' may have been used uninitialized 2021-11-30 22:57:31 +01:00
Zbigniew Jędrzejewski-Szmek
baf60a80b5 man: prettify line number handling in python example
This way the 'line_number' variable contains the actual line number as we think
of it, instead of adjusting it on output.
2021-11-30 22:56:51 +01:00
Zbigniew Jędrzejewski-Szmek
75c293f37d test-sizeof: show stack and heap randomization
It's useful to reassure yourself those those things actually work ;)
2021-11-30 22:55:15 +01:00
Zbigniew Jędrzejewski-Szmek
4248b9f6a5
Merge pull request #21580 from bluca/core_fork
Switch coredump ELF parsing to fork+dlopen
2021-11-30 21:49:53 +01:00
Yu Watanabe
6387cac3f3 test-network: add tests for creating routes to wireguard's AllowedIPs= 2021-12-01 04:00:16 +09:00