18 Commits

Author SHA1 Message Date
726b506acc machine init: fix tls check
Ensure we verify the TLS connection when pulling the OCI image.

Fixes: CVE-2025-6032

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-23 14:12:55 +02:00
22789928d4 podman machine: pull wsl image from machine-os
Starting with [1] we now build and publish the wsl image from the
machine-os repo, as such this special case is no longer needed.

[1] https://github.com/containers/podman-machine-os/pull/142

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-10 18:09:21 +02:00
ea1eeb523f remove github.com/crc-org/crc/v2 dependency
There is one user in the code and one in the tests.
First the test is testing an external function that doesn't seem to make
a lot of sense.

Second when we pull the machine image and renmae doesn't work it would
mean it is on a different disk. That should never happen.
The oci pull is to
~/.local/share/containers/podman/machine/<provider>/cache/<sha>/...
and then it gets moved to
~/.local/share/containers/podman/machine/qemu/cache/<sha>.<extension>

These can under normal circumstances never be on different disk as it
would mean the pulled sha is known ahead of time and then that the blob
path is a mount point which is unrealistic and not something we have to
support.

It also removes three transitive dependencies.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 14:39:51 +02:00
b2d08f5b8f Use UnparsedInstance.Manifest instead of ImageSource.GetManifest
... to validate that the manifests match expected digests, if any.

Do this everywhere, even where we read local storage which is
mostly trusted, because it is cheap enough and being consistent
makes it less likely for the code to be copied into other
contexts shere the sources are not trusted.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-02-28 20:14:11 +01:00
b2e6d53265 Get WSL disk as an OCI artifact
[Since a few days][1] WSL disk releases are also pushed
to [quay.io/podman/machine-os-wsl][2]. This PR updates
`podman machine init` mechanism to download WSL disk
images. The WSL disk images are now pulled from quay.io
as for the rest of the providers.

Fixes [#22927][3] and [RUN-2177][4]

[1]: https://github.com/containers/podman-machine-wsl-os/pull/6
[2]: https://quay.io/repository/podman/machine-os-wsl?tab=tags
[3]: https://github.com/containers/podman/issues/22927
[4]: https://issues.redhat.com/browse/RUN-2177

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-09-16 14:36:50 +02:00
7768cf235e Run codespell on source
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-07-23 07:28:23 -04:00
02cfd71fe8 Merge pull request #22507 from ashley-cui/cache
Clean machine pull cache
2024-04-26 18:13:34 +00:00
e412eff33f Clean machine pull cache
Cache cleanups only happen if there is a cache miss, and we need to pull a new image

For quay.io/podman/machine-os, we remove all old images from the cache dir. This means we will delete any file that exists in the cache dir; this should be safe to do since the machine pull code should be the only thing touching this cache dir. OCI machine images will always have a different manifest, and won’t be updated with the same manifest, so if the version moves on, there isn’t a reason to keep the old version in the cache, it really doesn’t change.

For Fedora (WSL), we use the cache, so we go through the cache dir and remove any old cached images, on a cache miss. We also switch to using ~/.local/share/containers/podman/machine/wsl/cache as the cache dir rather than ~/.local/share/containers/podman/machine/wsl. Both these behaviors existed in v4.9, but are now added back into 5.x.

For generic files pulled from a URL or a non-default OCI image, we shouldn’t actually cache, so we delete the pulled file immediately after creating a machine image. This restores the behavior from v4.9.

For generic files from a local path, the original file will never be cleaned up

Unsure how to test, so:
[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-04-26 12:31:42 -04:00
d2c1de5993 Add krun support to podman machine
This PR adds libkrun support to podman machine.  This is an experimental feature and should not be marketed yet.  Before we unmark the experimental status on this function, we will need to have full CI support and a full podman point release has pased.

This work relies on the fact that vfkit and libkrun share a reasonably (if not perfectly) same API.  The --log-level debug option will not show a GUI screen for boots as krun is not capable of this.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-04-26 08:58:38 -05:00
4c5d26f6f9 Add final machine endpoint
Adding the final machine endpoint as quay.io/podman/machine-os in the
Podman code.  As a reminder, we decided we would set this in containers
conf once things settle down and this code would then be removed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-03-12 09:37:57 -05:00
e09444327a machine init: print output to improve UX
As outlined in #21856, it can take a number of seconds until an image
gets pulled.  That is because init is hitting the registry first to look
up the image.  To improve the UX, add a new line indicating what
happens.

[NO NEW TESTS NEEDED]

Fixes: #21856
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2024-03-04 14:46:38 +01:00
527b3793b8 Use machine image as specified in containers.conf
For podman machine init, deprecate the --image-path option for --image.
--image now accepts the correct image from containers.conf

Also, add the ability to specify an OCI image from the --image flag using the docker:// transport.

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-02-29 13:38:43 -05:00
8377483145 Merge pull request #21866 from cgwalters/prefix-errpull
machine/ociartifact: Include image name in error
2024-02-29 11:32:05 +00:00
fd1d951262 Move ignition functions into Containerfiles
We used to use ignition to perform any customization required for podman
machine because our input was a generic FCOS image.  Now that we are
building our own images, some of this customization can be migrated to
the Containerfile itself and be less of a burden in our code at boot up.

At the time of this PR, the Containerfile can be found at
https://github.com/baude/podman-machine-images/tree/main.  It is only
present for a so-called daily image.  There is little liklihood that
this would the final location for the Containerfile so consider it a
working version only.

Split WSL and rest apart in the e2e tests so we no longer ppull the
generic FCOS image for testing.

Note: the change to the pull image name is so PRs are not immediately
broken that are already in the queue.

[NO NEW TESTS REQUIRED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-28 16:05:50 -06:00
b58f20bdb6 machine/ociartifact: Include image name in error
If we hit an error here, it will be really useful to know

- That we're trying to fetch a container image
- Which image we're trying to fetch

[NO NEW TESTS NEEDED]

Signed-off-by: Colin Walters <walters@verbum.org>
2024-02-28 16:23:34 -05:00
a31e8d2a23 zstd now default compression for podman machine
given that we are moving to building our own machine images, we have
decided to use zstd compression as it is superior in speed to the
alternatives.  as such, this pr adds zstd to our machine code; and also
has to account for dealing with sparseness on darwin; which the default
zstd golang library does not.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-20 14:26:41 -06:00
9abc042320 Fix small bug in ocipull
This PR fixes a small bug in pulling disk artifacts where the machine os
was accidently being set to GOOS instead of "linux".  Also removed the
manifest type verification because it served no purpose.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-14 12:37:18 -06:00
2430fc71a0 Allow podman machine to download from oci registry
this pr represents a shift in how we download podman machine images.
these images will now be stored in oci registry and will replace the
default method of downloading an image.  you can still use a reference
to a disk image as a path or url too with the --image-path switch.

the final registry and location of the images has not been determined;
and will need to be updated in podman as well.

i dont think we need to allow --image-path to accept a registry/image
for the podman 5.0 release.  i do think there will be demand for this.

upgrades also need to be plumbed.  for example, updating from an oci
registry.

once we make decisions on final image locations/registrties as well as
some behaviors of init and the oci pull, we must update the machine-init
documentation.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-12 15:19:34 -06:00