10713 Commits

Author SHA1 Message Date
6c132b78f1 Merge pull request #8771 from rhatdan/run
Switch references of /var/run -> /run
2021-01-07 15:06:17 -05:00
201d853283 Cirrus: Skip most tests on tag-push
Due to various reasons, CI results (esp. testing tasks) are completely
ignored for builds triggered by a new tag-push.  Additionally, since
many of the automation scripts are in the repo., any related
failures/flakes would require code changes (therefore a new tag).

Resolve this by skipping every testing-type task for builds triggered by
tag-push.  Only retain tasks which build things intended for consumption
associated with a possible official release.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-01-07 11:26:34 -05:00
3cf41c4a73 Merge pull request #8821 from rhatdan/caps
Containers should not get inheritable caps by default
2021-01-07 09:44:37 -05:00
74af9254b9 Merge pull request #8816 from giuseppe/automatically-split-userns-mappings
rootless: automatically split userns ranges
2021-01-07 09:35:01 -05:00
65c88ec473 Add mips architecture to the cross build target
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-07 15:04:40 +01:00
9dfc636fd6 Fix build for mips architecture follow-up
Follow-up to commit (1ad796677e1c). The build on mips is still
failing because SIGWINCH was not defined in the signal pkg.
Also stat_t.Rdev is unit32 on mips so we need to typecast.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-07 15:04:22 +01:00
a47515008b Merge pull request #8904 from Luap99/fix-podman-logs
Fix podman logs read partial log lines
2021-01-07 06:11:37 -05:00
db71759b1a Handle podman exec capabilities correctly
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-07 05:53:50 -05:00
9ebde6e03a Containers should not get inheritable caps by default
When I launch a container with --userns=keep-id the rootless processes
should have no caps by default even if I launch the container with
--privileged.  It should only get the caps if I specify by hand the
caps I want leaked to the process.

Currently we turn off capeff and capamb, but not capinh.  This patch
treats capinh the same way as capeff and capamb.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-07 05:53:07 -05:00
ef82be4e00 Make podman generate systemd --new flag parsing more robust
First, use the pflag library to parse the flags. With this we can
handle all corner cases such as -td or --detach=false.

Second, preserve the root args with --new. They are used for all podman
commands in the unit file. (e.g. podman --root /tmp run alpine)

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-07 11:50:28 +01:00
d9ebbbfe5b Switch references of /var/run -> /run
Systemd is now complaining or mentioning /var/run as a legacy directory.
It has been many years where /var/run is a symlink to /run on all
most distributions, make the change to the default.

Partial fix for https://github.com/containers/podman/issues/8369

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-07 05:37:24 -05:00
68c9e02df7 Merge pull request #8884 from containers/dependabot/go_modules/github.com/google/uuid-1.1.4
Bump github.com/google/uuid from 1.1.3 to 1.1.4
2021-01-07 05:34:08 -05:00
ecedda63a6 rootless: automatically split userns ranges
writing to the id map fails when an extent overlaps multiple mappings
in the parent user namespace:

$ cat /proc/self/uid_map
         0       1000          1
         1     100000      65536
$ unshare -U sleep 100 &
[1] 1029703
$ printf "0 0 100\n" | tee /proc/$!/uid_map
0 0 100
tee: /proc/1029703/uid_map: Operation not permitted

This limitation is particularly annoying when working with rootless
containers as each container runs in the rootless user namespace, so a
command like:

$ podman run --uidmap 0:0:2 --rm fedora echo hi
Error: writing file `/proc/664087/gid_map`: Operation not permitted: OCI permission denied

would fail since the specified mapping overlaps the first
mapping (where the user id is mapped to root) and the second extent
with the additional IDs available.

Detect such cases and automatically split the specified mapping with
the equivalent of:

$ podman run --uidmap 0:0:1 --uidmap 1:1:1 --rm fedora echo hi
hi

A fix has already been proposed for the kernel[1], but even if it
accepted it will take time until it is available in a released kernel,
so fix it also in pkg/rootless.

[1] https://lkml.kernel.org/lkml/20201203150252.1229077-1-gscrivan@redhat.com/

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-07 09:42:27 +01:00
09f4cc6fc3 rootless: add function to retrieve uid mappings
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-07 09:41:06 +01:00
fcc04fbaba rootless: add function to retrieve gid mappings
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-07 09:41:01 +01:00
1215bd9ffd test: Add checkpoint/restore with volumes
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:51:22 +00:00
288ccc4c84 Include named volumes in container migration
When migrating a container with associated volumes, the content of
these volumes should be made available on the destination machine.

This patch enables container checkpoint/restore with named volumes
by including the content of volumes in checkpoint file. On restore,
volumes associated with container are created and their content is
restored.

The --ignore-volumes option is introduced to disable this feature.

Example:

 # podman container checkpoint --export checkpoint.tar.gz <container>

The content of all volumes associated with the container are included
in `checkpoint.tar.gz`

 # podman container checkpoint --export checkpoint.tar.gz --ignore-volumes <container>

The content of volumes is not included in `checkpoint.tar.gz`. This is
useful, for example, when the checkpoint/restore is performed on the
same machine.

 # podman container restore --import checkpoint.tar.gz

The associated volumes will be created and their content will be
restored. Podman will exit with an error if volumes with the same
name already exist on the system or the content of volumes is not
included in checkpoint.tar.gz

 # podman container restore --ignore-volumes --import checkpoint.tar.gz

Volumes associated with container must already exist. Podman will not
create them or restore their content.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:51:19 +00:00
2b35876c8d Use Options as CRImportCheckpoint() argument
Instead of specifying restore option arguments individually from
RestoreOptions, provide the 'options' object to the CRImportCheckpoint
method. This change makes the code in CRImportCheckpoint easier to
extend as it doesn't require excessive number of function parameters.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:48:41 +00:00
17f50fb4bf Use Options as exportCheckpoint() argument
Instead of individual values from ContainerCheckpointOptions,
provide the options object.

This is a preparation for the next patch where one more value
of the options object is required in exportCheckpoint().

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:48:41 +00:00
355e387692 Merge pull request #8832 from hshiina/logfile
Fix e2e test for `podman build --logfile`
2021-01-06 20:19:34 -05:00
b7f699c199 Fix podman logs read partial log lines
If a partial log line has the length 1 it was ignored by podman logs.

Fixes #8879

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-07 00:04:38 +01:00
bb82c37b73 Merge pull request #8805 from giuseppe/single-user-mapped-root
libpod: handle single user mapped as root
2021-01-06 15:41:36 -05:00
8e4613ab0a Merge pull request #8892 from mheon/fix_8886
Ensure that user-specified HOSTNAME is honored
2021-01-06 15:26:55 -05:00
9198ed40e1 Merge pull request #8901 from mheon/reenable_cevich_tests
Revert e6fbc15f26b2a609936dfc11732037c70ee14cba and reenable tests
2021-01-06 15:20:09 -05:00
9494249f4b Merge pull request #8899 from cevich/new_2021_images
Cirrus: Update Fedora & Ubuntu images
2021-01-06 15:14:01 -05:00
fc44ac2ef2 Revert e6fbc15f26b2a609936dfc11732037c70ee14cba
The issue requiring these tests be disabled should be resolved.
Reenable the tests as such.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-01-06 11:48:06 -05:00
e467400eb1 Cirrus: Update Fedora & Ubuntu images
Signed-off-by: Chris Evich <cevich@redhat.com>
2021-01-06 10:08:48 -05:00
8f844a66d5 Ensure that user-specified HOSTNAME is honored
When adding the HOSTNAME environment variable, only do so if it
is not already present in the spec. If it is already present, it
was likely added by the user, and we should honor their requested
value.

Fixes #8886

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-06 09:46:21 -05:00
ffe2b1e95a Merge pull request #8685 from mheon/ignore_containersconf_sysctls_shared_net
Ignore containers.conf sysctls when sharing namespaces
2021-01-05 17:08:31 -05:00
1f59276998 Merge pull request #8889 from vrothberg/run-1138
generate systemd: do not set `KillMode`
2021-01-05 14:16:47 -05:00
b84b7c89bb Merge pull request #8831 from bblenard/issue-8658-system-prune-reclaimed-space
Rework pruning to report reclaimed space
2021-01-05 11:35:18 -05:00
bc21fabbd7 Merge pull request #8885 from vrothberg/vendor-psgo
vendor containers/psgo@v1.5.2
2021-01-05 10:53:36 -05:00
219c69ef03 generate systemd: do not set KillMode
`KillMode=none` has been deprecated in systemd and is now throwing big
warnings when being used.  Users have reported the issues upstream
(see #8615) and on the mailing list.

This deprecation was mainly motivated by an abusive use of third-party
vendors causing all kinds of undesired side-effects.  For instance, busy
mounts that delay reboot.

After talking to the systemd team, we came up with the following plan:

 **Short term**: we can use TimeoutStopSec and remove KillMode=none which
 will default to cgroup.

 **Long term**: we want to change the type to sdnotify. The plumbing for
 Podman is done but we need it for conmon. Once sdnotify is working, we
 can get rid of the pidfile handling etc. and let Podman handle it.
 Michal Seklatar came up with a nice idea that Podman increase the time
 out on demand. That's a much cleaner way than hard-coding the time out
 in the unit as suggest in the short-term solution.

This change is executing the short-term plan and sets a minimum timeout
of 60 seconds.  User-specified timeouts are added to that.

Fixes: #8615
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-05 16:37:24 +01:00
bfbd915d62 Bump github.com/google/uuid from 1.1.3 to 1.1.4
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.3 to 1.1.4.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.1.3...v1.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-05 10:10:46 -05:00
21f5154399 vendor containers/psgo@v1.5.2
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-05 10:44:16 +01:00
1b9366d650 Merge pull request #8873 from baude/issue8864
close journald when reading
2021-01-05 04:34:24 -05:00
618c35570d Merge pull request #8878 from mheon/no_edit_config
Ensure we do not edit container config in Exec
2021-01-04 21:11:27 -05:00
ced7c0ab7f Merge pull request #8875 from rhatdan/image
Allow image errors to bubble up from lower level functions.
2021-01-04 17:30:22 -05:00
864592c746 Add default sysctls for pod infra containers
Ensure that infra containers for pods will grab default sysctls
from containers.conf, to match how other containers are created.
This mostly affects the other containers in the pod, which will
inherit those sysctls when they join the pod's namespaces.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-04 15:29:18 -05:00
960607a4cd Ensure we do not edit container config in Exec
The existing code grabs the base container's process, and then
modifies it for use with the exec session. This could cause
errors in `podman inspect` or similar on the container, as the
definition of its OCI spec has been changed by the exec session.
The change never propagates to the DB, so it's limited to a
single process, but we should still avoid it when possible - so
deep-copy it before use.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-04 14:36:41 -05:00
002d0d6ee6 close journald when reading
when reading from journald, we need to close the journal handler for
events and logging.

Fixes: #8864

Signed-off-by: baude <bbaude@redhat.com>
2021-01-04 13:27:38 -06:00
b5028541cf Merge pull request #8876 from vrothberg/fix-8870
libpod API: pull: fix channel race
2021-01-04 13:41:28 -05:00
6a1fbe7a56 Merge pull request #8869 from giuseppe/make-rundir-accessible
systemd: make rundir always accessible
2021-01-04 12:22:52 -05:00
acbec396fd libpod API: pull: fix channel race
Fix a race condition in the pull endpoint caused by buffered channels.
Using buffered channels can lead to the context's cancel function to be
executed prior to the items being read from the channel.

Fixes: #8870
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-04 17:46:24 +01:00
d0093026a2 Allow image errors to bubble up from lower level functions.
Currently we ignore ErrMultipleImages being returned from findImageInRepoTags.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-04 10:51:54 -05:00
f261bfc549 Merge pull request #8859 from containers/dependabot/go_modules/github.com/google/uuid-1.1.3
Bump github.com/google/uuid from 1.1.2 to 1.1.3
2021-01-04 15:16:41 +01:00
8e4d19da15 Merge pull request #8863 from mgoltzsche/fix_seccomp_when_privileged
Disable seccomp by default when creating a privileged container.
2021-01-04 14:49:41 +01:00
8c6bbfbc42 test: fix variable name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-04 14:19:59 +01:00
898f57c4c1 systemd: make rundir always accessible
so that the PIDFile can be accessed also without being in the rootless
user namespace.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-04 14:19:58 +01:00
23f25b8261 Merge pull request #8823 from giuseppe/exec-honor-privileged
exec: honor --privileged
2021-01-04 10:53:44 +01:00