]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't explicitly bind mount in keyrings from host into sandbox
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 25 Sep 2024 10:13:47 +0000 (12:13 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 26 Sep 2024 12:44:18 +0000 (14:44 +0200)
These are automatically mounted in as part of the tools tree. This
change means they'll always be picked up from the tools tree and won't
take ToolsTreeCertificates= into account anymore, but then keyrings weren't
exactly certificates in the first place, and can still be picked up from
the host by using SandboxTrees=.

This allows users to provide their own keyrings using sandbox trees. Currently
we just overmount the user provided ones with the ones from the host.

mkosi/mounts.py
mkosi/resources/man/mkosi.md

index 2de1b663898768f728699c4fb95671d1bea04784..3c843db307904a6eeee892755bb7fbfd3d530cc9 100644 (file)
@@ -92,18 +92,19 @@ def finalize_crypto_mounts(config: Config) -> list[PathString]:
     mounts = [
         (root / subdir, Path("/") / subdir)
         for subdir in (
-            Path("usr/share/keyrings"),
-            Path("usr/share/distribution-gpg-keys"),
             Path("etc/pki"),
             Path("etc/ssl"),
             Path("etc/ca-certificates"),
-            Path("etc/pacman.d/gnupg"),
             Path("etc/static"),
             Path("var/lib/ca-certificates"),
         )
         if (root / subdir).exists()
     ]
 
+    # This contains the Arch Linux keyring, which isn't certificates so ToolsTreeCertificates= doesn't apply.
+    if (config.tools() / "etc/pacman.d/gnupg").exists():
+        mounts += [(config.tools() / "etc/pacman.d/gnupg", Path("/etc/pacman.d/gnupg"))]
+
     return flatten(
         ("--symlink", src.readlink(), target) if src.is_symlink() else ("--ro-bind", src, target)
         for src, target in sorted(set(mounts), key=lambda s: s[1])
index d164e3e828e85e68701f032be7efd19891b17725..ae3332e8840dc35e7b84f7e3cb955922a5541a89 100644 (file)
@@ -1302,11 +1302,11 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
     multiple times in which case the specified package lists are combined.
 
 `ToolsTreeCertificates=`, `--tools-tree-certificates=`
-:   Specify whether to use certificates and keys from the tools tree. If
-    enabled, `/usr/share/keyrings`, `/usr/share/distribution-gpg-keys`,
-    `/etc/pki`, `/etc/ssl`, `/etc/ca-certificates`, `/etc/pacman.d/gnupg`
-    and `/var/lib/ca-certificates` from the tools tree are used.
-    Otherwise, these directories are picked up from the host.
+:   Specify whether to use certificates and keys from the tools tree.
+    Enabled by default. If enabled, `/etc/pki`, `/etc/ssl`,
+    `/etc/ca-certificates`, and `/var/lib/ca-certificates` from the
+    tools tree are used. Otherwise, these directories are picked up from
+    the host.
 
 `Incremental=`, `--incremental=`, `-i`
 :   Takes either `strict` or a boolean value as its argument. Enables