1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

48918 Commits

Author SHA1 Message Date
Susant Sahani
faa7e5a43b Journal: Use hashmap_ensure_put 2021-01-20 15:08:30 +01:00
Dan Streetman
23afa884d4 udev: use DEFINE_MAIN_FUNCTION in cdrom_id
This was failing s390x ubuntu ci due to an old version of binutils;
the binutils package in use for ubuntu ci tests has been updated and
the build no longer fails, so this can use the macro again.

Fixes: #18165
2021-01-20 08:31:47 +00:00
Lennart Poettering
741bfd7f4e tree-wide: ignore messages with too long control data
Apparently SELinux inserts control data into AF_UNIX datagrams where we
don't expect it, thus miscalculating the control data. This looks like
something to fix in SELinux, but we still should handle this gracefully
and just drop the offending datagram and continue.

recvmsg_safe() actually already drops the datagram, it's just a matter
of actually ignoring EXFULL (which it generates if control data is too
large) in the right places.

This does this wherever an AF_UNIX/SOCK_DGRAM socket is used with
recvmsg_safe() that is not just internal communication.

Fixes: #17795
Follow-up for: 3691bcf3c5
2021-01-20 14:05:45 +09:00
Zbigniew Jędrzejewski-Szmek
6eab0c6dba Revert "test-functions: make sure we test our own libudev instead of the host libudev"
This reverts commit 73484ecff9.

3976f372ae moved libudev.so to be built in the
main directory, so this addition to $LD_LIBRARY_PATH is now obsolete.

After that commit, we build the following shared libraries:

build/libnss_myhostname.so.2
build/libnss_mymachines.so.2
build/libnss_resolve.so.2
build/libnss_systemd.so.2
build/libsystemd.so.0.30.0
build/libudev.so.1.7.0
build/pam_systemd.so
build/pam_systemd_home.so
build/src/boot/efi/stub.so
build/src/boot/efi/systemd_boot.so
build/src/shared/libsystemd-shared-247.so

EFI stubs don't matter, and libsystemd-shared-nnn.so is loaded through rpath,
and is doesn't need to and shouldn't be in $LD_LIBRARY_PATH. In effect, we only
ever need to add the main build directory to the search path.
2021-01-20 14:04:52 +09:00
Lennart Poettering
e327382877 markdown: fix comment
Follow-up for 2d816c9804
2021-01-19 22:26:35 +01:00
Lennart Poettering
2d816c9804 markdown: suggest backticks around uname -a output
Fixes: #18238
2021-01-19 22:24:05 +01:00
Lennart Poettering
a631cbfae3 execute: for processes where creds logic is turned off, don't pass creds path to namespace logic
Otherwise, the namespace logic will try to mount a dir that doesn't
actually exist.

Fixes: #18116
2021-01-19 20:03:42 +01:00
Lennart Poettering
f6c9a7ab93
Merge pull request #18307 from poettering/import-verity-download
importd: when downloading raw image, also download .roothash.p7s and .verity along with it
2021-01-19 20:02:34 +01:00
Lennart Poettering
ac71ece3c6 import: refactor how we do gpg validation
Let's split out the actual gpg logic into a helper function, so that we
can add alternative validations later on.
2021-01-19 18:29:59 +01:00
Lennart Poettering
133b34f69a import: optionally pull .verity + .roothash.p7s data when downloading
We already had support for downlading a .nspawn and a .roothash file,
let's make the set complete, and also download .verity + roothash.p7s if
it exists, as nspawn consumes that.

Since there are now four kinds of additional resources to acquire, let's
introduce a PullFlags flags value for this instead of separate 'bool'
variables, it's just too many to always pass those around on the
function parameter list.
2021-01-19 18:29:59 +01:00
Lennart Poettering
6792cbbcf8 import: ignore non-successful HTTP codes for collecing image metadata
Previously we'd collect the data from redirects too, which wasn't
particularly terrible, since these typically don't carry the data we
were interested in, but it's still incorrect to do so.
2021-01-19 18:29:59 +01:00
Lennart Poettering
8dc0291c0d import: turn on HTTP logging in debug mode 2021-01-19 18:29:59 +01:00
Lennart Poettering
273cb07d1b import: small memory management simplification 2021-01-19 18:29:59 +01:00
Lennart Poettering
8bc3f0b89f import: reset PullJob properly
Properly reset all fields that have to do with the current GET job when
we restart things. Previously we freed/reset only some stuff, leaking
some memory even.
2021-01-19 18:29:59 +01:00
Lennart Poettering
f14717a7e2 import: rework how verification works
Previously the PullJob object took internal care of rerequested the
SHA256SUMS file, if requesting <image>.sha256 didn't work. This was a
weird a non-abstraction only used when actually getting the checksum
files.

Let's move this out of the PullJob, so that it is generic again, and
does roughly the same stuff for all resources it is used for: let's
define a generic .on_not_found() handler that can be set on a PullJob
object, and is called whenever with see HTTP 404, and may be used to
provide a new URL to try if the first didn't work.

This is also preparation for later work to support PKCS#7 signatures
instead of gpg signatures, where a similar logic is needed, and we thus
should have a generic infrastructure place.

This gets rid of the VerificationStyle field in the PullJob object:
instead of storing this non-generic field we just derive the same
information from the URL itself, which is safe, since we generated it
ourselves earlier.
2021-01-19 18:29:59 +01:00
Lennart Poettering
c20307fd34 import: use TAKE_PTR() where available 2021-01-19 18:29:59 +01:00
Lennart Poettering
c6cb8daf72 import: make scope of variable smaller 2021-01-19 18:29:59 +01:00
Lennart Poettering
7d41de2e94 import: comment indent fix 2021-01-19 18:29:59 +01:00
Lennart Poettering
63ec26a4bf fs-util/rm-rf: improve remove+free destructors to take and return NULL
Let#s make these helpers useful even without _cleanup_ logic, to destory
arbitary fields: make them OK wiht a NULL pointer as input, and always
return one as output.
2021-01-19 18:29:59 +01:00
Susant Sahani
c038ce4606 network: add support to RoutingPolicyRule lookup table name 2021-01-19 16:37:46 +00:00
Lennart Poettering
656e5aa452
Merge pull request #18181 from poettering/sysext
systemd-sysext as a method of merging simple OS extensions into /usr and /opt
2021-01-19 16:02:58 +01:00
Lennart Poettering
a2804e3cd8
Merge pull request #18129 from keszybz/envvars
Allow control characters in environment variable values
2021-01-19 16:02:27 +01:00
Florian Westphal
bf108eb942 homed: fix build without p11kit
homectl-pkcs11.c: In function 'identity_add_pkcs11_key_data':
homectl-pkcs11.c:155:13: error: implicit declaration of function 'pkcs11_acquire_certificate' [-Werror=implicit-function-declaration]

Restores the P11KIT compile-time test that was removed in 2289a78473
("homed: move pkcs11 LUKS glue into shared code").
2021-01-19 14:38:39 +01:00
Zbigniew Jędrzejewski-Szmek
e9155cd077 systemctl: warn when importing environment variables with control characters
I don't think it is useful to warn about about environemnt variables where the user
explicitly configured some value. If they went through the effort of escaping the cc
to include it in the setting (e.g. Environment="VAR=\efoo"), and we pass this through,
there isn't anything to warn about. This also applies to 'systemctl set-environment',
where the variable name and value are passed as arguments.

The only case where the warning *might* be useful is where the user might be
surprised by the value. This occurs when importing variables from the inherited
environment, i.e. in 'systemctl import-environment'. In not convinced that this is
useful, since the user better control their shell environment anyway.

$ systemctl import-environment
Calling import-environment without a list of variable names is deprecated.
Environment variable $LESS_TERMCAP_mb contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_md contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_me contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_se contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_so contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_ue contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_us contains control characters, importing anyway.
Environment variable $ZZZ contains control characters, importing anyway.
2021-01-19 14:24:51 +01:00
Zbigniew Jędrzejewski-Szmek
30927a2484 Allow control characters in environment variable values
So far, we would allow certain control characters (NL since
b4346b9a77, TAB since 6294aa76d8), but not others. Having
other control characters in environment variable *value* is expected and widely
used, for various prompts like $LESS, $LESS_TERMCAP_*, and other similar
variables. The typical environment exported by bash already contains a dozen or
so such variables, so programs need to handle them.

We handle then correctly too, for example in 'systemctl show-environment',
since 804ee07c13. But we would still disallow setting such variables
by the user, in unit file Environment= and in set-environment/import-environment
operations. This is unexpected and confusing and doesn't help with anything
because such variables are present in the environment through other means.

When printing such variables, 'show-environment' escapes all special
characters, so variables with control characters are plainly visible.
In other uses, e.g. 'cat -v' can be used in similar fashion. This would already
need to be done to suppress color codes starting with \[.

Note that we still forbid invalid utf-8 with this patch. (Control characters
are valid, since they are valid 7-bit ascii.) I'm not sure if we should do
that, but since people haven't been actually asking for invalid utf-8, and only
for control characters, and invalid utf-8 causes other issues, I think it's OK
to leave this unchanged.

Fixes #4446, https://gitlab.gnome.org/GNOME/gnome-session/-/issues/45.
2021-01-19 14:18:34 +01:00
Zbigniew Jędrzejewski-Szmek
c4899ea427 systemctl: print a warning when trying to import a nonexistent variable
I was quite confused what is happening:
$ XXX=xxx
$ systemctl --user import-environment XXX
$ systemctl --user show-environment | grep XXX
(nothing)

Obviously, 'export XXX' was missing. Without any indication why the
export is not happening, this can be hard to figure out.

Another option would be to error out. But so far we didn't, and doing
that could break some script which optimistically tries to export some
variables, if present.
2021-01-19 14:18:33 +01:00
Luca Boccassi
71ad75f306 sysext: install in /usr/lib/systemd/ for now
This is a brand new binary, and the CI packaging doesn't pick it up,
causing the upstream testrun to fail (sysext is pulled in by the unit).
2021-01-19 13:41:42 +01:00
Lennart Poettering
a1fd722b5d meson: bindir is the default install_dir, no need to mention it 2021-01-19 13:41:42 +01:00
Lennart Poettering
b5e0c17654 test: improve a log message while building test images 2021-01-19 13:41:42 +01:00
Lennart Poettering
dfbbb4f7b0 update TODO 2021-01-19 13:41:42 +01:00
Luca Boccassi
36b95d0440 man: mention SYSEXT_LEVEL in os-release(5) 2021-01-19 13:41:42 +01:00
Luca Boccassi
60bb6caaae sysext: use parse_extension_release and reject extension if not found 2021-01-19 13:41:42 +01:00
Luca Boccassi
6ddd051193 os-release: add support for /usr/lib/extension-release.d/
Add helpers to look for extension-release.$NAME files in
/usr/lib/extension-release.d/ following the same pattern as os-release.
2021-01-19 13:41:42 +01:00
Luca Boccassi
44bb7b0956 sysext: add verity boilerplate 2021-01-19 13:41:42 +01:00
Lennart Poettering
d577d4a432 machine-image: properly support searching for images below some --root= path
systemd-sysext supports --root= for everything but the image discovery.
Fix that.
2021-01-19 13:41:42 +01:00
Lennart Poettering
7a87fb6119 man: add man page for systemd-sysext 2021-01-19 13:41:42 +01:00
Lennart Poettering
205e5bcc1c units: add systemd-sysext.service unit for auto-activating extensions at boot
We'll leave this as opt-in (i.e. a unit that must be enabled
explicitly), since this is supposed to be a debug/developer feature
primarily, and thus no be around in regular production systems.
2021-01-19 13:41:42 +01:00
Lennart Poettering
9bca4ae4cd sysext: new tool for managing "system extensions" for /usr/ + /opt/ 2021-01-19 13:41:42 +01:00
Yu Watanabe
7b5ed18779
Merge pull request #18294 from ssahani/net-2
tree wide use ensure_put
2021-01-19 16:46:41 +09:00
Zbigniew Jędrzejewski-Szmek
f1fb046a98
Merge pull request #18300 from yuwata/analyze-verify-18252
analyze: resolve executable path if it is relative
2021-01-19 08:41:15 +01:00
Susant Sahani
3c29137626 udev: Use TAKE_PTR 2021-01-19 05:56:40 +01:00
Susant Sahani
f5b73a7fa8 udev-rules: Use ordered_hashmap_ensure_put 2021-01-19 05:56:31 +01:00
Susant Sahani
1dfb93210f sysusers: use ordered_hashmap_ensure_put 2021-01-19 05:56:25 +01:00
Yu Watanabe
29d65a4388
Merge pull request #18303 from yuwata/verity-cleanup
veritysetup-generator: drop unused struct and variable
2021-01-19 12:22:55 +09:00
Yu Watanabe
7e2757c42f
Merge pull request #18038 from yuwata/meson-split
meson: various cleanups
2021-01-19 12:22:34 +09:00
Yu Watanabe
4c6dd238b8
Merge pull request #18267 from lucaswerkmeister/truncate
Two StandardOutput=truncate:file improvements
2021-01-19 08:47:39 +09:00
Yu Watanabe
ceed428305
Merge pull request #18299 from ssahani/ensure-put
More use of hashmap_ensure_put and ordered_hashmap_ensure_put
2021-01-19 08:42:26 +09:00
Yu Watanabe
13a4e9f209 TODO: fix typo 2021-01-19 07:22:48 +09:00
Yu Watanabe
71ce3ba25b veritysetup-generator: drop unused struct and variable
Follow-ups for 08b04ec7e7.

This also drops unnecessary inclusion.

Fixes CID#1443889.
2021-01-19 07:21:57 +09:00
Yu Watanabe
024e9084c1 meson: move several definitions related libsystemd to src/libsystemd/meson.build 2021-01-19 07:06:32 +09:00