Commit Graph
8398 Commits
Author SHA1 Message Date
Lennart Poettering e516c4d286 machine-id-setup: inform supervisor about chosen machine ID
Similar as the previous commit, it's useful for a supervisor to know
what machine ID we settlted on, in particular as various other things
are deterministically derived from it, for example MAC addresses and
such.
2024-03-14 17:23:02 +01:00
Lennart Poettering 2f3b55c4f1 hostname-setup: send chosen hostname to supervisor via sd_notify()
once we decided on a hostname, let's tell the supervisor about it. This
is useful for example in order to recognize the system via mDNS/LLMNR or
in a DHCP lease.
2024-03-14 17:22:58 +01:00
Lennart Poettering 5a515940e9 hostname-setup: various modernizations 2024-03-14 17:22:54 +01:00
Yu Watanabe 6b67cf808a json: introduce json_dispatch_int8() and json_dispatch_uint8() 2024-03-14 23:56:44 +08:00
Lennart Poettering 837eda0522 Merge pull request #31770 from poettering/linkat-replace
introduce linkat_replace() helper, and port various things over to it
2024-03-14 11:03:59 +01:00
Yu Watanabe af02814a85 ptyfwd: fix typo
Follow-up for d0aa368c85.
2024-03-14 17:40:26 +09:00
Lennart Poettering 5655e5c955 creds-util: port make_credential_host_secret() over to link_tmpfile_at()
Let's simplify things by just reusing the primitives we already have.
2024-03-14 09:22:09 +01:00
Mike Yuan 1ea275f119 core/cgroup: introduce MemoryZSwapWriteback setting
Added in
https://github.com/torvalds/linux/commit/501a06fe8e4c185bbda371b8cedbdf1b23a633d8
2024-03-13 23:36:25 +00:00
Yu Watanabe cac8e820d6 network/varlink: return StorageReadOnly error
Addresses https://github.com/systemd/systemd/pull/30021#discussion_r1521595855.
2024-03-13 21:49:12 +09:00
Lennart Poettering 91180a1eec polkit: add another flag that controls how to treat the PK absent case
Typically if PK is not present we want to treat this as "denied". But
sometimes it makes sense to treat this case as "allowed".

In particular the combination POLKIT_ALWAYS_QUERY and
POLKIT_DEFAULT_ALLOW makes a lot of sense: it means we can enable PK
logic for actions where we so far bypassed the checks for root. With the
new combination we can have a default policy of allowing some operation
but still provide an effective hook to disable it.

Also add some debug logging about PK operations and results as they are ongoing.
2024-03-13 10:43:44 +01:00
Lennart Poettering f5a12ceaed polkit: add new POLKIT_ALWAYS_QUERY flag
When this flag is set we'll disable the local shortcut that skips polkit
checks for clients that are privileged, and assumes they are
authenticated.

Or in other words: if this flag is set, we'll query PK not matter what,
regardless if it's root we talk about or any other user.
2024-03-13 10:42:27 +01:00
Lennart Poettering b9632ec42f polkit: allow checking if we already acquired some action
This adds a new helper that basically just wraps
async_polkit_query_have_action() and allows calling this without
actually triggering a PK authentication operation: it just checks if we
aleady have acquired an action or not.
2024-03-13 10:42:13 +01:00
SidhuRupinder 7d08e23558 local-addresses: call 'assert_not_reached' where appropriate (#31728)
Added code for calling the 'assert_not_reached' function as the value of the 'family' parameter must be either 'AF_INET' or 'AF_INET6'.
2024-03-13 13:16:46 +08:00
Mike Yuan a793133963 Merge pull request #31727 from YHNdnzj/homed-followup
data-fd-util: some cleanups
2024-03-13 13:10:34 +08:00
Lars Ellenberg b8e25bff38 fs-utils: new wrapper fd_reopen_propagate_append_and_position()
We may want to propagate O_APPEND, or (try to) keep the current file position,
even if we use fd_reopen() to re-initialize (and "unshare") other file
description status.

For now, used only with --pty to keep/propagate O_APPEND (and/or) position
if set on stdin/stdout.

If we re-open stdout and "drop" the O_APPEND,
we get rather "unexpected" behavior,
for example with repeated "systemd-run --pty >> some-log".

If someone carefully pre-positioned the passed in original file descriptors,
we avoid surprises if we do not reset file postition to zero.

fcntl F_GETFL first, and propagate O_APPEND if present in the existing flags.

Then use lseek to propagate the file position.
2024-03-12 19:01:00 +01:00
Mike Yuan 0870fc2404 data-fd-util: accept size == SIZE_MAX and translate that to strlen
Like what we already do at other places
2024-03-12 16:42:48 +08:00
Mike Yuan 7799e7d9f0 data-fd-util: some modernization 2024-03-12 16:42:48 +08:00
Mike Yuan faadc90c33 fileio,data-fd-util: use U64_* more 2024-03-12 16:42:48 +08:00
Mike Yuan 5d789ba5a6 Merge pull request #31671 from AdrianVovk/homework-cifs-credentials
homework-cifs: Pass password via fd
2024-03-12 15:40:43 +08:00
Mike Yuan 18eebde33a Merge pull request #31713 from YHNdnzj/pidref-equal
pidref: use fd_inode_same to compare pidfds
2024-03-12 14:15:36 +08:00
Yu Watanabe 06baee4ea3 Merge pull request #30021 from yuwata/dhcp-client-id-cleanups
dhcp-server: save bound leases to persistent storage, and load it on start
2024-03-12 13:40:09 +09:00
Luca Boccassi b6fb31be45 Merge pull request #31721 from aafeijoo-suse/service-util-help-fix
shared/service-util: actually use the `bus_introspect` argument in `help()`
2024-03-11 18:13:57 +00:00
Yu Watanabe f90eb08627 network/varlink: introduce io.systemd.Network.SetPersistentStorage method
And make the networkd use state directory.

Currently, the state directory and the method are not used, but will be used later.
2024-03-12 01:57:11 +09:00
Adrian Vovk 58d061b5aa data-fd-util: Fixup header
inttypes.h doesn't define size_t
2024-03-11 12:24:30 -04:00
Mike Yuan 0cdb8df620 stat-util: introduce fd_inode_same 2024-03-11 22:53:08 +08:00
Antonio Alvarez Feijoo 4313b99136 shared/service-util: actually use the bus_introspect argument in help()
If `bus_introspect` is false, do not print the `--bus-introspect=PATH` option.

Also, modernize help output.
2024-03-11 13:56:30 +01:00
Luca Boccassi c7edd9f13d Merge pull request #31711 from YHNdnzj/gpt-auto-has-node
gpt-auto: ignore fstab_has_node failure
2024-03-11 12:40:22 +00:00
Antonio Alvarez Feijoo 65064e2ff0 tree-wide: drop custom formatting for print() help messages
Follow-up for bc556335b1
2024-03-11 13:34:34 +01:00
Lennart Poettering 29556b75d8 polkit: turn "interactive" flag to polkit APIs into a proper flags field (#31715)
This adds for both the D-Bus and the Varlink flavours of our polkit
client api a flags parameter. And then folds the "bool interactive" flag
that the D-Bus version so far had, into a flag, and also adds support
for it in the Varlink API.

Since this means the Varlink API gained another parameter, let's do what
we already did for the D-Bus API and add a _full() version of the API
that has the flags and the good_uid parameter, and one without both.
2024-03-11 11:57:45 +00:00
Lennart Poettering efb4858f11 polkit: trivial simplification 2024-03-11 10:44:53 +00:00
Mike Yuan 18f9ecd40c fstab-util: remove unreachable return 2024-03-11 15:27:04 +08:00
Thomas Blume fc5c6eccb4 units: make templates for quotaon and systemd-quotacheck service 2024-03-09 19:32:09 +00:00
Emanuele Giuseppe Esposito 706ca67d30 bootctl: additional fixes for local/global UKI PE addons
Fix various memory leaks and names used in
https://github.com/systemd/systemd/pull/28761.
2024-03-08 16:38:59 +00:00
Zbigniew Jędrzejewski-Szmek ec596fe34e Merge pull request #30480 from keszybz/kernel-install-more-paths
Read kernel-install config from /run/kernel too
2024-03-08 08:25:07 +01:00
Zbigniew Jędrzejewski-Szmek b7d62bdbd0 shared/conf-parser: add two more annotations 2024-03-07 19:14:36 +01:00
Zbigniew Jędrzejewski-Szmek 6378f257e7 various: use new config loader instead of config_parse_config_file()
This means the main config file is loaded also from /run and /usr.

We should load the main config file from all the places where we load drop-ins.

I realize I had a giant blind spot: I always assumed that we load config files
from /etc, /run, /usr/local/lib, /usr/lib. But it turns out that we only used
those paths for drop-ins. For the main config file, we only looked in /etc. The
docs actually partially described this behaviour, i.e. most SYNOPSIS sections
and some parts of the text, but not others.

This is strange, because 6495361c7d was completely
bogus with the behaviour before this patch. We had a huge discussion before it
was merged, and clearly nobody noticed this. Similarly, in the previous version
of the current pull request, we had a long discussion about the appropriate
order of directories, and apparently nobody noticed that there was no order,
because only looked in one directory. So the blind spot seems to have been
shared.

Also, systemd-analyze cat-config behaved incorrectly, i.e. its behaviour matches
the new behaviour.

Possibly, in the future it'll make it easier to add support for --root.
2024-03-07 19:14:36 +01:00
Zbigniew Jędrzejewski-Szmek e7e52ff9b6 shared/conf-parser: add function which implements the standard config file set
Also allow config_parse_many() to be called for config files without
sections. The test uses such a file.
2024-03-07 19:14:36 +01:00
Zbigniew Jędrzejewski-Szmek d8a91c6b9f shared/conf-parser: use chase() in config_parse_many_files()
The function was partially implementing chroot lookups. It would be given
file names that were prefixed with the chroot, so it would mostly work.
But if any of those files were symlinks, fopen() would do the wrong thing.

Also we don't need locking.

So give 'root' as the argument and use chase_and_fopen_unlocked() to get
proper chroot-aware lookups.

The only place where config_parse_many() is called with root is is repart.c.
So this is a follow-up for e594a3b154 and
34f2fd5096.
2024-03-07 18:49:44 +01:00
Zbigniew Jędrzejewski-Szmek 6812498cb2 shared/pretty-print: rename output parameters 2024-03-07 18:49:44 +01:00
Zbigniew Jędrzejewski-Szmek e5abff372d shared/conf-parser: collapse pkgdir and conf_file args into one
This essentially reverts 5656cdfeea. I find it
much easier to understand what is going on when the
path-relative-to-the-search-path is passed in full, instead of being constructed
from two parts, with one of the parts being implicit in some places.

Also, we call 'systemd-analyze cat-config <path>' with <path> with the same
meaning, so this makes the internal and external APIs more consistent.
2024-03-07 18:49:44 +01:00
Zbigniew Jędrzejewski-Szmek 76d75d8b7b constants: drop duplicated CONF_PATHS defines
Follow-up for b0d3095fd6.
2024-03-07 18:47:50 +01:00
Mike Yuan dc35af47df bus-unit-util: trivial follow-up for UnitFreezer
Follow-up for 7483708131

Make sure that function param names match between
source and header. Also, place UnitFreezer params
in front.
2024-03-08 01:10:09 +08:00
Mike Yuan 5ba6321d86 bus-unit-util: define FREEZE_BUS_CALL_TIMEOUT locally
Follow-up for f274f8bf25

We define *_SLOW_BUS_CALL_TIMEOUT in each component's
own file too. This one is no different and doesn't need
to be in constants.h IMO.
2024-03-08 01:09:01 +08:00
Luca Boccassi 5e418fe32a Merge pull request #31590 from YHNdnzj/install-cleanup
shared/install: several cleanups
2024-03-07 11:28:04 +00:00
Mike Yuan d41f08bd2a core,install: generalize install error handling 2024-03-07 02:05:15 +08:00
Mike Yuan b412274fd0 shared/install: use FOREACH_ARRAY at one more place 2024-03-07 02:02:00 +08:00
Mike Yuan b2751cf039 shared/install: use RET_GATHER more 2024-03-07 02:02:00 +08:00
Mike Yuan 7dfc71399d path-lookup: rename lookup_paths_free -> _done
This is stack-allocated, so update to match our usual rules.
2024-03-07 02:01:57 +08:00
Lennart Poettering cf1c8cdb87 resolved: expose raw RR resolver via Varlink too
Now that we have an address, hostname, and service resolve, at the last
kind of resovler we expose over D-Bus also to Varlink.
2024-03-06 19:00:53 +01:00
Lennart Poettering 0fe9c5da02 resolved: move ResourceKey/ResourceRecord varlink types to generic Resolve interface
Let's define this in the generic interface and then import it into the
Monitor interface too.

This is preparation for adding an interface to resolve arbitrary RRs via
Varlink, which means we want the type in both interfaces.
2024-03-06 19:00:53 +01:00