Commit graph

13002 commits

Author SHA1 Message Date
Ondra Machacek
135041be41 Add restart-sec option to systemd generate
Signed-off-by: Ondra Machacek <omachace@redhat.com>
2021-12-16 13:37:12 +01:00
OpenShift Merge Robot
4853c18c56
Merge pull request #12520 from mheon/fix_2021_4024_rhel
Backport CVE-2021-4024 fix to RHEL branch
2021-12-06 17:49:27 +00:00
Matthew Heon
3eb88d0be0 Swap bind address for gvproxy to localhost-only
This resolves CVE-2021-4024, where an attacker could access the
API externally and forward any port they desired to the VM from
`podman machine`.

[NO NEW TESTS NEEDED] gvproxy is not tested directly at this
time.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 09:32:34 -05:00
OpenShift Merge Robot
f601d7af41
Merge pull request #12496 from mheon/backport_12294
Backports for v3.4.2-rhel
2021-12-03 19:16:45 +01:00
Hironori Shiina
e770060906 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>
2021-12-03 10:11:26 -05:00
Aditya Rajan
7a6c99406e 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-02 11:26:17 -05:00
OpenShift Merge Robot
48f9f34d22
Merge pull request #12399 from edsantiago/backport_flake_fixes
[v3.4.2-rhel] Backport flake fixes
2021-11-23 18:29:12 +01:00
Valentin Rothberg
3922e61b32 fix CI
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-23 08:37:48 -07:00
Giuseppe Scrivano
dcc66d59ff utils: use podman-pause-$RANDOM.scope name
we try hard to re-use the existing podman-pause.scope name when it
already exists, causing any sort of race errors when the already
existing scope is terminating.

There is no such a requirement though, so just try with a random
name.

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

[NO NEW TESTS NEEDED] it fixes a race in the CI

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-23 08:37:43 -07:00
Ed Santiago
0998761370 Network test: fix podman-remote-rootless corner case
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-23 08:36:45 -07:00
OpenShift Merge Robot
c323d545a6
Merge pull request #12302 from mheon/fix_dst_branch
[NO NEW TESTS NEEDED] Fix destination branch for v3.4.2-rhel
2021-11-15 23:07:29 +01:00
Matthew Heon
eff7367c96 Fix destination branch for v3.4.2-rhel
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-11-15 11:22:28 -05:00
Matthew Heon
2ad1fd3555 Bump to v3.4.2
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-11-12 11:08:25 -05:00
Matthew Heon
1d6397e5c0 Add release notes for v3.4.2
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-11-12 11:08:25 -05:00
Matthew Heon
6d9b1e4b8e Fix partial log line handling with journald log driver
Patch originally by Paul Holzinger (sourced from [1]).

This is necessary to get the tests to pass in order to include a
batch of other, related journald fixes in `podman logs`.

[1] https://github.com/containers/podman/pull/12274#issuecomment-967168173

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-11-12 11:08:25 -05:00
Yahav Itzhak
8b368b5e1b Fix Zsh completion command documentation
Signed-off-by: yahavi <yahavi@jfrog.com>
2021-11-12 11:08:25 -05: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
Jindrich Novy
6770fede71 VOLUME must be declared after RUN chown command
Podman and Docker will not commit changes via RUN command
of a VOLUME directory, so we need to chown path first.

Not doing do will cause: https://bugzilla.redhat.com/show_bug.cgi?id=2009266

Signed-off-by: Jindrich Novy <jnovy@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-12 11:08:25 -05:00
Boaz Shuster
cedf1a3d43 podman-generate-kube - remove empty structs from YAML
[NO NEW TESTS NEEDED]

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2021-11-12 11:08:25 -05:00
Sascha Grunert
e456873c02 Exclude already built sources for static build
We now do not copy the `bin` directory to the target nix sources to
avoid skipping the build because "everything is up to date".

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

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-11-12 11:08:25 -05:00
Ian Wienand
e9f6e5194c Match .c files in Makefile
Ensure that rebuilds happen when .c files are updated in the source
tree.

Signed-off-by: Ian Wienand <iwienand@redhat.com>
2021-11-12 11:08:25 -05:00
Ian Wienand
de852ebd05 shm_lock: Handle ENOSPC better in AllocateSemaphore
When starting a container libpod/runtime_pod_linux.go:NewPod calls
libpod/lock/lock.go:AllocateLock ends up in here.  If you exceed
num_locks, in response to a "podman run ..." you will see:

 Error: error allocating lock for new container: no space left on device

As noted inline, this error is technically true as it is talking about
the SHM area, but for anyone who has not dug into the source (i.e. me,
before a few hours ago :) your initial thought is going to be that
your disk is full.  I spent quite a bit of time trying to diagnose
what disk, partition, overlay, etc. was filling up before I realised
this was actually due to leaking from failing containers.

This overrides this case to give a more explicit message that
hopefully puts people on the right track to fixing this faster.  You
will now see:

 $ ./bin/podman run --rm -it fedora bash
 Error: error allocating lock for new container: allocation failed; exceeded num_locks (20)

[NO NEW TESTS NEEDED] (just changes an existing error message)

Signed-off-by: Ian Wienand <iwienand@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
Valentin Rothberg
c8b7ca2ba2 pod/container create: resolve conflicts of generated names
Address the TOCTOU when generating random names by having at most 10
attempts to assign a random name when creating a pod or container.

[NO TESTS NEEDED] since I do not know a way to force a conflict with
randomly generated names in a reasonable time frame.

Fixes: #11735
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-12 11:08:25 -05:00
Daniel J Walsh
2dc8db7730 Add some information about disabling SELinux when using system volumes
A comment was made on internal mailing list about confusion on SELinux
labeling of volumes. This PR makes it a little more clear about when
you should or should not relabel.

We need a similar comment in podman pod create, but it does not support
--security-opt processing yet.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-12 11:08:25 -05:00
Jhon Honce
93a3e720d7 Log Apache access_log-like entries at Info level [NO NEW TESTS NEEDED]
Only log API access entries when --log-level set to Info or below.

Fixes #12181

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-11-12 11:08:25 -05:00
Nalin Dahyabhai
b1ac02dcbb tweak a couple of flag descriptions in help output
Descriptions of flags don't need to start with whitespace of their own.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-11-12 11:08:25 -05:00
Paul Holzinger
718de67f33 Fix bindings container log test
The returned error was not checked, thus the test could hang forever
since it blocks on the log channel.

Also handle unexpectedEOF like EOF.

Fixes #12176

Signed-off-by: Paul Holzinger <pholzing@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
Ondra Machacek
3bd80ac9ae Handle HTTP 409 error messages properly for Pod actions
This PR fixes the case when the API return HTTP 409 response. Where the
API return the body format different then for other HTTP error codes.

Signed-off-by: Ondra Machacek <omachace@redhat.com>
2021-11-12 11:08:25 -05:00
Matej Vasek
a8332f6946 Fix swagger definitions
[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-12 11:08:25 -05:00
Chris Evich
5889c2c241 Cirrus: Authorize rootless user self-ssh
Future testing needs dictate rootless (in addition to root) users are
able to ssh to localhost.  Add ssh-key generation commands for the
rootless user, and authorize their public key.

Minor: Also remove update of `/etc/sub{uid,gid}` files, since this is
now done automatically by `{user,group}add` commands.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-11-12 11:08:25 -05:00
Ashley Cui
2a0aad6beb Add information on how podman machine is updated
Update documentation on how the default podman machine distribution,
FCOS, is updated.

Signed-off-by: Ashley Cui <acui@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
Giacomo Sanchietti
fa29ca7106 Fix pause usage example
The page contains a wrong 'stop' command example.

Signed-off-by: Giacomo Sanchietti <giacomo.sanchietti@nethesis.it>
2021-11-12 11:08:25 -05:00
Adrian Reber
6bf6d72372 Set Checkpointed state to false after restore
A restored container still had the state set to 'Checkpointed: true'
which seems wrong if it running again.

[NO NEW TESTS NEEDED]

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-11-12 11:08:25 -05:00
Giuseppe Scrivano
2d6252b98a runtime: change PID existence check
commit 6b3b0a17c6 introduced a check for
the PID file before attempting to move the PID to a new scope.

This is still vulnerable to TOCTOU race condition though, since the
PID file or the PID can be removed/killed after the check was
successful but before it was used.

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

[NO NEW TESTS NEEDED] it fixes a CI flake

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-12 11:08:25 -05:00
Matej Vasek
a208bc24de Set DOCKER_HOST in the VM
[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
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
Giuseppe Scrivano
0519e7ef87 utils: do not overwrite the err variable
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
Giuseppe Scrivano
0e1f67b725 cgroups: use SessionBusPrivateNoAutoStartup
do not start up a dbus daemon if it is not already running.

[NO NEW TESTS NEEDED] the fix is in a dependency.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-12 11:08:25 -05:00
Giuseppe Scrivano
9707ff5d49 vendor: update godbus to v5.0.6
Signed-off-by: Giuseppe Scrivano <gscrivan@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
729310a851 If Dockerfile exists in same directory as service, we should not use it.
We should only use the Containerfiles/Dockerfiles found in the context
directory.

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

[NO NEW TESTS NEEDED] It is difficult to setup a test for this in the
CI/CD system, but build tests should find if this PR broke anything.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-12 11:08:25 -05:00
Paul Holzinger
7275d389b6 Document to not set K8S envars for CNI
Setting these environment variables can cause issues with custom CNI
plugins, see #12083.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-12 11:08:25 -05:00