Commit Graph
8981 Commits
Author SHA1 Message Date
Lukas Nykryn da32cac8a0 core: warn if a generator is world-writable
... because that is obviously a security risk.
2024-10-07 11:02:37 +09:00
Mike Yuan feae34d64e path-lookup: move find_portable_profile() to portable-util 2024-10-06 19:27:11 +02:00
Mike Yuan 1a7627f4e1 unit-file: make unit_type_may_{alias_template} static inline 2024-10-06 19:27:11 +02:00
Mike Yuan 2bf5b262b5 basic/unit-file: move to shared/
Preparation for later commits, where path-lookup would be
moved into libsystemd.

Note that it currently includes sd-id128.h, hence shared/
seems more appropriate anyway.
2024-10-06 19:27:00 +02:00
Mike Yuan 3f8999a76e fs-util: rename laccess to access_nofollow
In order to distinguish it from libc function naming.
2024-10-05 01:30:43 +02:00
Mike Yuan 7c1dd9e288 various: correct laccess() error check
laccess is our own macro that uses RET_NERRNO.
2024-10-04 21:26:04 +02:00
Luca Boccassi ac799d64bd Merge pull request #34600 from poettering/varlink-idl-add-flags-everywhere
sd-varlink: maintain "more" flag support in the IDL structures
2024-10-03 21:02:22 +01:00
Daan De Meyer f02f8b3ca7 Merge pull request #34546 from ikruglov/ikruglov/refactor-GetMachineAddresses
machine: generalise logic of GetMachineAddresses/GetOsRelease to later use it in corresponding varlink interfaces
2024-10-02 10:24:59 +02:00
Lennart Poettering da01f7c246 sd-varlink: mark functions that can take 'more' flag in IDL structures with an explicit flag
Let's mark functions that accept the 'more' flag explicitly for that,
and validate for this explicitly.

This is preparation for
https://github.com/varlink/varlink.github.io/issues/26, if we get that
one day. Let's make sure that from day #1 we have this info available
even if we don't generate this in the IDL for now.

Also enables the two flags for all interfaces we export that use the
logic.
2024-10-02 09:22:52 +02:00
Lennart Poettering bd4beaa2eb tree-wide: always do dlopen() with RTLD_NOW + RTLD_NODELETE
Let's systematically use RTL_NOW|RLTD_NODELETE as flags passed to
dlopen(), across our codebase.

Various distros build with "-z now" anyway, hence it's weird to specify
RTLD_LAZY trying to override that (which it doesn't). Hence, let's
follow suit, and just do what everybody else does.

Also set RTLD_NODELETE, which is apparently what distros will probably
end up implying sooner or later anyway. Given that for pretty much all
our dlopen() calls we never call dlclose() anyway, let's just set this
everywhere too, to make things systematic.

This way, the flags we use by default match what distros such as fedora
do, there are no surprises, and read-only relocations can be a thing.

Fixes: #34537
2024-10-02 07:13:21 +02:00
Ivan Kruglov f1daf9fb74 machine: generalise logic GetMachineAddresses to later use it in varlink interface 2024-10-01 19:00:25 +02:00
Mike Yuan a48c1699eb Merge pull request #34564 from YHNdnzj/systemctl-status-job-id
systemctl: also show job id in status output
2024-09-30 17:39:19 +02:00
Yu Watanabe 82f2c33db5 tpm2-util: show loaded libraries in 'systemd-analyze has-tpm2'
After 3b16e9f419, even the libraries are
documented in the man page, it is useful to mention which libraries are
checked in the command output.

Of course, the dependencies are kind of implementation detail, and may
be changed in the future version, but that's especially why I think
showing the library deps in the output is useful.

systemd-analyze is a debugging tool, and already shows many internal
states. I think there is nothing to prevent from showing the deps.

Prompted by #34477.
2024-09-30 15:40:14 +02:00
Zbigniew Jędrzejewski-Szmek d713c131a5 Merge pull request #34572 from keszybz/fix-printing-of-RootImageOptions
Fix printing of RootImageOptions
2024-09-28 17:23:44 +02:00
Zbigniew Jędrzejewski-Szmek 8dc40c25a4 shared: adjust whitespace and formatting 2024-09-27 20:19:58 +02:00
Mickaël Salaün e996663475 seccomp-util: include @sandbox in @default
Every services and containers should be able to protect their users and
limit the impact of security bugs thanks to the security syscalls
provided by seccomp and Landlock.  The goal of these syscalls is to
improve security with additional restrictions.  They are designed to be
safely used by unprivileged (and then potentially malicious) users.

Remove the now-redundant "seccomp" entry for nspawn.
2024-09-27 12:37:37 +02:00
Mike Yuan cdf684fc00 shared/bus-map-properties: move bus_map_job_id() from wait-for-units 2024-09-26 17:59:00 +02:00
Yu Watanabe bfa834f138 Merge pull request #34511 from YHNdnzj/strv-extend-strv-consume
basic/strv: introduce strv_extend_strv_consume()
2024-09-21 13:57:02 +09:00
Yu Watanabe f48bc69ca1 Merge pull request #34502 from yuwata/strv_find_closest
strv: introduce strv_find_closest()
2024-09-21 13:56:34 +09:00
Mike Yuan a2c8652a2a tree-wide: use strv_extend_strv_consume() where appropriate 2024-09-21 00:53:50 +02:00
Mike Yuan b9aef48837 shared/bus-map-properties: modernize map_basic() and bus_map_strv_sort() 2024-09-20 22:44:35 +02:00
Mike Yuan 175de2c28e basic/macro: move DECIMAL_STR_FMT to shared/tests
This shall never be used outside of test functions.
2024-09-20 22:44:34 +02:00
Daan De Meyer 0121b84e41 Add an extra debug log to dissect_image() 2024-09-21 05:38:20 +09:00
Yu Watanabe 07919a1857 verbs: use strv_find_closest()
This also makes the list of verbs is always shown on failure.
2024-09-21 05:10:47 +09:00
Yu WatanabeandMike Yuan 144fbbac23 seccomp-util: pass negative fds as is to fsync() and friends
Closes #34478.

Co-authored-by: Mike Yuan <me@yhndnzj.com>
2024-09-20 04:30:53 +09:00
Yu Watanabe a3c2a9ee5d Merge pull request #34486 from DaanDeMeyer/test-process-util
test-process-util: Migrate to new assertion macros
2024-09-19 23:28:15 +09:00
Daan De Meyer 062332f3db Merge pull request #34481 from yuwata/has-tpm2
tpm2-util: several cleanups for tpm2_support()
2024-09-19 16:22:24 +02:00
Daan De Meyer bc9a9177b2 Merge pull request #34483 from yuwata/network-conf-parser-neighbor-nexthop
network: several cleanups for conf parsers
2024-09-19 13:59:56 +02:00
Yu Watanabe d5a7f3b7d4 tpm2-util: colorize output of 'systemd-analyze has-tpm2' 2024-09-19 19:14:19 +09:00
Yu Watanabe b094398b0f tpm2-util: update comment
has-tpm2 command is moved to systemd-analyze.

Follow-up for 58e359604f.
2024-09-19 19:08:10 +09:00
Yu Watanabe 1ee6570843 tpm2-util: do not load tpm2 libraries when not interested in the existence of the libraries
For example, 'bootctl status' only interested in if the efi has TPM2
support and a TPM2 driver is loaded. Hence, not necessary to load
libtss2.
2024-09-19 19:06:46 +09:00
Yu Watanabe b7f051c91d tpm2-util: introduce tpm2_is_fully_supported() 2024-09-19 19:04:15 +09:00
Daan De Meyer 1d8a81eb4e Add ASSERT_OK_ZERO_ERRNO() and ASSERT_OK_EQ_ERRNO() 2024-09-19 11:38:47 +02:00
Yu Watanabe 1775654e2c conf-parser: drop unnecessary temporary variable 2024-09-19 03:39:15 +09:00
Yu Watanabe 0ea6d55a4b conf-parser: introduce config_parse_in_addr_data() 2024-09-19 03:38:22 +09:00
Yu Watanabe b962338104 nsresource: make sd_json_dispatch_field table static
This also adds missing error check of sd_json_dispatch().

Follow-up for 54452c7b2a.
2024-09-19 01:34:57 +09:00
Yu Watanabe fae0b00434 creds-util: make sd_json_dispatch_field table static 2024-09-19 01:34:57 +09:00
Yu Watanabe a95ae2d36a conf-parser: use hashmap_ensure_put() at one more place 2024-09-18 03:13:47 +09:00
Yu Watanabe be8e4b1a87 conf-parser: log errors in config_parse_many_files() and friends
Previously, if an file cannot be opened, e.g. due to its permission,
config_parse_many() or so did not log the error even if CONFIG_PARSE_WARN
flag is set. This makes all error paths in these functions are logged,
and the log level is controlled by the flag.

Prompted by #34436.
2024-09-18 03:13:25 +09:00
Yu Watanabe a7afe5a3e7 Merge pull request #34443 from yuwata/network-sysctl-monitor-follow-ups
network/sysctl-monitor: several follow-ups and cleanups
2024-09-17 19:15:12 +09:00
Daan De Meyer b3ebd480d6 Fix generator logging
log_setup() overrides the previously set log target again so we
can't use it in log_setup_generator().

Follow-up for aa976d8788
2024-09-17 15:10:39 +09:00
Yu Watanabe 46718d344f bpf-link: introduce bpf_ring_buffer_free() and friends
Then, replace rb_free() in networkd.

Follow-up for 6d9ef22acd.
2024-09-16 14:36:54 +09:00
Yu Watanabe b5ec8f77e0 Merge pull request #34434 from poettering/bootctl-stub-paths
bootctl: expose new stub path efi vars and related
2024-09-16 10:41:24 +09:00
Lennart Poettering 3e0a3a0259 bootctl: show whether a PE file is an addon in 'booctl kernel-identify' 2024-09-16 10:41:10 +09:00
Lennart Poettering c8d60ae79d efivars: add helper that reads an fs path from an efi var 2024-09-15 19:34:19 +02:00
Lennart Poettering bfcf48b842 bootctl: show stub partition data too in "status" too 2024-09-15 19:33:48 +02:00
Lennart Poettering 1b7ef87fc1 Merge pull request #34347 from poettering/uki-with-many-bootctl
bootctl: multi-profile UKI support
2024-09-15 09:06:58 +02:00
Yu Watanabe d97c672be0 Merge pull request #34405 from poettering/dns-domain-validate-fix
dns-domain: fix validation check for max name
2024-09-15 03:33:12 +09:00
Lennart Poettering 1e1661c5d2 dns-domain: validate dns domain name max size based on unescaped, not escaped size
Otherwise we'll consider various domains invalid that really shouldn't
be considered invalid.

Fixes: #34399
2024-09-13 18:02:54 +02:00
Lennart Poettering dc8ed83892 dns-domain: follow our current variable naming style 2024-09-13 18:00:38 +02:00