Commit Graph
8191 Commits
Author SHA1 Message Date
Rose aa9ff6c28d tree-wide: replace string functions with fundamental functions 2024-01-11 13:36:25 +09:00
David Tardon 5656cdfeea conf-parser: generalize config_parse_config_file() 2024-01-11 13:24:32 +09:00
Luca Boccassi d6b39152a9 Merge pull request #30717 from yuwata/network-ref-unref
network: introduce address_ref() and friends
2024-01-10 19:34:48 +00:00
Luca Boccassi 31056154dd Merge pull request #30811 from yuwata/network-route-metric
network/route-metric: introduce RouteMetric to unify route metric handling
2024-01-10 19:25:52 +00:00
Luca Boccassi dadd7d46d9 Merge pull request #30809 from yuwata/resolve-fix-EDE-handling
resolve: fix EDE handling
2024-01-10 19:21:55 +00:00
Holger Assmann f681046ede watchdog: ensure configured timeout is used instead of USEC_INFINITY
In some rare cases, a watchdog driver might neither be able to change
the watchdog timeout value, nor read it from the hardware at runtime.

With an otherwise functional watchdog setup, this constellation worked
until systemd v249. Since then, systemd ends up ignoring the timeout
defined by the system.conf and rather uses USEC_INFINITY. Consequently,
the watchdog is not pinged anymore and eventually resets the system.

We therefore want to ensure that the system keeps running with the
originally configured timeout.
2024-01-10 19:14:38 +00:00
Lennart Poettering 52e5b950dc pam-util: implement our own pam_prompt() replacement, that doesn't log loudly
pam_prompt() will log very noisely at high error levels if it is called
without a conversation function that works. This is however a frequent
case, given that ssh doesn't provide one. To tone down the misleading
logging a bit, implement our own pam_prompt_graceful() that is just like
pam_prompt(), but reports errors back the caller who then logs (which we
generally do anyway).
2024-01-10 19:06:40 +00:00
Yu Watanabe a068e06da6 resolve: notify DNSSEC failure, EDE code, and EDE message 2024-01-11 02:10:32 +09:00
Yu Watanabe a72cf22d06 resolve: introduce DNSSEC_UPSTREAM_FAILURE
and include EDE code and message in the error messages.

This replaces 9ca133e97a, and implements
originally suggested at
https://github.com/systemd/systemd/pull/30513#discussion_r1433823737
2024-01-11 02:10:32 +09:00
Lennart Poettering f5812f337d Merge pull request #30849 from YHNdnzj/daemon-modernization
Modernize a couple of daemons that use bus_event_loop_with_idle
2024-01-10 09:55:12 +01:00
Mike Yuan 95bcaa4e81 creds-util: make read_credential_strings_many behave the same as comment
The comment states "If the specified buffers are already non-NULL
frees them if a credential is found".

Also return 1 if all credentials are found.
2024-01-10 09:54:39 +01:00
Lennart Poettering 84960b7f3c Merge pull request #30844 from keszybz/rename-uid-alloc-range
Rename uid-alloc-range.[ch] files
2024-01-09 18:51:35 +01:00
Mike Yuan f359b3073f machined,portabled: remove unneeded NOTIFY_STOPPING
This is done internally by bus_event_loop_with_idle().
2024-01-09 21:57:45 +08:00
Zbigniew Jędrzejewski-Szmek 8e1ac16bc6 src/basic: rename uid-alloc-range.[ch] to uid-classification.[ch]
We had both uid-range.h and uid-alloc-range.h. The latter now contains helpers
like {uid,gid}_is_{system,dynamic,container}(), uid_for_system_journal(), so
the existing name is outdated. I think the uid-range.[ch] should stay separate
because it has a bunch of helpers for parsing and printing of uid ranges. So
let's rename as in $subject to better reflect the contents of the file and make
the two sets of files harder to confuse.
2024-01-09 11:15:00 +01:00
Lennart Poettering 0a6598bb38 hostnamed: add simple Varlink API, too 2024-01-09 10:46:25 +01:00
AtariDreams 5ba46b99f7 simplify bitwise checking (#30722)
Some of these checks before bitwise operations are redundant and compilers
do not always recognize them, so let's simplify the code to make the intentions
clearer.
2024-01-09 10:18:10 +09:00
Yu Watanabe 35716eed55 Merge pull request #30837 from poettering/varlink-over-ssh
varlink: add "ssh:" transport for talking to remote servers
2024-01-09 10:14:03 +09:00
Lennart Poettering 8759bc9541 discover-image: don't accidentally set /run/systemd/nspawn/ access mode too strict
mkdir_p() uses the specified access mode for all dirs that are missing,
hence if we call it on /run/systemd/nspawn/locking and
/run/systemd/nspawn/ doesn't exist yet, we#d create it 0700 here. But
that was never the intention, and all other code creating that dir sets
the mode to 0755. Fix this here to match the rest.
2024-01-09 09:58:26 +09:00
Lennart Poettering a1bb30de7f varlink: add "ssh:" transport
This uses openssh 9.4's -W support for AF_UNIX. Unfortunately older versions
don't work with this, and I couldn#t figure a way that would work for
older versions too, would not be racy and where we'd still could keep
track of the forked off ssh process.

Unfortunately, on older versions -W will just hang (because it tries to
resolve the AF_UNIX path as regular host name), which sucks, but hopefully this
issue will go away sooner or later on its own, as distributions update.

Fedora is still stuck at 9.3 at the time of posting this (even on
Fedora), even though 9.4, 9.5, 9.6 have all already been released by
now.

Example:
        varlinkctl call -j ssh:root@somehost:/run/systemd/io.systemd.Credentials io.systemd.Credentials.Encrypt '{"text":"foobar"}'
2024-01-08 23:24:45 +01:00
Lennart Poettering 07dca3c4b0 varlink: turn off O_NONBLOCK in exec: transport
If we invoke our own varlink implementation we'll turn on O_NONBLOCK
right-away again, hence there is little point in turning it off,
however, I generally think we probably should always path this fd as
blocking, since that is the default after all, and invoked processes
might want to use it like that.

Or to see this differently: I think the varlink fd passed for activation
in many ways is similar to and as fundamental as stdin/stderr/stdout,
hence should probably be synchronous by default.
2024-01-08 23:24:39 +01:00
Mike Yuan bdd2036e81 hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX 2024-01-09 03:59:15 +09:00
Lennart Poettering 4bcd606815 bus-polkit: fix memory leak
We need to destroy the hashmap entry keyed by the varlink object in case
this is a varlink request.

Follow-up for: d04c1a1c8e
2024-01-08 19:06:13 +01:00
Yu Watanabe 9aa3c07947 network/route-metric: invalidate [Route] section if an invalid string is specified
Follow-up for 18c4c5d84f.
2024-01-07 14:04:00 +09:00
Lennart Poettering a6a7983dbf dev-setup: rework make_inaccessible_nodes() around openat() and friends
Let's operate on fds rather than paths. Make some tweaks to the logic on
top:

1. Mark the resulting dir as read-only after we are done.
2. Use the new inode_type_to_string() calls to determine the inode
   names.
3. If an inode already exists, try to adjust the access mode, just in
   case.
4. Use FOREACH_ARRAY()
2024-01-06 08:27:51 +09:00
networkException dcfac3a3f9 parse-helpers: allow port 0 for socket bind items
This patch adds a new parameter to parse_ip_port_range, giving callers
the option to allow ranges to have their min be 0 instead of 1.

This is then used by parse_ip_ports_token, intern used by
parse_socket_bind_item to allow port 0 when restricting bind system
calls with SocketBindDeny / SocketBindAllow.

With this, users running server software written using the golang
standard library will be able to effectively sandbox their software,
albeit with a small loss in security protections by allowing the
process to bind on a random port in the
/proc/sys/net/ipv4/ip_local_port_range.
2024-01-06 08:27:14 +09:00
Lennart Poettering 9c3d8db990 creds-util: optionally, allow NULL credentials even with TPM 2024-01-05 17:20:05 +01:00
Lennart Poettering 3289aba5a0 Merge pull request #30754 from poettering/iovecification
tpm2-util: convert various things over to struct iovec rather that data ptr + size
2024-01-05 14:45:15 +01:00
Lennart Poettering 53cea64542 Merge pull request #30784 from poettering/json-dispatch-enum
json: add macro for automatically defining a dispatcher for an enum
2024-01-05 14:44:59 +01:00
Lennart Poettering f0e4244b2f tree-wide: use JSON_ALLOW_EXTENSIONS when disptching at various places
If we want to allow method replies to be extended without this breaking
compat, then we should set this flag. Do so at various method call
replies hence.

Also do it when parsing user/group records, which are expressly
documented to be extensible, as well as the hibernate JSON record.
2024-01-05 12:43:06 +01:00
Lennart Poettering a617fd9047 json: add new dispatch flag JSON_ALLOW_EXTENSIONS
This is a subset of JSON_PERMISSIVE focussed on allowing parsing of
varlink replies that get extended, i.e. gain new fields, without
allowing more than that (i.e. without allowing missing fields, or bad
field types or such).
2024-01-05 12:43:06 +01:00
Lennart Poettering 8ef31e1f13 Merge pull request #29692 from H5117/fix_pkcs11_uri
cryptenroll: change class in provided PKCS#11 URI if necessary
2024-01-05 12:14:26 +01:00
Lennart Poettering 19f3282929 user-record: port over to JSON_DISPATCH_ENUM_DEFINE() 2024-01-05 12:08:37 +01:00
Lennart Poettering dda6629622 json: add macro for automatically defining a dispatcher for an enum 2024-01-05 12:08:37 +01:00
Lennart Poettering 8d042bc40a tpm2-util: more iovec'ification
Let's move more code to using struct iovec for passing around binary
chunks of data.

No real changes in behaviour, just refactoring.
2024-01-05 11:34:46 +01:00
Lennart Poettering b22f0a502d json: add more iovec helpers for serializing/deserializing binary data 2024-01-05 11:10:22 +01:00
Yu Watanabe 20a0aeb039 vpick: fix typo
Follow-up for 76511c1bd3.
2024-01-05 19:08:12 +09:00
Lennart Poettering 35a7dd4834 Merge pull request #30728 from polarina/noda
Assign noDA attribute to TPM2 objects not dependant on a PIN
2024-01-05 11:04:11 +01:00
Vladimir Stoiakin 85828ef920 cryptenroll: change class in provided PKCS#11 URI if necessary
cryptenroll accepts only PKCS#11 URIs that match both a certificate and a private key in a token.
This patch allows users to provide a PKCS#11 URI that points to a certificate only, and makes possible to use output of some PKCS#11 tools directly.
Internally the patch changes 'type=cert' in the provided PKCS#11 URI to 'type=private' before storing in a LUKS2 header.

Fixes: #23479
2024-01-05 12:32:36 +03:00
Luca Boccassi 6a80e22766 Merge pull request #30759 from mrc0mmand/resolved-followup
resolve: initialize `r` during OOM
2024-01-05 09:26:19 +01:00
Sergei Zhmylev 25aa35d465 journalctl: add --exclude-identifier option 2024-01-04 23:21:39 +01:00
Lennart Poettering 42301b6d96 creds-util: automatically append NUL byte to decrypted creds
Both as safety net and as convenience feature of a string is contained
in the credential
2024-01-04 22:57:04 +01:00
Lennart Poettering 6d78dc2827 creds: rename "tpm2-absent" encryption to "null" encryption
This is what it is after all: encryption with a NULL key. This is more
descriptive, but also relevant since we want to use this kind of
credentials in a different context soon: for carrying pcrlock data into
a UKI. In that case we don#t want encryption, since the pcrlock data is
intended to help unlocking secrets, hence should not be a secret itself.

This only changes the code labels and the way this is labelled in the
output. We retain compat with the old name.
2024-01-04 22:56:48 +01:00
Lennart Poettering 01ae684782 find-esp: adjust parameter indentating to our usual coding style 2024-01-04 22:56:33 +01:00
Lennart Poettering bd334c0ebb json: drop redundant check
The same check is done exactly one line later, because this is one of
the things that json_variant_is_regular() checks.

As per: https://github.com/systemd/systemd/pull/30578/commits/fa9a6db478e3f0f2753e4633af6d0d4881707c2b#r1441792019
2024-01-04 22:55:42 +01:00
Frantisek Sumsal 0a87b83497 shared: initialize a couple of values explicitly
As gcc has trouble figuring this itself with -O2 and -Wmaybe-initialized.
2024-01-04 20:57:03 +01:00
Gabríel Arthúr Pétursson 9bf91584c8 Assign noDA attribute to TPM2 objects not dependant on a PIN
All the keys are high-entropy keys that cannot be practically
bruteforced and thus don't require protection from dictionary attacks.
With the exception of PINs, of course, which are low-entropy and user
provided.

Note that a new enrollment is required for unlocking while in DA
lockdown to function. Existing enrollments are subject to DA lockout.

Fixes: #30330
2024-01-04 15:52:37 +00:00
Mike Yuan 1f233020dc shared/vpick: don't say "ptr" for TAKE_PICK_RESULT (struct) 2024-01-04 23:35:37 +08:00
Yu Watanabe 4855d82348 Merge pull request #30739 from poettering/pam-util-many
pam-util: add pam_get_item_many() to shorten some code
2024-01-04 23:28:34 +09:00
Yu Watanabe 18c4c5d84f network/route: make the route section invalid when an invalid MTUBytes= is specified
We usually set the invalid flag for a section if a setting in the section has
an invalid value. Let's also do the same thing for MTUBytes= in [Route].
2024-01-04 23:18:28 +09:00
Lennart Poettering 96fc8cab2a Merge pull request #30578 from bluca/polkit-varlink
varlink: add glue to allow authenticating varlink connections via polkit
2024-01-04 15:15:45 +01:00