Commit graph

3150 commits

Author SHA1 Message Date
Valentin Rothberg
f7bb8c4495 fix CVE-2022-1227
Vendor in the backports for psgo.  Note that we cannot use psgo v1.7.1+
as v1.7.2 bumped too many dependencies.

Hence psgo has a v1.7.1-fedora branch that will be used for Podman v3.4.x
for Fedora.  The v3.4.2-rhel branch uses c/storage v1.36.x so we need a
separate branches in psgo for Fedora and RHEL.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-14 15:27:58 +02:00
Giuseppe Scrivano
6ebfaa0381 test: fix podman run test as rootless
aafa80918a introduced the regression.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 640c2d53a8)
2022-04-12 14:27:49 -04:00
Giuseppe Scrivano
8292fc0a44 do not set the inheritable capabilities
The kernel never sets the inheritable capabilities for a process, they
are only set by userspace.  Emulate the same behavior.

Closes: CVE-2022-27649

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit aafa80918a)
2022-04-12 14:27:41 -04:00
Chris Evich
4fa7a2e3ae
Disable search-images test
Found images being returned which do have "Alpine" in the description.
However, test fails because podman truncates the field.  Disabling test
since this is a long-term maintenance branch.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-02-21 10:54:04 -05:00
Brent Baude
2fd1ff9d1e
Changes of docker descriptions
It looks like some descriptions have changed on the docker registry
where we had been searching for images that include 'alpine'.  We are
now seeing an image in the initial list that has 'alpine' in its
description.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-18 11:52:02 -05:00
Brent Baude
ce5359f54c
Fix images since/after tests
For the since and after imagve filter tests, instead of using the
read-only cache of images, we just use the empty r/w store.  We then
build three images that are strictly predictable.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-18 11:51:46 -05:00
OpenShift Merge Robot
63134a1ef8
Merge pull request #12831 from edsantiago/emergency_buildah_skips
[v3.4] buildah bud tests: skip failing tests
2022-01-12 20:30:19 +01:00
Ed Santiago
1e875c8518 buildah bud tests: skip failing tests
[backport of #12818]

Emergency workaround for github's deprecation of git://

   https://github.blog/2021-09-01-improving-git-protocol-security-github/

Two buildah tests rely on 'git://' URLs. These now fail. They
have been fixed in the buildah repo[1] but it will take time
to vendor that in. ITM, we need to get CI passing. Skip those
two failing tests.

 [1] https://github.com/containers/buildah/pull/3701

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-12 10:33:07 -07:00
Ed Santiago
e5ecce1da7 System tests: fix RHEL8 gating tests
Add a fix for RHEL8 gating tests. This resolves yet another
journald/file events/logger mismatch bug.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-10 14:16:06 -07:00
Aditya Rajan
e30588a685 specgen: honor empty args for entrypoint
Users should be able to override containers entrypoint using
`--entrypoint ""` following works fine for podman but not for podman
remote.

Specgen ignores empty argument for entrypoint so make specgen honor
empty arguments.

Signed-off-by: Aditya Rajan <arajan@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-08 13:39:10 -05:00
Aditya Rajan
db9caa74b7 volume: apply exact permission of target directory without adding extra 0111
While trying to match permissions of target directory podman adds
extra `0111` which should not be needed if target path does not have
execute permission.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-08 13:34:55 -05:00
Valentin Rothberg
921e9ecbb3 fix remote run/start flake
Fix the flake reported in #9597 with a workaround to at least stop
wasting energy until the root cause has been found and fixed.

It seems that a remote run returns before the container has transitioned
into the `exited` state which ultimately breaks a subsequent remote
start with attach.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-08 07:54:18 -07:00
Ed Santiago
9bf0271e6d Disable stty system test
It's failing pretty reliably now, so much so that gating tests
will be unlikely to pass.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-08 07:52:57 -07:00
Valentin Rothberg
d952763884 compat: images/json
Do not list manifest lists.  Docker doesn't either.

Fixes: #12453
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 15:47:04 -05:00
Valentin Rothberg
39318f1779 top: parse ps(1) args correctly
The arguments of ps(1) should be shlexed.

Fixes: #12452
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 15:38:10 -05:00
Matej Vasek
7b8e66de0b fix: parsing of HostConfig.Mounts for container create
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-06 15:32:15 -05:00
Matej Vasek
741d98fade fix: error reporting for archive endpoint
Returning 500 when copying to read-only destination.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-06 15:27:55 -05:00
Giuseppe Scrivano
905eabf0be libpod: improve heuristic to detect cgroup
improve the heuristic to detect the scope that was created for the container.
This is necessary with systemd running as PID 1, since it moves itself
to a different sub-cgroup, thus stats would not account for other
processes in the same container.

Closes: https://github.com/containers/podman/issues/12400

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 15:26:18 -05:00
Hironori Shiina
6d9c1d8fdc Set flags to test 'logs -f' with journald driver
`logs -f` with `journald` is supported only when `journald` events
backend is used. To pass system tests using `logs -f` in an environment
where `events_logger` is not set to `journald` in `containers.conf`,
this fix sets `--events-backend` or `--log-driver` temporally.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 14:53:27 -05:00
Aditya Rajan
db6b9131ef secret: honor custom target for secrets with run
Honor custom `target` if specified while running or creating containers
with secret `type=mount`.

Example:
`podman run -it --secret token,type=mount,target=TOKEN ubi8/ubi:latest
bash`

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 14:37:46 -05:00
Nalin Dahyabhai
08bcd60c8f journald logs: keep reading until the journal's end
When reading logs from the journal, keep going after the container
exits, in case it gets restarted.

Events logged to the journal via the normal paths don't include
CONTAINER_ID_FULL, so don't bother adding it to the "history" event we
use to force at least one entry for the container to show up in the log.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-12-06 14:34:25 -05:00
Daniel J Walsh
76ada2c011 Error logs --follow if events-backend != journald, event-logger=journald
Fixes: https://github.com/containers/podman/issues/11255

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-06 14:31:01 -05:00
Michael Scherer
4ed07fb67d Always create working directory when using compat API
Docker/Moby always create the working directory, and some tools
rely on that behavior (example, woodpecker/drone).

Fixes #11842

Signed-off-by: Michael Scherer <misc@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 14:24:06 -05:00
Paul Holzinger
18e9ae59ca Fix network mode in play kube
We need to use the config network mode when no network mode was set. To
do so we have to keep the nsmode empty, MakeContainer() will use the
correct network mode from the config when needed.

Fixes #12248

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 14:21:17 -05:00
Valentin Rothberg
3912484569 systemd: replace multi-user with default.target
Replace multi-user.target with default.target across the code base.
It seems like the multi-user one is not available for (rootless) users
on F35 anymore is causing issues in all kinds of ways, for instance,
enabling the podman.service or generated systemd units.

Backport of commit 9a10e2124b.

Fixes: #12438
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-01 09:41:37 +01:00
Valentin Rothberg
47a8e7c9f9 container create: fix --tls-verify parsing
Make sure that the value is only set if specified on the CLI.  c/image
already defaults to true but if set in the system context, we'd skip
settings in the registries.conf.

Backport of commit ff31f2264d.

Fixes: #11933
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-30 14:48:26 +01:00
Jakub Dzon
b517f86334 Support env variables based on ConfigMaps sent in payload
Fixes #12363

Signed-off-by: Jakub Dzon <jdzon@redhat.com>
2021-11-30 10:44:30 +01:00
Valentin Rothberg
fe30b30458 fix CI
[Backport #12343, which fixes the change in fedora-minimal image]

Our fedora-minimal image on Quay bases on fedora-minimal:latest which
starting with F35 removed a number of binaries that our CI depends on.
Fix that by pulling `fedora-minimal:34` from the Fedora registry
directly.

Once the build bot on Quay has been disabled, we move the image over
there to make sure that it will not change over time.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-22 09:30:01 -07:00
Ed Santiago
36b6bf119e Network test: fix podman-remote-rootless corner case
[Backport of #12297 into v3.4, to fix gating-test failures]

Followup to #12229, in which I added a podman unshare for
flake debugging. Turns out that doesn't work in podman-remote.
It was not caught because CI doesn't run podman-remote rootless.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-22 08:24:44 -07:00
Paul Holzinger
c2fb170b87 Fix flake in upgrade tests
The cni plugins need access to /run/cni and the dnsname plugin needs
access to /run/containers.

The race condition was basically that a `podman stop` could either do the
cleanup itself or the spawned cleanup process would do the cleanup if it
was fast enough. The `podman stop` is executed on the host while the
podman cleanup process is executed in the "parent container". The parent
container contains older plugins than on the host. The dnsname plugin
before version 1.3 could error and this would prevent CNI from
doing a proper cleanup. The plugin errors because it could not find its
files in /run/containers. On my system the test always failed because
the cleanup process was always faster than the stop process. However in
the CI VMs the stop process was usually faster and so it failed only
sometimes.

Fixes #11558

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-12 11:08:25 -05:00
Ed Santiago
fc1707dfe4 Minor test tweaks
- remove 'NO TESTS NEEDED' as a valid bypass string. Henceforth
  only 'NO NEW TESTS NEEDED' will work.

- add a debugging aid for #11871, in which bodhi tests time out
  in nslookup.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-12 11:08:25 -05:00
Giuseppe Scrivano
dd6551055a test: run --cgroups=split in new cgroup
the --cgroups=split test changes the current cgroup as it creates a
sub-cgroup.  This can cause a race condition in tests that are reading
the current cgroup.

Closes: https://github.com/containers/podman/issues/11191

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-12 11:08:25 -05:00
Miloslav Trmač
df9e0fdcb0 Fix tests of podman image trust --raw and --json
Instead using the OS-wide system default policy, use
the one in this repo, and adjust the expected results
(as well as making the test stricter).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-11-12 11:08:25 -05:00
Miloslav Trmač
df736396e1 Tighten the expected output of the "podman image trust show" test
... to include all fields.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-11-12 11:08:25 -05:00
Miloslav Trmač
18c322d1c0 Use INTEGRATION_ROOT instead of current directory
Should not change behavior, just to set a consistent
precedent for code introduced in future commits.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-11-12 11:08:25 -05:00
Praveen Kumar
0ded340e6b Fix help message case for podman version
This is a cosmetic change. The help message for `podman version` is in
title case whereas all other command help messages are not in title
case. This stands out as inconsistent when looking at the output of
`podman help`.

Signed-off-by: Praveen Kumar <praveen+git@kumar.in>
2021-11-12 11:08:25 -05:00
Giuseppe Scrivano
246782133c runtime: check for pause pid existence
check that the pause pid exists before trying to move it to a separate
scope.

Closes: https://github.com/containers/podman/issues/12065

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-12 11:08:25 -05:00
Chris Evich
2b85684ad1 Fix systemd PID1 test
Previously this test used an ad-hoc timeout mechanism to synchronize
with output of the container ID.  However, depending on runtime
conditions this may not correctly correspond with complete startup
of the systemd process.  Consequently this test fails under some
conditions with an error like:

`System has not been booted with systemd as init system (PID 1). Can't
operate. Failed to connect to bus: Host is down`

Fix this by using the more appropriate `WaitContainerReady()`
against output from system startup, close to finalization.  In this way,
the test status command cannot run until systemd is fully operational.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-11-12 11:08:25 -05:00
Paul Holzinger
a67bf0f921 Slirp4netns with ipv6 set net.ipv6.conf.default.accept_dad=0
Duplicate Address Detection slows the ipv6 setup down for 1-2 seconds.
Since slirp4netns is run it is own namespace and not directly routed
we can skip this to make the ipv6 address immediately available.
We change the default to make sure the slirp tap interface gets the
correct value assigned so DAD is disabled for it.
Also make sure to change this value back to the original after slirp4netns
is ready in case users rely on this sysctl.

Fixes #11062

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-12 11:08:25 -05:00
Hironori Shiina
47afa6d962 Fix a few problems in 'podman logs --tail' with journald driver
The following problems regarding `logs --tail` with the journald log
driver are fixed:
- One more line than a specified value is displayed.
- '--tail 0' displays all lines while the other log drivers displays
  nothing.
- Partial lines are not considered.
- If the journald events backend is used and a container has exited,
  nothing is displayed.

Integration tests that should have detected the bugs are also fixed. The
tests are executed with json-file log driver three times without this
fix.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
2021-11-12 11:08:25 -05:00
Daniel J Walsh
8887cc7e44 podman run --memory=0 ... should not set memory limit
On Docker this is ignored, and it should be on Podman as
well. This is documented in the man page.

Fixes: https://github.com/containers/podman/issues/12002

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-12 11:08:25 -05:00
cdoern
3b67336b60 Pod Rm Infra Improvements
Made changes so that if the pod contains all exited containers and only infra is running, remove the pod.

resolves #11713

Signed-off-by: cdoern <cdoern@redhat.com>
2021-11-12 11:08:25 -05:00
Ed Santiago
f8ede7c5ed System tests: confirm that -a and -l clash
...and fix one instance where there was no check

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-12 11:08:25 -05:00
Daniel J Walsh
b3eaa08c5f Generate Kube should not print default structs
If podman uses Workdir="/" or the workdir specified in the image, it
should not add it to the yaml.
If Podman find environment variables in the image, they should not
get added to the yaml.

If the container or pod do not have changes to SELinux we should not
print seLinuxOpt{}

If the container or pod do not change any dns options the yaml should
not have a dnsOption={}

If the container is not privileged it should not have privileged=false
in the yaml.

Fixes: https://github.com/containers/podman/issues/11995

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-12 11:08:25 -05:00
Paul Holzinger
9c94530bbe
network reload without ports should not reload ports
When run as rootless the podman network reload command tries to reload
the rootlessport ports because the childIP could have changed.
However if the containers has no ports we should skip this instead of
printing a warning.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-11 14:28:58 +01:00
Paul Holzinger
eca1b6c0bd
pod create: read network mode from config
When we create a pod we have to parse the network mode form the config
file. This is a regression in commit d28e85741f.

Fixes #12207

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-11 14:27:31 +01:00
Valentin Rothberg
9e78185e37 volumes: be more tolerant and fix infinite loop
Make Podman more tolerant when parsing image volumes during container
creation and further fix an infinite loop when checking them.

Consider `VOLUME ['/etc/foo', '/etc/bar']` in a Containerfile.  While
it looks correct to the human eye, the single quotes are wrong and yield
the two volumes to be `[/etc/foo,` and `/etc/bar]` in Podman and Docker.

When running the container, it'll create a directory `bar]` in `/etc`
and a directory `[` in `/` with two subdirectories `etc/foo,`.  This
behavior is surprising to me but how Docker behaves.  We may improve on
that in the future.  Note that the correct way to syntax for volumes in
a Containerfile is `VOLUME /A /B /C` or `VOLUME ["/A", "/B", "/C"]`;
single quotes are not supported.

This change restores this behavior without breaking container creation
or ending up in an infinite loop.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2014149
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-08 10:17:06 +01:00
Aditya Rajan
5c2d17e1c1
[backport] tag: Support tagging manifest list instead of resolving to images
Following commit makes sure when buildah tag is invoked on a manifest
list, it tags the same manifest list instead of resolving to an image and
tagging it.

Backporting https://github.com/containers/podman/pull/12057

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-01 17:15:59 +05:30
Matthew Heon
f05e206bd3 Fix test failures from backports
Timeouts for `podman rm` aren't in until 4.0, so we need to
remove them.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-10-19 17:14:42 -04:00
Ed Santiago
437ec951d9 system tests: socket activation: clean up
Multiarch folks are seeing flakes in this test. I can't reproduce
them, but I did notice that the test isn't doing the best possible
job of reporting failures nor of confirming what it purports to test.

Major fix here is to check the exit status of each curl: if we
see the flake again, that will help us track down the failure.

Other fixes are just refactoring, cleanup, and disambiguation
(using the random service name consistently)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-10-19 15:56:35 -04:00