Yu Watanabe [Wed, 10 Jan 2024 03:37:36 +0000 (12:37 +0900)]
resolve: notify DNSSEC failure, EDE code, and EDE message
Yu Watanabe [Wed, 10 Jan 2024 03:07:19 +0000 (12:07 +0900)]
resolve: make manager_monitor_send() take DnsQuery*
Yu Watanabe [Wed, 10 Jan 2024 04:01:31 +0000 (13:01 +0900)]
resolve: also read EDE code and message from cached packet
Yu Watanabe [Wed, 10 Jan 2024 02:34:44 +0000 (11:34 +0900)]
resolve: introduce DNSSEC_UPSTREAM_FAILURE
and include EDE code and message in the error messages.
This replaces
9ca133e97a0c8795b1f293ccea4965b4ad1accc4, and implements
originally suggested at
https://github.com/systemd/systemd/pull/30513#discussion_r1433823737
Yu Watanabe [Tue, 9 Jan 2024 20:05:29 +0000 (05:05 +0900)]
resolvectl: use JSON_ALLOW_EXTENSIONS
Follow-up for
f0e4244b2fda1b3de3da1c2792ed1cd21c72087b.
Yu Watanabe [Sat, 6 Jan 2024 21:01:05 +0000 (06:01 +0900)]
resolve: several follow-ups for
9ca133e97a0c8795b1f293ccea4965b4ad1accc4.
- add missing initialization for DnsQuery.answer_ede_rcode,
- clear EDE code and message in dns_transaction_reset_answer(),
otherwise the previous EDE code or message may be mistakenly reused
on restart. This fixes memory leak of DnsTransaction.answer_ede_msg.
- also clear EDE code and message in dns_query_reset_answer(),
otherwise ede message is leaked if dns_query_accept() is called
multiple times for the same DnsQuery.
Follow-up for
9ca133e97a0c8795b1f293ccea4965b4ad1accc4.
Fixes #30752.
Yu Watanabe [Wed, 10 Jan 2024 01:10:06 +0000 (10:10 +0900)]
resolve: drop DNS_TRANSACTION_UPSTREAM_DNSSEC_FAILURE
This partially reverts commit
9ca133e97a0c8795b1f293ccea4965b4ad1accc4.
Not only there is no reason to introduce a new transaction failure state,
but also the commit introduces several severe issues.
Fixes #30776, #30779.
Yu Watanabe [Sat, 6 Jan 2024 18:57:11 +0000 (03:57 +0900)]
resolve: several follow-ups for
ac6844460ca1c01eaf2cb209ffa21c200d21a8f8
- fix indentation,
- drop incorrect comment, dns_packet_ede_rcode() can handle unknown EDE rcode.
- 0 is a valid EDE rcode,
- DnsTransaction.answer_ede_msg may be NULL, so needs to use strempty()
on logging,
- drop redundant ede_rcode temporary variable.
Follow-up for
ac6844460ca1c01eaf2cb209ffa21c200d21a8f8.
Yu Watanabe [Sat, 6 Jan 2024 18:28:19 +0000 (03:28 +0900)]
resolve: cleanup dns_packet_ede_rcode()
This makes the following:
- make dns_packet_ede_rcode() return -EINVAL when EDE code not found.
Otherwise, the caller may be confused that the packet has an unknown
error code.
- make the function escape EDE message only when non-utf8 message is received.
- the message handling logic is applied even if the error code is unknown, as
there is no reason that we escape EDE message only when an known error code
is received.
- reduce scope of variables,
- drop redundant 'else',
- append full stop to the log messages,
- drop redundant log message in the caller,
- split out error in the function and returned EDE error code.
Follow-up for
ac6844460ca1c01eaf2cb209ffa21c200d21a8f8.
Yu Watanabe [Sat, 6 Jan 2024 17:58:15 +0000 (02:58 +0900)]
resolve: update rcode table and align enum definitions
Lennart Poettering [Tue, 9 Jan 2024 17:51:35 +0000 (18:51 +0100)]
Merge pull request #30844 from keszybz/rename-uid-alloc-range
Rename uid-alloc-range.[ch] files
Lennart Poettering [Mon, 8 Jan 2024 22:48:01 +0000 (23:48 +0100)]
nspawn: drop empty #if/#endif section
Follow-up for
adb29d588ed8497d2c51f1d6d5e45a1e0d80a1dd
Daan De Meyer [Tue, 9 Jan 2024 10:55:37 +0000 (11:55 +0100)]
mkosi: Update to latest
The mkosi github action doesn't set up the host machine for building
full images anymore. Instead, only sufficient packages are installed
to be able to build tools trees so we configure a fedora tools tree
to build the actual images.
Luca Boccassi [Tue, 9 Jan 2024 12:23:35 +0000 (12:23 +0000)]
Merge pull request #30843 from keszybz/test-relative-paths
Use relative paths in test units
Lennart Poettering [Tue, 9 Jan 2024 11:38:58 +0000 (12:38 +0100)]
Merge pull request #30833 from poettering/hostnamed-varlink
hostnamed: add simple varlink interface
Lennart Poettering [Tue, 9 Jan 2024 11:34:33 +0000 (12:34 +0100)]
update TODO
Luca Boccassi [Tue, 9 Jan 2024 10:40:19 +0000 (10:40 +0000)]
Merge pull request #30842 from aafeijoo-suse/analyze-q-man-help-fix
analyze: minor fixes
Lennart Poettering [Tue, 9 Jan 2024 10:26:11 +0000 (11:26 +0100)]
Merge pull request #30826 from YHNdnzj/networkd-wireguard-credential
networkd/wireguard: support network.wireguard.* credentials
Zbigniew Jędrzejewski-Szmek [Tue, 9 Jan 2024 09:59:31 +0000 (10:59 +0100)]
TEST-07: minor simplification
Zbigniew Jędrzejewski-Szmek [Tue, 9 Jan 2024 09:37:27 +0000 (10:37 +0100)]
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.
Zbigniew Jędrzejewski-Szmek [Tue, 9 Jan 2024 09:33:49 +0000 (10:33 +0100)]
src/basic: "UidRange" → "UIDRange"
We don't "uncapitalize" parts of an already-capitalized name when concatenating
words. In particular, we had UidRange in basic/uid-range.h and UGIDAllocationRange
in basic/uid-alloc-range.h, which is annoying.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jan 2024 14:24:52 +0000 (15:24 +0100)]
tests: use relative paths in ExecStart= and friends
We want to retain *some* of the full paths in order to test more code paths.
But the default should be to use the command name only. This makes the tests
less visually cluttered.
Lennart Poettering [Mon, 8 Jan 2024 15:45:07 +0000 (16:45 +0100)]
hostnamed: always include VSockCID property in describe JSON
that way clients can distinguish whether there is no cid or whether
hostnamed doesn't support it nicely, by just looking if the prop exists
(but is null) or not.
This is similar how we already handle all other props in the JSON
record.
Lennart Poettering [Mon, 8 Jan 2024 14:13:07 +0000 (15:13 +0100)]
hostnamed: add simple Varlink API, too
Lennart Poettering [Mon, 8 Jan 2024 15:42:00 +0000 (16:42 +0100)]
testsuite-71: reset startlimit counter manually
The test cases will call quite a lot of "systemctl stop
systemd-hostnamed", hence let's make sure we reset the start limit
counter each time, to not make this eventually fail.
(At other places we disabled the start limit counter, but here I opted
for resetting it manually via 'systemctl reset-failed', to test another
facet of the mechanism)
Lennart Poettering [Mon, 8 Jan 2024 15:14:44 +0000 (16:14 +0100)]
id128-util: do not expose product UUID when running in a container
When we run in a container we should show our own system's info, not the
hosts hence suppress this info in that case.
This matches the behaviour of most other calls in hostnamed to expose
system properties.
Lennart Poettering [Mon, 8 Jan 2024 12:57:41 +0000 (13:57 +0100)]
hostnamed: move bus and event loop object into Context object
It's a bit weird to keep this separate in particular as the polkit
object is already part of the context.
Lennart Poettering [Mon, 8 Jan 2024 12:51:44 +0000 (13:51 +0100)]
hostnamed: port to sd_event_set_signal_exit()
Antonio Alvarez Feijoo [Tue, 9 Jan 2024 09:11:59 +0000 (10:11 +0100)]
analyze: man and --help fixes
man:
- `verify` requires an argument
- `security` does not require an argument
- `fdstore` requires an argument
- `image-policy` requires an argument
`--help` text:
- missing `image-policy` command
- `cat-config` requires NAME or PATH
Antonio Alvarez Feijoo [Tue, 9 Jan 2024 08:05:50 +0000 (09:05 +0100)]
Mike Yuan [Wed, 27 Dec 2023 13:38:32 +0000 (21:38 +0800)]
networkd/wireguard: support network.wireguard.* credentials
Closes #26702
AtariDreams [Tue, 9 Jan 2024 03:24:37 +0000 (22:24 -0500)]
cocci: merge mfree.cocci and mfree_return.cocci (#30838)
It makes sense that these should be one file instead of two, as they both involve mfree()
AtariDreams [Tue, 9 Jan 2024 01:18:10 +0000 (20:18 -0500)]
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.
Yu Watanabe [Tue, 9 Jan 2024 01:14:03 +0000 (10:14 +0900)]
Merge pull request #30837 from poettering/varlink-over-ssh
varlink: add "ssh:" transport for talking to remote servers
Lennart Poettering [Mon, 8 Jan 2024 14:47:55 +0000 (15:47 +0100)]
socket-util: modernize socknameinfo_pretty() a bit
Lennart Poettering [Fri, 5 Jan 2024 21:20:32 +0000 (22:20 +0100)]
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.
Lennart Poettering [Mon, 8 Jan 2024 22:06:48 +0000 (23:06 +0100)]
sd-bus: also intrepret $SYSTEMD_SSH env var
To make things symmetric to the $SYSTEMD_SSH logic that the varlink
transport supports, let's also honour such a variable in sd-bus when
picking ssh transport.
Lennart Poettering [Mon, 8 Jan 2024 21:26:17 +0000 (22:26 +0100)]
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"}'
Lennart Poettering [Mon, 8 Jan 2024 17:49:12 +0000 (18:49 +0100)]
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.
Lennart Poettering [Mon, 8 Jan 2024 21:25:22 +0000 (22:25 +0100)]
process-util: turn off O_NONBLOCK on stdio fds when rearranging fds
We often create our fds O_NONBLOCK, but when we want to invoke some
program with them as stdin/stdout/stderr we really should turn it off
again.
Lennart Poettering [Mon, 8 Jan 2024 17:48:53 +0000 (18:48 +0100)]
env-util: add new setenvf() helper
And convert some pieces of code over.
Mike Yuan [Mon, 8 Jan 2024 09:22:33 +0000 (17:22 +0800)]
hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX
Antonio Alvarez Feijoo [Mon, 8 Jan 2024 15:08:26 +0000 (16:08 +0100)]
tmpfiles: fix memory leak in arg_exclude_prefixes
When using the `--image` or `-E` options, `arg_exclude_prefixes` is extended via
the `exclude_default_prefixes` function, which calls `strv_extend_strv`, adding
values using `strdup` that must be freed on exit.
Also changing `arg_include_prefixes` to use the same model, although there is no
leak here.
Lennart Poettering [Mon, 8 Jan 2024 14:54:42 +0000 (15:54 +0100)]
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:
d04c1a1c8e7c95daa483d8d52d5fc4c25fbc67f2
Cristian Rodríguez [Sun, 7 Jan 2024 22:49:45 +0000 (19:49 -0300)]
timesync: IPTOS_LOWDELAY --> IPTOS_DSCP_EF
Deprecated IPTOS_LOWDELAY is ignored by most of today's
network equipment that only ever care about DSCP.
Use the DSCP found in other NTP implementations and set the appropiate
TCLASS for IPv6.
Yu Watanabe [Mon, 8 Jan 2024 10:59:32 +0000 (19:59 +0900)]
virt: fix detection of avx2 and friends
To get the CPUID with EAX=7, we need explicitly set 0 to ECX.
From Intel® Architecture Instruction Set Extensions Programming
Reference and Related Specifications,
===
Leaf 07H output depends on the initial value in ECX.
If ECX contains an invalid sub leaf index, EAX/EBX/ECX/EDX return 0
===
Fixes #30822.
Lennart Poettering [Mon, 8 Jan 2024 14:02:02 +0000 (15:02 +0100)]
Merge pull request #30827 from poettering/network-generator-creds
network-generator: pick up .netdev/.link/.network configuration via c…
Lennart Poettering [Mon, 8 Jan 2024 13:36:57 +0000 (14:36 +0100)]
Merge pull request #30787 from poettering/hostnamed-cid
hostnamed: expose AF_VSOCK CID among hostnamed/hostnamectl info
Lennart Poettering [Mon, 8 Jan 2024 10:25:56 +0000 (11:25 +0100)]
network-generator: pick up .netdev/.link/.network configuration via credentials
To me this is the last major basic functionality that couldn't be
configured via credentials: the network.
We do not invent any new format for this, but simply copy relevant creds
1:1 into /run/systemd/network/ to open up the full functionality of
networkd to VM hosts.
Lennart Poettering [Fri, 5 Jan 2024 15:34:33 +0000 (16:34 +0100)]
hostnamed: expose local AF_VSOCK CID among other host info
This is a host identifier of major relevance, since it is how you
connect to this system if it is a VM, hence expose this nicely.
Lennart Poettering [Fri, 5 Jan 2024 15:33:58 +0000 (16:33 +0100)]
socket-util: add helper for querying the local AF_VSOCK CID
Yu Watanabe [Sun, 7 Jan 2024 23:49:15 +0000 (08:49 +0900)]
Merge pull request #30815 from yuwata/resolve-ixfr
resolve: NSCOUNT of DNS query may not be zero
Frantisek Sumsal [Sun, 7 Jan 2024 21:22:52 +0000 (22:22 +0100)]
test: check how systemd-resolved deals with zone transfers
Even though systemd-resolved doesn't support zone transfers (AXFR/IXFR),
it should still just refuse such requests without choking on them.
See: https://github.com/systemd/systemd/pull/30809#issuecomment-
1880102804
Frantisek Sumsal [Sun, 7 Jan 2024 12:32:14 +0000 (13:32 +0100)]
test: merge config sections
Frantisek Sumsal [Sun, 7 Jan 2024 12:29:50 +0000 (13:29 +0100)]
test: zone-check with --force to fail on warnings
Yu Watanabe [Sun, 7 Jan 2024 17:02:33 +0000 (02:02 +0900)]
resolve: NSCOUNT of DNS query may not be zero
This also separates check for DNS and LLMNR, as the existing comments
are for LLMNR, not DNS. And this moves the comment for mDNS.
Fixes the issue reported at
https://github.com/systemd/systemd/pull/30809#issuecomment-
1880102804.
Mike Yuan [Fri, 5 Jan 2024 17:47:20 +0000 (01:47 +0800)]
logind: don't use assertion for deserialized_pid
Follow-up for
9d5b6901007e6717c6a37c49eb73bc0260e93893
Otherwise if session_load() went wrong, and we got pidfd
from fdstore, the assertion is triggered.
Frantisek Sumsal [Sat, 6 Jan 2024 10:45:23 +0000 (11:45 +0100)]
test: sync the "foobaz" namespace as well
Otherwise we might be too fast, resulting in failed namespace check
later:
[ 7.351453] testsuite-44.sh[401]: + journalctl --list-namespaces
[ 7.351784] testsuite-44.sh[402]: + grep foobar
[ 7.358851] testsuite-44.sh[402]: foobar
[ 7.359598] testsuite-44.sh[403]: + journalctl --list-namespaces
[ 7.359974] testsuite-44.sh[404]: + grep foobaz
[ 7.369882] systemd[1]: testsuite-44.service: Failed with result 'exit-code'.
Follow-up for
68f66a1713.
Vladimir Stoiakin [Sat, 6 Jan 2024 13:59:56 +0000 (16:59 +0300)]
TEST-24-CRYPTSETUP: depend on OpenSSL for testing PKCS#11 tokens
Frantisek Sumsal [Sat, 6 Jan 2024 15:07:42 +0000 (16:07 +0100)]
repart: don't crash when looping over dropped partitions
Properly skip over dropped partitions and make sure they don't affect
the final graphical output (for example by leaving empty "spaces" where
their definition file name would otherwise be).
Resolves: #30742
Yu Watanabe [Sat, 6 Jan 2024 20:26:06 +0000 (05:26 +0900)]
Merge pull request #30803 from yuwata/network-route-parser-trivial-cleanups
network/route: trivial cleanups for conf parsers
Yu Watanabe [Thu, 4 Jan 2024 16:58:01 +0000 (01:58 +0900)]
network/link: always join to the main interface when we receive IFLA_MASTER attribute
Otherwise, e.g. when we enumerate a bridge port first, then the bridge
main interface, then the port cannot be managed by the main interface.
Fixes #30682.
Frantisek Sumsal [Sat, 6 Jan 2024 12:57:09 +0000 (13:57 +0100)]
test: reinitialize arg_transport before parsing arguments
Since libfuzzer feeds a single fuzzing process with multiple inputs, we
might carry over arg_transport from a previous invocation, tripping over
the assert in acquire_bus():
+----------------------------------------Release Build Stacktrace----------------------------------------+
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Aborting.
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2739==ERROR: AddressSanitizer: ABRT on unknown address 0x00000ab3 (pc 0xf7f52509 bp 0xffdf74cc sp 0xffdf74b0 T0)
SCARINESS: 10 (signal)
#0 0xf7f52509 in linux-gate.so.1
#1 0xf703b415 in raise
#2 0xf70233f6 in abort
#3 0xf772ac0a in log_assert_failed systemd/src/basic/log.c:968:9
#4 0xf77300d5 in log_assert_failed_return systemd/src/basic/log.c:987:17
#5 0xf7432bbf in bus_connect_transport systemd/src/shared/bus-util.c:284:9
#6 0x818cd17 in acquire_bus systemd/src/systemctl/systemctl-util.c:53:29
#7 0x815fd3c in help_boot_loader_entry systemd/src/systemctl/systemctl-logind.c:431:13
#8 0x819ca87 in systemctl_parse_argv systemd/src/systemctl/systemctl.c:863:37
#9 0x8197632 in systemctl_dispatch_parse_argv systemd/src/systemctl/systemctl.c:1137:16
#10 0x813328d in LLVMFuzzerTestOneInput systemd/src/systemctl/fuzz-systemctl-parse-argv.c:54:13
#11 0x81bbe7e in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned int) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
#12 0x81bb5b8 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned int, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
#13 0x81bd42d in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
#14 0x81bd62e in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
#15 0x81ac84c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned int)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
#16 0x81d65c7 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#17 0xf7024ed4 in __libc_start_main
#18 0x806bdb5 in _start
Resolves: #30802
Mike Yuan [Sat, 6 Jan 2024 17:46:09 +0000 (01:46 +0800)]
TODO: drop some implemented entries
Yu Watanabe [Fri, 5 Jan 2024 20:36:48 +0000 (05:36 +0900)]
network/route-metric: unify error messages
Yu Watanabe [Sat, 6 Jan 2024 04:07:11 +0000 (13:07 +0900)]
network/route-metric: pass attribute type to conf parsers
The passed attribute type will be used later.
This also
- rename conf parsers,
- sort gperf entries by the attr type.
No functional change, just refactoring and preparation for later commits.
Yu Watanabe [Fri, 5 Jan 2024 20:08:40 +0000 (05:08 +0900)]
network/route: move several conf parsers to networkd-route-metric.c and networkd-route-nexthop.c
This also split config_parse_route_boolean() into two:
for GatewayOnline= and boolean route metrics.
No functional change, just refactoring and preparation for later commits.
Yu Watanabe [Fri, 5 Jan 2024 19:44:40 +0000 (04:44 +0900)]
network/route: rename n -> route in conf parsers
Yu Watanabe [Fri, 5 Jan 2024 20:23:06 +0000 (05:23 +0900)]
network/route: do not invalidate [Route] section when an empty string is assigned to MultiPathRoute=
Frantisek Sumsal [Sat, 6 Jan 2024 10:26:39 +0000 (11:26 +0100)]
Merge pull request #30801 from yuwata/test-network-cleanups
test-network: several cleanups
Yu Watanabe [Sat, 6 Jan 2024 03:42:02 +0000 (12:42 +0900)]
test-network: do not call networkctl if networkd is in failed state
Otherwise, networkd may be restarted by DBus and we may get wrong
results.
Yu Watanabe [Sat, 6 Jan 2024 03:33:09 +0000 (12:33 +0900)]
test-network: introduce networkctl() and friends
Yu Watanabe [Sat, 6 Jan 2024 02:32:03 +0000 (11:32 +0900)]
test-network: use read_networkd_log() at one more place
Yu Watanabe [Sat, 6 Jan 2024 02:29:01 +0000 (11:29 +0900)]
test-network: sync journal before read
Otherwise, test cases that check journal entries, e.g. test_unit_file()
may fail.
Lennart Poettering [Fri, 5 Jan 2024 15:41:24 +0000 (16:41 +0100)]
nspawn: lock down access to notify socket a bit
On Linux only the "w" access bit is necessary to connect to an AF_UNIX
socket, hence let's only set that and nothing else, to limit exposure.
Just paranoia.
Frantisek Sumsal [Fri, 5 Jan 2024 19:39:40 +0000 (20:39 +0100)]
core: escape spaces in paths during serialization
Otherwise we split them incorrectly when deserializing them.
Resolves: #30747
Yu Watanabe [Sat, 6 Jan 2024 02:16:19 +0000 (11:16 +0900)]
Merge pull request #30794 from poettering/parse-vsock-better
socket-util: add more careful parsers for AF_VSOCK cid/port
Yu Watanabe [Fri, 5 Jan 2024 18:27:07 +0000 (03:27 +0900)]
udevadm: allow to override the default log level by environment variable
Previously, there was no way to override the log level for test and
test-builtin commands. Let's re-parse environment after setting the log
level to debug. Then, we can control the log level through environment
variable.
Yu Watanabe [Fri, 5 Jan 2024 23:30:31 +0000 (08:30 +0900)]
Merge pull request #30796 from mrc0mmand/journalctl-namespaces
journalctl: provide shell completion for --namespace=
Lennart Poettering [Fri, 5 Jan 2024 15:35:35 +0000 (16:35 +0100)]
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()
Yu Watanabe [Fri, 5 Jan 2024 23:27:35 +0000 (08:27 +0900)]
Merge pull request #30775 from yuwata/network-nexthop-is-ready
network: introduce nexthop_is_ready() helper function and use it
networkException [Thu, 4 Jan 2024 17:45:25 +0000 (18:45 +0100)]
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.
Lennart Poettering [Fri, 5 Jan 2024 21:37:29 +0000 (22:37 +0100)]
Merge pull request #30791 from poettering/nspawn-restrict-run-host
nspawn: make some files we expose in /run/host/ in nspawn read-only via access mode
Lennart Poettering [Fri, 5 Jan 2024 15:40:45 +0000 (16:40 +0100)]
nspawn: add new common make_run_host() helper
This new helper creates the /run/host/ top-level dir inside the
container.
Lennart Poettering [Fri, 5 Jan 2024 15:32:59 +0000 (16:32 +0100)]
socket-util: add more careful parsers for AF_VSOCK cid/port
Let's handle the magic CIDs, and filter out invalid ports.
Lennart Poettering [Fri, 5 Jan 2024 21:29:15 +0000 (22:29 +0100)]
missing: add a bunch of vsock related defines
Yu Watanabe [Fri, 5 Jan 2024 19:26:38 +0000 (04:26 +0900)]
Merge pull request #30790 from poettering/null-creds-allow-with-tpm
creds: allow using NULL encryption if explicitly requested even if TPM is available, and add a comprehensive credential encryption/decrpytion test
Frantisek Sumsal [Fri, 5 Jan 2024 17:58:43 +0000 (18:58 +0100)]
shell-completion: provide completion for journalctl --namespace=
Resolves: #30381
Frantisek Sumsal [Fri, 5 Jan 2024 17:58:26 +0000 (18:58 +0100)]
shell-completion: fix mixed indent
Frantisek Sumsal [Fri, 5 Jan 2024 17:06:08 +0000 (18:06 +0100)]
journalctl: implement --list-namespaces
Apart from being useful on its own, this will be used in the following
commit for shell completions.
Lennart Poettering [Fri, 5 Jan 2024 15:42:46 +0000 (16:42 +0100)]
nspawn: set read-only access mode on two /run/host/ files
The diectory is mounted read-only anyway, hence this doesn't do much,
but let's lock this down on every level we can.
Lennart Poettering [Fri, 5 Jan 2024 15:31:55 +0000 (16:31 +0100)]
fileio: add new flag WRITE_STRING_FILE_MODE_0444
With this write_string_file() will create the file with 0444 access mode
(i.e. read-only).
Lennart Poettering [Tue, 21 Nov 2023 13:17:31 +0000 (14:17 +0100)]
test: add credential encryption/decryption test
Lennart Poettering [Mon, 20 Nov 2023 17:00:35 +0000 (18:00 +0100)]
creds-util: optionally, allow NULL credentials even with TPM
Lennart Poettering [Fri, 5 Jan 2024 13:45:15 +0000 (14:45 +0100)]
Merge pull request #30754 from poettering/iovecification
tpm2-util: convert various things over to struct iovec rather that data ptr + size
Lennart Poettering [Fri, 5 Jan 2024 13:44:59 +0000 (14:44 +0100)]
Merge pull request #30784 from poettering/json-dispatch-enum
json: add macro for automatically defining a dispatcher for an enum
Lennart Poettering [Fri, 5 Jan 2024 13:44:50 +0000 (14:44 +0100)]
Merge pull request #30785 from poettering/json-allow-extensions
json: add flag for allowing extension of json objects when dispatching, without otherwise being permissive
Yu Watanabe [Fri, 5 Jan 2024 09:53:56 +0000 (18:53 +0900)]
test: wait for verbose-success.service finished
Otherwise, the command 'echo' may not be invoked yet.
Follow-up for
25aa35d465cf4725bc3ebd2a919e7f39ecafb920.
Lennart Poettering [Fri, 5 Jan 2024 11:39:28 +0000 (12:39 +0100)]
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.
Lennart Poettering [Mon, 4 Dec 2023 17:10:02 +0000 (18:10 +0100)]
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).