Commit Graph
60034 Commits
Author SHA1 Message Date
Lennart Poettering 4cebd207d1 tmpfiles: add lines for provisioning ssh keys for root by default
With this, I can now easily do:

    systemd-nspawn --load-credential=ssh.authorized_keys.root:/home/lennart/.ssh/authorized_keys --image=… --boot

To boot into an image with my SSH key copied in. Yay!
2022-09-23 09:30:00 +02:00
Lennart Poettering 27f6aa0b71 tmpfiles: rework empty_directory() to also use chase_symlinks() 2022-09-23 09:28:59 +02:00
Lennart Poettering 9e430ce3d4 tmpfiles: move symlink creation into its own function, and modernize
Let's ensure it also operates based on O_PATH, like fifo/device node/…
creation.
2022-09-23 09:27:53 +02:00
Lennart Poettering 8f6fb95cd0 tmpfiles: whenever creating an inode, immediately O_PATH open it to pin it
let's make things a bit less racy: whenever we create an inode,
immediately open it via O_PATH, compare type and continue operations
with the acquired fd.
2022-09-23 09:26:56 +02:00
Lennart Poettering 497ca785aa fs-util: add mknodat_atomic() 2022-09-23 09:25:33 +02:00
Lennart Poettering 4f477796f3 fs-util: make mkfifo_atomic() just a shortcut for mkfifoat_atomic() 2022-09-23 09:24:05 +02:00
Lennart Poettering da9dd029a2 fs-util: replace symlink_atomic() by symlinkat_atomic() 2022-09-23 09:22:36 +02:00
Lennart Poettering cc43328c7f tmpfiles: allow prefixing uid/gid/mode with ":" to only apply on creation
In some cases it is useful to specify the access mode/uid/gid for inodes
we create without also enforcing them on existing inodes. Let's add a
new flag for that: if the uid/gid/mode specificaitons are prefixed with
":", then they only apply to creation, not otherwise.

This is specifically useful for provisioning SSH keys later. Those we'd
like to provision like this:

<snip>
d /root :0700 root root -
d /root/.ssh :0700 root root -
f^ /root/.ssh/authorized_keys - - - - ssh.authorized_keys
</snip>

While /root/ + /root/.ssh/ being owned by root is pretty uncontroversial
the access mode of /root/ and /root/.ssh/ might not be. Hence we should
only have a default mode defined that is used when we create the dir,
but not otherwise.
2022-09-23 09:21:34 +02:00
Lennart Poettering a9bc518c08 tmpfiles: generalize CreationMode and pass it everywhere
For some purposes we had CreationMode which indicates whether an inode
was created by us, or is pre-existing. Let's generalize that for *all*
operations. This is later useful to conditionalize certain operations on
that (and makes the codebase more systematic)
2022-09-23 09:20:37 +02:00
Lennart Poettering c5d554aa66 tmpfiles: rebreak some comments 2022-09-23 09:19:02 +02:00
Daan De Meyer c8f38bf077 Merge pull request #24797 from yuwata/networkctl
networkctl: several table format updates
2022-09-23 08:45:47 +02:00
Yu Watanabe f8d7c0c55e networkctl: re-order entries in status command
Also fixes "Speed:" field, which may show empty value.
2022-09-23 11:20:26 +09:00
Yu Watanabe 767bc538c5 test-network: fix matching string
This partially reverts 5515f2169c.
As the commit changes 'networkctl list', not 'networkctl status'.
2022-09-23 10:43:17 +09:00
Yu Watanabe 3874765735 networkctl: use "-" for empty LLDP entries 2022-09-23 10:39:42 +09:00
Yu Watanabe 67c3e1f63a udev: support by-path devlink for multipath nvme block devices
If multipath feature is enabled, nvme block devices may belong to the
"nvme-subsystem" subsystem, instead of "nvme" subsystem.
(What a confusing name...)

Then, the syspath is something like the following,
    /sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
Hence, we need to find the 'real parent' device, such as
    /sys/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2031810.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2124964.
Replaces #24748.
2022-09-23 10:21:46 +09:00
Yu Watanabe 68f2134954 Merge pull request #24790 from poettering/run-chdir
run: let's make --working-directory= just work with --scope
2022-09-23 10:20:14 +09:00
Adam Williamson 97f9950698 kbd-model-map: add a mapping for switched czech qwerty/us
See https://bugzilla.redhat.com/show_bug.cgi?id=2121106 for the
background on this. One of Fedora's QA folks ran an install
and chose two keyboard layouts: Czech (qwerty) and US. Due to
the sad details of how the whole logic flow for trying to decide
what kbd layout best matches a given xkb config works (see
details in the bug comments), we wound up deciding the best-
matching kbd layout for this situation was cz-us-qwertz, which
is a czech/us switched layout, but is qwertz, not qwerty. This
seems like a poor outcome. Adding this line should result in us
picking cz-qwerty in this case. Which may be the 'legacy'
cz-qwerty.map from upstream kbd project (which is switched
cz/us), or may be the auto-converted xkb layout (which obviously
isn't switched). But either way, at least its primary mode is
Czech qwerty, which seems like a *better* choice than a layout
whose primary mode is Czech qwertz.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-09-23 10:19:41 +09:00
Luca Boccassi c9d65b921b Merge pull request #24771 from poettering/destroy-pcr11
extend boot phase information into PCR 11 during boot
2022-09-22 20:08:27 +01:00
Antonio Alvarez Feijoo b5f8a35f39 man/portablectl: fix references to options 2022-09-22 20:04:49 +01:00
Daan De Meyer e3a1cd9e98 Merge pull request #24746 from DaanDeMeyer/repart-split
repart: Add --split option to generate split artifacts
2022-09-22 19:09:12 +02:00
Lennart Poettering 7dad781102 update TODO 2022-09-22 16:57:58 +02:00
Lennart Poettering 1a9c67a98a measure: clarify we actually try to calculate for all four banks by default 2022-09-22 16:56:57 +02:00
Lennart Poettering a434e25f52 measure: make --public-key= optional if "sign" is called
We can derive the public key from the private key, so let's do that, to
make things a bit easier.
2022-09-22 16:55:56 +02:00
Lennart Poettering 6ca0016398 measure: allow pre-calculating PCR values for multiple boot phases 2022-09-22 16:54:48 +02:00
Lennart Poettering 40f1856791 units: add pcrphase units 2022-09-22 16:53:34 +02:00
Lennart Poettering 708d752479 boot: add new pcrphase tool to measure barrier strings into PCR 11 2022-09-22 16:52:06 +02:00
Lennart Poettering c5bf1f85cb tpm2-util: add helper for determining enabled/used PCR banks 2022-09-22 16:50:53 +02:00
Lennart Poettering 59fafaee5d tpm2-util: split out code that checks if bank has 24 pcrs into helper function of its own
Just some refactoring, not change in behaviour.
2022-09-22 16:49:47 +02:00
Lennart Poettering 1421943a71 tpm2-util: pick up Esys_PCR_Extend() symbol too 2022-09-22 16:48:11 +02:00
Zbigniew Jędrzejewski-Szmek 28f619d174 Merge pull request #24781 from DaanDeMeyer/link-remove-check
systemctl: Remove check that linked unit files must contain a "/"
2022-09-22 15:38:16 +02:00
Daan De Meyer 4cee83331c repart: Add --split option to generate split artifacts
For use with sysupdate or other systemd tooling, it's useful to be
able to generate split artifacts from disk images, where each
partition is written to a separate file. Let's support this with
a --split switch for repart and a SplitName= configuration option.

--split enables split artifacts generation, and SplitName= configures
for which partition to generate split artifacts, and which suffix to
add to the split artifact name.

For SplitName=, we add support for some extra specifiers, more specifically
the partition Type UUID and the partition UUID.
2022-09-22 15:10:03 +02:00
Daan De Meyer 1e58a0a82c shared: Add GPT_PARTITION_TYPE_UUID_TO_STRING_HARDER() 2022-09-22 14:54:55 +02:00
Daan De Meyer 7b52dc7f4d shared: Add specifier_uint64() 2022-09-22 14:52:37 +02:00
Daan De Meyer eff69daa69 systemctl: Fix style nit 2022-09-22 14:42:00 +02:00
Lennart Poettering fecc447766 run: make --working-directory= work for --scope too
This sounds like a more user-friendly alternative to #24780
2022-09-22 14:22:21 +02:00
Lennart Poettering c7b5ea6955 Revert "systemd-run: refuse --working-directory option with --scope"
This reverts commit 780c805537.
2022-09-22 14:19:10 +02:00
Lennart Poettering add0c9b8bf Merge pull request #24768 from keszybz/table-not-available-2
Adjust table n/a text in more places
2022-09-22 14:17:40 +02:00
Daan De Meyer 74235f6d08 shared: Add specifier_id128() and specifier_uuid() 2022-09-22 14:16:57 +02:00
Luca Boccassi e5a2977c9a Merge pull request #24620 from poettering/measure-tweaks
measure: some tweaks
2022-09-22 12:53:48 +01:00
Frantisek Sumsal c03896235d README: drop the LGTM badge 2022-09-22 13:47:49 +02:00
Daan De Meyer 445d29766a systemctl: Improve link directory separator error message
Let's suggest users try ./<filename> when they encounter this error.
2022-09-22 11:57:51 +02:00
Zbigniew Jędrzejewski-Szmek 29ca430865 shared/format-table: use empty_string instead of hardcoding "-" for invalid values
As requested in https://github.com/systemd/systemd/pull/24708#discussion_r973607866.
2022-09-22 10:16:30 +02:00
Zbigniew Jędrzejewski-Szmek c8b62cf600 shared/format-table: use enum instead of Table.empty_string
All users were setting this to some static string (usually "-"), so let's
simplify things by not doing strdup, but instead limiting callers to a fixed
set of values. In preparation for the next commit, the function is renamed from
"empty" to "replacement", because it'll be used for more than empty fields. I
didn't do the whole string-table setup, because it's all used internally in one
file and this way we can immediately assert if an invalid value is passed in.

Some callers were (void)ing the error, others were ignoring it, and others
propagating. It's nicer to remove the boilerplate.
2022-09-22 10:16:05 +02:00
Joost Heitbrink 780c805537 systemd-run: refuse --working-directory option with --scope
systemd-run's man page says the following about the working directory of
the process:

"If a command is run as transient scope unit, it will be executed
by systemd-run itself as parent process and will thus inherit the
execution environment of the caller."

This means working directory assignment does not work, as evidenced by
the following invocation:
```bash
$ systemd-run --scope --property=WorkingDirectory=/tmp/ bash -c 'echo $(pwd)'
Unknown assignment: WorkingDirectory=/tmp/
```

However, using the shorthand switch --working-directory silently ignores
this instead of giving a similar error.
```bash
systemd-run --scope --user --working-directory=/tmp/ bash -c 'echo $(pwd)'
Running scope as unit: run-r19cc32e744e64285814dbf2204637a2b.scope
/home/test/projects/systemd
```

This commit fixes this by explicitly generating an error instead of
silently ignoring the switch:
```bash
$ systemd-run --scope --working-directory=/tmp/ bash -c 'echo $(pwd)'
--working-directory is not supported in --scope mode.
```
2022-09-22 08:12:08 +09:00
Joost Heitbrink 63ed97efc3 man: don't mention Socket files in Scope man page 2022-09-22 08:09:05 +09:00
Lennart Poettering 4d0d34b4e7 Merge pull request #24709 from keszybz/partition-table-constants
Expose various GPT UUIDs as public contants and link them up in docs
2022-09-21 20:07:21 +02:00
Lennart Poettering df4bed3f92 Merge pull request #24753 from DaanDeMeyer/repart-squashfs
repart: Add squashfs support
2022-09-21 19:49:10 +02:00
Edson Juliano Drosdeck e65b02f831 Fix inverted rotation in the Positivo DUO #24769 (#24770)
hwdb: Fix  inverted rotation in the Positivo DUO 

Fixes: #24769
2022-09-21 19:46:42 +02:00
Lennart Poettering 64650de778 stub: fix conditionalization of initrd assembly
We forgot to conditionalize this on pcrsig/pcrpkey too. So if you have
ne creds or sysext configured we actually wouldn't pass pcrsig/pcrpkey
along. Let's fix that.
2022-09-21 19:43:48 +02:00
Zbigniew Jędrzejewski-Szmek ed1cf1d970 sd-gpt: adjust comments and use UINT64_C() 2022-09-21 15:30:32 +02:00