Commit Graph

1495 Commits

Author SHA1 Message Date
David Tardon
192a452d1c nspawn: pass the right error variable 2024-05-07 14:02:08 +02:00
Lennart Poettering
d4ffb37bb1 nspawn, vmspawn, run0: add env var for turning off background tinting
Some people are just sad, sad lost souls who don't like even the tiniest
ray of color in their life. Let's add an env var knob for allowing them
to turn the background tinting off, to drive the last bit of color from
their life so that they can stay in their grey grey life.
2024-05-02 23:33:39 +02:00
Lennart Poettering
61ab5ddcdc tree-wide: fix type confusion around parsing JSON booleans
Sometimes we store them in a tristate, sometimes in C stdbool booleans.
Sometimes we fucked up picking the right parsing function however. Fix
that.
2024-05-02 19:31:08 +02:00
Yu Watanabe
4e494e6aac tree-wise: several cleanups for logging
- drop unnecessary SYNTHETIC_ERRNO() when the logger does not propagate
  error code,
- drop unnecessary '%m' in error message when the error code is
  specified with SYNTHETIC_ERRNO(),
- add missing full stop at the end of log message,
- use RET_GATHER(),
- add missing ", ignoring.",
- upeercase the first letter, etc., etc...
2024-05-01 04:41:06 +09:00
Dmitry V. Levin
c309b9e9c3 treewide: fix a few typos in NEWS, docs, comments, and log messages 2024-04-27 12:11:13 +02:00
Daan De Meyer
aa976d8788 tree-wide: Use log_setup() everywhere
Otherwise the default log target is the console and we won't use
the journal socket even if it is available.
2024-04-25 17:06:43 +02:00
Mike Yuan
9d43e0335f nspawn: fix typo
Follow-up for edd3d4d7c2
2024-04-22 23:00:22 +08:00
Luca Boccassi
edd3d4d7c2 nspawn: ensure single-process container running as --user can access credentials
When starting a container with --user, the new uid will be resolved and switched to
only in the inner child, at the end of the setup, by spawning getent. But the
credentials are set up in the outer child, long before the user is resolvable,
and the directories/files are made only readable by root and read-only, which
means they cannot be changed later and made visible to the user.

When this particular combination is specified, it is obvious the caller wants
the single-process container to be able to use credentials, so make them world
readable only in that specific case.

Fixes https://github.com/systemd/systemd/issues/31794
2024-04-22 15:47:44 +02:00
Yu Watanabe
6d06b76710 nspawn: rename config_parse_timezone() -> config_parse_timezone_mode()
The parser does not parse timezone, but timezone mode. Let's rename the
parser to more specific name.
2024-04-19 10:23:01 +09:00
Yu Watanabe
760c2724a3 nspawn: align tables 2024-04-19 10:23:00 +09:00
Sam Leonard
c50e7dcaf6 nspawn,shared/netif-util: move generate_mac and shorten_ifname to shared/netif-util 2024-04-15 11:42:05 +01:00
Frantisek Sumsal
edda10f2ae tree-wide: make sure net/if.h is included before any linux/ header
The linux/ headers include linux/libc-compat.h that makes sure the
linux/ headers won't redeclare symbols already declared by net/if.h, but
glibc's net/if.h doesn't do that, so if the include order is reversed
we'll end up with a bunch of errors about redeclared stuff:

[3/519] Compiling C object test-network-tables.p/src_network_test-network-tables.c.o
FAILED: test-network-tables.p/src_network_test-network-tables.c.o
cc -Itest-network-tables.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -Isrc/libsystemd-network -I../src/libsystemd-network -Isrc/network -I../src/network -I../src/network/netdev -I../src/network/tc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -DTEST_CODE=1 -MD -MQ test-network-tables.p/src_network_test-network-tables.c.o -MF test-network-tables.p/src_network_test-network-tables.c.o.d -o test-network-tables.p/src_network_test-network-tables.c.o -c ../src/network/test-network-tables.c
In file included from ../src/basic/linux/if_bonding.h:47,
                 from ../src/network/netdev/bond.h:5,
                 from ../src/network/test-network-tables.c:3:
../src/basic/linux/if.h:111:41: error: redeclaration of enumerator ‘IFF_UP’
  111 | #define IFF_UP                          IFF_UP
      |                                         ^~~~~~
../src/basic/linux/if.h:84:9: note: previous definition of ‘IFF_UP’ with type ‘enum net_device_flags’
   84 |         IFF_UP                          = 1<<0,  /* sysfs */
      |         ^~~~~~
../src/basic/linux/if.h:112:41: error: redeclaration of enumerator ‘IFF_BROADCAST’
  112 | #define IFF_BROADCAST                   IFF_BROADCAST
      |                                         ^~~~~~~~~~~~~
...

This also drops remaining workarounds from the last time this issue was
brought up (6f270e6bd8) since they shouldn't be needed anymore if the
order of the includes is the "correct" one. I also added a comment to
each affected include when this is inevitably encountered again in the
future.

Resolves: #32160
2024-04-09 21:19:15 +02:00
Yu Watanabe
693a28d748 nspawn: fix typo
Follow-up for 0af7e29434.
2024-04-08 09:12:08 +09:00
Lennart Poettering
0af7e29434 nspawn: make nspawn work without privileges 2024-04-06 16:08:24 +02:00
Yu Watanabe
54e6172550 tree-wide: use device_is_processed() more 2024-04-05 01:49:20 +09:00
Mike Yuan
8e1a1caa9c Merge pull request #31886 from DaanDeMeyer/logind
logind: Add fallback for when the PIDFDs= property is not available
2024-03-24 19:19:12 +08:00
Daan De Meyer
66b574b0a2 tree-wide: Add allow_pidfd argument to bus_append_scope_pidref() 2024-03-22 17:03:35 +01:00
Daan De Meyer
50814ebede nspawn: Use dissect_image_mount_and_warn() 2024-03-22 10:48:46 +01:00
Lennart Poettering
e6ceea090a nspawn: add some debug logging for sd_notify() messages received by the container manager 2024-03-14 17:24:20 +01:00
Mike Yuan
4f49512695 extract-word: modernize extract_many_words 2024-03-03 19:01:00 +08:00
Lennart Poettering
f4a63ce25f dissect-image: add flag for explicitly enabling userspace verity signature checking
let's make userspace verity signature checking optional. This adds a
dissection flag to enable the logic and patches through all our users to
enable it by default, thus effectively not changing anything from the
status quo ante. However, know we have a knob to turn this off in
certain scenarios.
2024-02-28 16:17:40 +01:00
Lennart Poettering
29eddf0ea4 nspawn: minor coding style tweaks to nspawn-register.c 2024-02-28 11:07:58 +01:00
Lennart Poettering
b4679016f3 nspawn: hide ^] hint unless we are interactive mode
The hotkey only works in interactive mode hence don't mislead users
about it.
2024-02-26 11:55:11 +01:00
Lennart Poettering
d4ece77f5e ptyfwd: optionally prefix window title with colored dot
in uid0/systemd-run/nspawn we already set a window title with a colorful
unicode dot indicating the changed privileges/execution context. This typically
gets overriden by the shell inside the environment however.

Let's tweak this a bit: when we see the window title OSC ANSI sequence
passing through, let's patch in the unicode dot as a prefix to the
title.

This is super pretty, since it makes sure root sessions via 0ad are
really easily recognizable as such, because the window title carries an
🔴 red dot as prefix then.
2024-02-23 21:15:25 +00:00
Lennart Poettering
db7136ec73 signal-util: imply sentinel -1 in sigprocmask_many() + sigset_add_many() args list 2024-02-23 09:35:12 -08:00