Commit Graph
70604 Commits
Author SHA1 Message Date
Mike Yuan ea54517476 loginctl: add --json= and -j, decouple list-* from --output=
--output= is documented to only affect journal output in *-status.
Let's use --json= and -j standard options for list-* instead.
2024-01-17 11:30:04 +08:00
Mike Yuan 4a3e43ddc5 loginctl: show more info in list-sessions (ListSessionsEx())
At the same time, 8b6c039a1a is reverted, i.e.
session state is removed from the output. It was added to workaround #26744,
and doesn't really make too much sense after the issue is properly fixed.
2024-01-17 11:25:49 +08:00
Mike Yuan b3cb952c03 logind-dbus: introduce ListSessionsEx() call
As per https://github.com/systemd/systemd/pull/30884#discussion_r1448938737
2024-01-17 11:25:48 +08:00
Mike Yuan 7fbdd8c323 man: don't use versioned standard-options
no-pager-255 was added in #29184, which I reviewed and agreed.
However, as #30887 came up, I reconsidered it a bit, and now
I actually think that this should be removed.

We add new tools that refer to these standard options. During
the process, some options are also promoted to be standard ones.
I think a more sane practice is to generally keep old tools in
the loop, rather than overloading the standard-options with versions.
2024-01-17 11:25:45 +08:00
Yu Watanabe 443afd6c19 Merge pull request #30967 from yuwata/network-can-required-operstate-for-online
network: several cleanups for required operstate for online, and change the default for CAN devices
2024-01-17 07:01:24 +09:00
Luca Boccassi db75b2aba7 Merge pull request #30962 from poettering/varlink-json-sensitive-rework
varlink/json: rework "sensitive" logic
2024-01-16 21:23:54 +00:00
Luca Boccassi aa3ee22592 Merge pull request #30955 from yuwata/network-queue-request_detach
network/queue: cleanups for detaching request
2024-01-16 21:17:32 +00:00
Luca Boccassi eda07d7fcf Merge pull request #30949 from yuwata/network-route-cosmetic-cleanups
network/route: several cosmetic cleanups
2024-01-16 21:16:09 +00:00
Dan Streetman fda3e84465 tpm2: If unsealing results in policy hash mismatch when using RSA pubkey, possibly retry
The commit e3acb4d24c changed how we format a
TPM2B_PUBLIC object from an openssl PEM RSA key if it used the TPM-defined
"default" RSA exponent, to instead set the TPM2B_PUBLIC RSA exponent to the
special-case value of 0. This broke backwards compatibility with
previously-sealed data. The previous commit fixed our code to no longer use the
"special case" exponent value of 0, while this commit adds a fallback check for
any sealed data that used the exponent value of 0. Now unsealing should work
for sealed data that used either method (either 0 or the actual value).
2024-01-16 15:57:08 -05:00
Frantisek Sumsal a165918491 ukify: use datetime.timezone.utc instead of datetime.UTC
For compat with older Python versions, since datetime.UTC is an alias
introduced in Python 3.11.
2024-01-16 21:48:44 +01:00
Frantisek Sumsal ee23a85561 ci: install python3-pytest for ukify tests 2024-01-16 21:36:05 +01:00
Dan Streetman e2e8d8f2a2 test: check TPM2B_PUBLIC "name" during PEM->TPM2B_PUBLIC conversion tests
Check the calculated TPM2B_PUBLIC key "name" to verify our PEM->TPM2B_PUBLIC
function remains consistent with previous code. This is important as the
TPM2B_PUBLIC "name" is used in the Authorize policy and so any change to a key
"name" would break unsealing for previously-sealed objects (see bug #30546).

Note that the tpm2_tpm2b_public_from_openssl_pkey() function results in a
TPM2B_PUBLIC with the same "name" as using the tpm2-tools program
tpm2_loadexternal, at least as of tpm2-tools version 5.6.18, with the test keys
from TEST(tpm2b_public_from_openssl_pkey) in src/test/test-tpm2.
2024-01-16 14:27:52 -05:00
Dan Streetman 910caa2443 test: verify PEM->TPM2B_PUBLIC conversion for RSA key with non-default exponent
The tpm2 test currently verifies PEM->TPM2B_PUBLIC conversion for an RSA key
with the default exponent (0x10001); this adds verification for an RSA key with
a non-default exponent.
2024-01-16 14:11:31 -05:00
Dan Streetman 1242b9ab2b tpm2: Do not use RSA exponent special-case default value in PEM->TPM2B_PUBLIC conversion
The openssl default value for an RSA key exponent value is 0x10001, and the TPM
specification defines a exponent value of 0 as representing this value. The
systemd code that converted an RSA PEM public key to a TPM2B_PUBLIC object
previously used the exponent value directly, but commit
e3acb4d24c changed the conversion to use the
special case exponent value of 0 for any RSA key with an exponent value of
0x10001.

Because the entire TPM2B_PUBLIC object is used to calculate its "name", this
difference in exponent value (0x10001 vs 0) introduced a change in the key
"name". Since the Authorize policy uses the key "name" directly in its policy
session hash value, this change resulted in new systemd code being unable to
properly unseal any data (e.g. a LUKS volume) that was previously sealed.

This reverts the code to no longer override an RSA exponent value of 0x10001
with the special case value of 0.

Fixes a bug introduced by commit e3acb4d24c.

Fixes: #30546
2024-01-16 14:09:51 -05:00
Yu Watanabe 7155ad9532 test-network: test the default required operational state for CAN devices 2024-01-17 04:05:43 +09:00
Yu Watanabe 3255bda698 network: make 'carrier' as the default required operational state for CAN device
As CAN devices do not support IP address, hence the state never goes to
higher than 'carrier'.

Prompted by https://github.com/linux-can/can-utils/issues/68#issuecomment-1327987724.
2024-01-17 04:05:43 +09:00
Yu Watanabe 2e59ba4e24 wait-online: several cleanups for LinkOperationalState
- fix memleak in parser,
- fix missing return in parser on failure,
- drop unnecessary temporary argument in command line argument parser,
- use recently introduced macros and helper functions.
2024-01-17 04:05:43 +09:00
Yu Watanabe 2278d9f66e network: several cleanups for LinkOperationalState
- introduce link_required_operstate_for_online() helper function,
- use recently introduced macros and helper functions,
- unconditionally serialize the minimum and maximum of required
  operational state.
2024-01-17 04:05:43 +09:00
Yu Watanabe ba04f957fe network: drop unnecessary temporary variables 2024-01-17 04:05:43 +09:00
Yu Watanabe 2db2979505 sd-network: modernize parse_operational_state_range()
- rename 'out' -> 'ret',
- introduce LINK_OPERSTATE_RANGE_INVALID,
- constify LINK_OPERSTATE_RANGE_DEFAULT,
- drop spurious const specifier for allocated string,
- etc,.
2024-01-17 04:05:43 +09:00
Yu Watanabe 15f624f80f sd-network: introduce three helper functions for LinkOperationalState 2024-01-17 04:05:43 +09:00
A S Alam 04ba20a80a po: Translated using Weblate (Punjabi)
Currently translated at 32.1% (73 of 227 strings)

Co-authored-by: A S Alam <aalam@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pa/
Translation: systemd/main
2024-01-16 19:54:17 +01:00
Ronan Pigott a9766d07b8 test-resolve: add basic test for SVCB/HTTPS RRs 2024-01-16 11:26:37 -07:00
Ronan Pigott 9c331dc3c8 resolvectl: add SVCB and HTTPS json format 2024-01-16 11:26:37 -07:00
Ronan Pigott f0d261a714 resolvectl: implement SVCB and HTTPS presentation format 2024-01-16 11:26:37 -07:00
Lennart Poettering b9b426b5b2 Merge pull request #30944 from CodethinkLabs/vmspawn/fix_fedora_issues
vmspawn: fix more issues
2024-01-16 18:57:56 +01:00
Ronan Pigott b699f5f2cd escape: introduce decescape
This 3-digit decimal escape style is useful when presenting DNS RR
information in zone-file presentation format.
2024-01-16 10:49:26 -07:00
Ronan Pigott e7634d6b05 resolved: enable RFC9460 SVCB and HTTPS records 2024-01-16 10:49:26 -07:00
Ronan Pigott ee9581e5e9 dns: add svcparam iana enum constants 2024-01-16 10:49:26 -07:00
Lennart Poettering 85978d296c varlink: restore debug output on incoming messages
Now that we can selectively suppress only sensitive fields in JSON
objects we can reenable debug logging for incoming messages, which was
removed in 2e3414660c.

This makes Varlink fully debuggable again: we'll see both incoming and
outgoing messages, only the sensitive fields are suppressed.

See: #30578
2024-01-16 17:17:19 +01:00
Lennart Poettering 9912897170 json: replace JSON_FORMAT_REFUSE_SENSITIVE with JSON_FORMAT_CENSOR_SENSITIVE
Previously, the flag would completely refuse formatting a JSON object if
any field of it was marked sensitive. With this change we'll simply
replace the subobject with the string "<sensitive data>", and show
everything else.

This is tremendously useful when debugging, since it means that we can
again trace varlink calls through the stack: we can show all the message
metadata and just suppress the actually sensitive parameters.

The ability to debug this matters, and we should not hide more
information that we can get away with, to keep things debuggable and
maintainable.
2024-01-16 17:17:19 +01:00
Lennart Poettering c609338b1d json: export json_variant_is_sensitive_recursive()
Let's export this function, so that we can use it elsewhere. Also, while
at it, let's cache the result in a flag. This is only safe if the result
is positive, since we allow the flag to be enabled at any time down thre
tree somewhere, which we need to look at. (We never allow it to be
turned off however)
2024-01-16 17:16:18 +01:00
Lennart Poettering a570877c12 varlink: optionally, mark all incoming message's "parameters" field as sensitive
So far the varlink logic honoured the "sensitive" flag of output
messages. Let's add something similar for input messages. Since we don't
really know incoming messages, the flag simply controls whether the
"parmaeters" field of all incoming messages should be marked as
sensitive.

Then, turn this on in the credentials logic and in homed, since both
deal with credentials.
2024-01-16 17:14:20 +01:00
Yu Watanabe 47420573a7 network/route: find/distinguish routes in the same way that the kernel uses
The kernel uses different logics to find or distinguish IPv4 and IPv6 routes.
Let's follow the same way that the kernel uses.
See comments in the code for more details.
2024-01-16 16:13:53 +00:00
Mike Yuan 50d5f64632 labeler: add bsod, hibernate-resume, nspawn and vmspawn 2024-01-16 16:13:26 +00:00
Lennart Poettering 598ef6e0e0 Merge pull request #30960 from poettering/get-user-creds-modernization
user-util: modernize get_user_creds() + get_group_creds()
2024-01-16 17:12:00 +01:00
Mike Yuan ff841d9877 logind: allow Sleep() and CanSleep() dbus calls
Follow-up for cd4dd90b99
2024-01-16 15:25:43 +00:00
Luca Boccassi 97cc54bffd Merge pull request #30963 from poettering/creds-tweaks
two minor creds-util.c simplifications
2024-01-16 15:25:08 +00:00
Luca Boccassi 50f89c7d6d Merge pull request #30961 from poettering/varlink-bus-polkit-fixes
varlink polkit client fixes
2024-01-16 15:24:22 +00:00
Luca Boccassi d62080e078 Merge pull request #30959 from poettering/varlink-debug-better
varlink tweaks for making debugging easier
2024-01-16 15:18:36 +00:00
Yu Watanabe b9b5096edb network/queue: detach request from the queue only when the request is actually queued
No effective functionality is changed in this commit.
Refactoring and preparation for later commits.
2024-01-16 23:25:32 +09:00
Yu Watanabe e30dc59c2e network/queue: increase the reference counter of the request before processing it
To prevent the request freed in req->process().

This also makes a request that is not requested by a link detached on failure.
Otherwise, the request may periodically processed and failed forever.
2024-01-16 23:25:32 +09:00
Lennart Poettering e9c974fd42 user-util: honour PREFER_NSS flag in get_group_creds() the same way as we already do in get_user_creds()
let's onour the PREFER_NSS flag also in get_group_creds() the same
way we honour it in get_user_creds().

Simply to remove surprises.
2024-01-16 14:56:25 +01:00
Lennart Poettering 83e9b584db user-util: modernize get_user_creds() + get_group_creds()
Let's rename return parameters to ret_xyz, and let's guarantee the usual
rule to initialize all return parameters on success, and not touch any
on failure.
2024-01-16 14:55:45 +01:00
Lennart Poettering a9e4057f1f creds-util: drop unnecessary include
Follow-up for: e653a194e4
2024-01-16 14:16:42 +01:00
Lennart Poettering cdbcb1fe6e creds-util: simplify offset calculation a bit
Don't recalculate the overall offset entirely each time we process
another header. Instead, if we already validated an earlier offset, just
reuse the result, it's readily available in 'p'.

No change in behaviour, just a bit of code simplification.
2024-01-16 14:16:18 +01:00
Lennart Poettering e96202fa5d bus-polkit: don't return positive in varlink_verify_polkit_async() just because we already sent an error reply
A positive return value means "access granted", hence if we already
reply to the method call don't accidentally return positive.

Follow-up for: d04c1a1c8e
2024-01-16 13:59:49 +01:00
Lennart Poettering 0ca9a44799 bus-polkit: explicitly cast away return value we ignore 2024-01-16 13:59:49 +01:00
Lennart Poettering 956d8aee01 bus-polkit: treat various well-known PK errors as denied
Various recognizable errors from

https://www.freedesktop.org/software/polkit/docs/latest/eggdbus-interface-org.freedesktop.PolicyKit1.Authority.html#eggdbus-errordomain-org.freedesktop.PolicyKit1.Error.

should be considered access failures, hence treat them like that.
2024-01-16 13:59:49 +01:00
Lennart Poettering 4a6fe5f05e varlink: also honour new env var $SYSTEMD_VARLINK_LISTEN in varlink_server_listen_auto()
varlink_server_listen_auto() is supposed to be the one-stop solution for
turning simple command line tools into IPC services. They aren't easy to
test/debug however, since you have to invoke them through a service
manager.

Let's make this easier: if the SYSTEMD_VARLINK_LISTEN env var is set,
let's listen on the socket specified therein. This makes things easier
to gdb: just run the service from the cmdline.
2024-01-16 13:45:35 +01:00