1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00
Commit Graph

51245 Commits

Author SHA1 Message Date
Lennart Poettering
22326f15a6 man: document new nspawn ID mapping mounts features 2021-05-07 22:44:17 +02:00
Lennart Poettering
f61c7f88d0 nspawn: introduce --private-users-ownership=map|auto
This adds a two new values to --private-users-ownership=: "map" and
"auto".

"map" exposes the kernel 5.12 idmap feature pretty much 1:1. It fails if
the kernel or used file system doesn't support ID mapping.

"auto" is a bit smarter: if we can make ID mapping work, we'll use it,
otherwise revert back to classic chown()ing. We'll also use chown()ing
if we detect that an image is already ID shifted, both to increase
compatibility with the status quo ante, and to simplify our codepaths,
since the mappings become a lot simpler if we only have to map from zero
to something else, instead of from anything to anything else.

The short -U switch, and --private-users=pick will now imply
--private-users-ownership=auto instead of
--private-users-ownership=chown, since the new logic should be the much
better choice.
2021-05-07 22:44:13 +02:00
Lennart Poettering
993da6d461 nspawn: drop an unnecessary local variable 2021-05-07 22:44:10 +02:00
Lennart Poettering
21b61b1dd2 dissect-image: add support for optionally mounting images with idmapping on 2021-05-07 22:44:05 +02:00
Lennart Poettering
35fd355842 mount-util: add a helper that can add an idmap to an existing mount
This makes use of the new kernel 5.12 APIs to add an idmap to a mount
point. It does so by cloning the mountpoint, changing it, and then
unmounting the old mountpoint, replacing it later with the new one.
2021-05-07 22:43:52 +02:00
Lennart Poettering
58e13de539 nspawn: tighten userns UID shift/range checks
Let's add a helper that ensures the UID shift/range parameters actually
fit together.
2021-05-07 22:43:48 +02:00
Lennart Poettering
5f9687363a process-util: add option for cloning with CLONE_NEWUSER
This is useful for allocating a userns fd later on for use in idmapped
mounts.
2021-05-07 22:43:42 +02:00
Lennart Poettering
14a25e1fae mount-util: add helper that ensures something is a mount point 2021-05-07 22:43:29 +02:00
Lennart Poettering
6c045a9998 nspawn: replace boolean --private-user-chown by enum
This replaces --private-user-chown by an enum value
--private-user-ownership=off|chown. Changes otherwise very little.

This is mostly preparation for a follow-up commit adding a new "map"
mode, using kernel 5.12 UID mapping mounts.

Note that this does alter codeflow a bit: the new enum already knows
three different values instead of the old true/false pair. Besides "off"
and "chown" it knows -EINVAL, i.e. whenever the value wsn't set
explicitly. This value is changed to "off" or "chown" before use, thus
retaining compat to the status quo before, except it won't override
explicit configuration anymore. Thus, if you explicitly request
--private-user=pick you can now combine it wiht an explicit
--private-user-ownership=off if you like, which will give you a
container that runs under its own UID set, but the files will be owned
by the original image. Makes not much sense besids maybe debugging, but
if requested explicitly I think it's OK to implement.
2021-05-07 22:43:25 +02:00
Lennart Poettering
33eac552ab nspawn: add high-level option for identity userns mapping
userns identity 1:1 mapping is a pretty useful concept since it isolates
capability sets between containers and hosts, even if it doesn't map
any uid ranges. Let's support it with an explicit concept.

(Note that this is identical to --private-users=0:65536 (which in turn
is identical to --private-users=0), but I think it makes to emphasize
this concept as a high-level one that makes sense to support.)
2021-05-07 22:43:05 +02:00
Luca Boccassi
8f214355c6 FIDO2: if defined, check for FIDO_ERR_UV_BLOCKED
Newer libfido versions added this error, so check for it since it
can help the user with a more specific message
2021-05-07 21:36:27 +01:00
Luca Boccassi
896cc0da98 FIDO2: ask and record whether user verification was used to lock the volume
Some tokens support authorization via fingerprint or other biometric
ID. Add support for "user verification" to cryptenroll and cryptsetup.
Disable by default, as it is still quite uncommon.
2021-05-07 21:36:27 +01:00
Luca Boccassi
06f087192d FIDO2: ask and record whether user presence was used to lock the volume
In some cases user presence might not be required to get _a_
secret out of a FIDO2 device, but it might be required to
the get actual secret that was used to lock the volume.
Record whether we used it in the LUKS header JSON metadata.
Let the cryptenroll user ask for the feature, but bail out if it is
required by the token and the user disabled it.
Enabled by default.
2021-05-07 21:36:27 +01:00
Luca Boccassi
cde2f8605e FIDO2: support pin-less LUKS enroll/unlock
Closes: https://github.com/systemd/systemd/issues/19246

Some FIDO2 devices allow the user to choose whether to use a PIN or not
and will HMAC with a different secret depending on the choice.
Some other devices (or some device-specific configuration) can instead
make it mandatory.
Allow the cryptenroll user to choose whether to use a PIN or not, but
fail immediately if it is a hard requirement.
Record the choice in the JSON-encoded LUKS header metadata so that the
right set of options can be used on unlock.
2021-05-07 21:36:27 +01:00
Luca Boccassi
cd5f57bda7 cryptsetup: add 'headless' parameter to skip password/pin query
On headless setups, in case other methods fail, asking for a password/pin
is not useful as there are no users on the terminal, and generates
unwanted noise. Add a parameter to /etc/crypttab to skip it.
2021-05-07 21:36:27 +01:00
Lennart Poettering
134ff8f4d1 userdbd: simplify logic for generating NSS listings
So far we basically had two ways to iterate through NSS records: one via
the varlink IPC and one via the userdb.[ch] infra, with slightly
different implementations.

Let's clean this up, and always use userdb.[ch] also when resolving via
userdbd. The different codepaths for the NameServiceSwitch and the
Multiplexer varlink service now differ only in the different flags
passed to the userdb lookup.

Behaviour shouldn't change by this. This is mostly refactoring, reducing
redundant codepaths.
2021-05-07 22:19:41 +02:00
Lennart Poettering
b214825433 userdb: add new flag for excluding varlink data in lookups
This is useful to later-on use the userdb infra for only some sources.
2021-05-07 22:19:37 +02:00
Lennart Poettering
80d88a8267 userdb: rename userdb lookup flags a bit
Let's use "exclude" for flags that really exclude records from our
lookup. Let's use "avoid" referring to concepts that when flag is set
we'll not use but we have a fallback path for that should yield the same
result. Let' use "suppress" for suppressing partial info, even if we
return the record otherwise.

So far we used "avoid" for all these cases, which was confusing.

Whiel we are at it, let's reassign the bits a bit, leaving some space
for bits follow-up commits are going to add.
2021-05-07 22:19:07 +02:00
Marco Antonio Mauro
0cd70d43a3
Added Teclast X4 ACCEL_MOUNT_MATRIX (#19540) 2021-05-07 22:17:25 +02:00
Yu Watanabe
7971f9030a string-util: fix build error on aarch64
This fixes the following error:
```
In file included from ../src/basic/af-list.h:6,
                 from ../src/basic/af-list.c:7:
../src/basic/string-util.h: In function 'char_is_cc':
../src/basic/string-util.h:133:19: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  133 |         return (p >= 0 && p < ' ') || p == 127;
      |                   ^~
cc1: all warnings being treated as errors
```

Fixes #19543.
2021-05-07 21:55:55 +02:00
Frantisek Sumsal
f2ef6d98e6 test: fix partition check in TEST-58-REPART
Follow-up to 1c41c1dc34.
2021-05-07 21:17:22 +02:00
Lennart Poettering
37ef2fc9f7
Merge pull request #18863 from keszybz/cmdline-escaping
Escape command lines properly
2021-05-07 17:29:39 +02:00
Zbigniew Jędrzejewski-Szmek
d0f14a6cf4
Merge pull request #19134 from poettering/outbound-special-hostname
introduce a new synthetic hostname "_outbound" that maps to "the" local IP address
2021-05-07 17:15:22 +02:00
Lennart Poettering
2d882d3581 nss-systemd: make llvm work-around for used _cleanup_ explicit 2021-05-07 16:44:03 +02:00
Lennart Poettering
bbfb8c878c userdbd: reverse which path is a socket and which a symlink
userdbd listens on "two" sockets, that are actually the same: one is a
real AF_UNIX socket in the fs, and the other is a symlink to it.

So far, when userdbd was started from the command line it would make one
a symlink and the other a real socket, but when invoked via unit files
they'd be swapped, i.e. the other would be a symlink and the one a real
socket.

Let's bring this in line.

Since the "io.systemd.Multiplexer" is our main interface, let's make it
the one exposed as socket, and then make "io.systemd.NameServiceSwitch"
a symlink to it. Or in other words, let's adjust the C code to match the
unit file.
2021-05-07 16:43:43 +02:00
Lennart Poettering
2708160ccd fileio: optionally, return discovered path of file in search_and_fopen() 2021-05-07 16:43:26 +02:00
Dimitri John Ledkov
9137c03c04
boot: add optional EFI SBAT support
Add SBAT support, when -Dsbat-distro value is specified. One can use
-Dsbat-distro=auto for autodetection of all sbat options. Many meson configure
options added to customize SBAT CSV values, but sensible defaults are auto
detected by default. SBAT support is required if shim v15+ is used to load
systemd-boot binary or kernel.efi (Type II BootLoaderSpec).

Fixes #19247
2021-05-07 14:38:48 +01:00
Zbigniew Jędrzejewski-Szmek
ac2c088939
Merge pull request #19391 from poettering/dissect-grow
optionally, grow file systems to partition size when mounting them via GPT auto-discovery
2021-05-07 15:04:55 +02:00
Lennart Poettering
2a9cfe6b07
Merge pull request #19531 from poettering/nss-systemd-fixes
nss-systemd: two minor fixes
2021-05-07 11:15:53 +02:00
Lennart Poettering
a1aa41e4e1 nss-systemd: properly handle empty membership lists
When we are queried for membership lists on a system that has exactly
zero, then we'll return ESRCH immediately instead of at EOF. Which is
OK, but we need to handle this in various places, and not get confused
by it.
2021-05-07 09:15:40 +02:00
Lennart Poettering
e9b88a6d4e string-util: add strextendf() helper, that allows extending some allocated string via a format string
It's not going to be efficient if called in inner loops, but it's oh so
handy, and we have some code that does this:

   asprintf(&p, "%s…", b, …);
   free(b);
   b = TAKE_PTR(p);

which can now be replaced by the quicker and easier to read:

   strextendf(&p, "…", …);
2021-05-07 09:10:59 +02:00
Lennart Poettering
db1ce3ea1a nspawn: fix the sections .nspawn settings are placed in
The actual section names are quite different from what the comment so
far suggested. Fix that.
2021-05-07 05:57:30 +09:00
Lennart Poettering
1fdfca4da7 nss-systemd: reset the right field 2021-05-06 22:35:49 +02:00
Lennart Poettering
5b235f0df5
Merge pull request #19523 from bluca/coredump_meta_fixes
docs/COREDUMP_PACKAGE_METADATA.md: Add debuginfod key
2021-05-06 22:34:53 +02:00
Lennart Poettering
53c25ac968 user-util: add generic definition for special password hash values in /etc/passwd + /etc/shadow
Let's add three defines for the 3 special cases of passwords.

Some of our tools used different values for the "locked"/"invalid" case,
let's settle on using "!*" which means the password is both locked *and*
invalid.

Other tools like to use "!!" for this case, which however is less than
ideal I think, since the this could also be a considered an entry with
an empty password, that can be enabled again by unlocking it twice.
2021-05-06 21:55:58 +02:00
Mike Kazantsev
a7bd1656f3 Fix indent prefix being used as a suffix in systemd-analyze dump for some properties 2021-05-06 21:55:35 +02:00
Lennart Poettering
cf38805567
Merge pull request #19527 from poettering/userdb-fixes
various minor userdb fixes
2021-05-06 21:54:42 +02:00
Lennart Poettering
7c67419117 userdb: honour USERDB_AVOID_SHADOW flag also when iterating 2021-05-06 18:36:32 +02:00
Lennart Poettering
d9f5f2a12c userdb: fix typo in comment 2021-05-06 18:36:32 +02:00
Lennart Poettering
d4f560df4f userdb: add missing 'else' 2021-05-06 18:36:32 +02:00
Lennart Poettering
77fe7d1593 userdb: remove unnecesary repeated if check 2021-05-06 18:36:32 +02:00
Lennart Poettering
27a5a22f03 userdb: count NSS records too 2021-05-06 18:36:32 +02:00
Luca Boccassi
201962ef46 docs/COREDUMP_PACKAGE_METADATA.md: add table with well-known keys and their definition 2021-05-06 16:58:43 +01:00
Dimitri John Ledkov
e706aaa7a3 boot/efi: add ARM (THUMB) and RISCV64 machine types
Also drop defines from shared/pe-header.h, appear to be unused.
2021-05-06 15:16:29 +02:00
Mark Wielaard
4f90b052e5 docs/COREDUMP_PACKAGE_METADATA.md: Add debuginfod key
Signed-off-by: Mark Wielaard <mark@klomp.org>
2021-05-06 13:50:21 +01:00
Yu Watanabe
a83a7d1e9e test: drop default ACL from $TESTDIR
This fixes an issue introduced by the commit 954c77c251.

For some reasons, setting default ACL on $TESTDIR makes TEST-29-PORTABLE
fail. Let's drop the default ACL, and set ACL on saved results instead.

Fixes #19519.
2021-05-06 11:28:00 +02:00
Yu Watanabe
853401a6bc test: increase image size when static library or standalone binaries are installed 2021-05-06 11:28:00 +02:00
howl
84e492cdba Unify pn81H3 and cvrLenovoideapadD330-10IGM
D330-10IGM has been added due the fact that 81H3 and 81MD product name belongs to the same product version. So the fact is that now that we know 81MD has the same transformation matrix that the 81H3 we can just use the product version and get rid the product name.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
2021-05-06 11:13:48 +02:00
Phaedrus Leeds
00473ac804 docs: Fix typos in PORTABLE_SERVICES.md 2021-05-06 16:01:23 +09:00
Yu Watanabe
3d396b2837 test: drop log_trace() in test-random-util
It provides almost no inoformation. Moreover, it massively increases
logs, and firefox cannot show the results of Ubuntu CIs due to this.
2021-05-06 12:46:31 +09:00