8546 Commits

Author SHA1 Message Date
7722b582b4 network, slirp4netns: add option to allow host loopback
Closes: https://github.com/containers/podman/issues/6912

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-16 22:37:27 +02:00
9be7029cdd libpod: pass down network options
do not pass network specific options through the network namespace.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-16 22:37:27 +02:00
8d12f19371 allow switching of port-forward approaches in rootless/using slirp4netns
As of podman 1.8.0, because of commit da7595a, the default approach of providing
port-forwarding in rootless mode has switched (and been hard-coded) to rootlessport,
for the purpose of providing super performance. The side-effect of this switch is
source within the container to the port-forwarded service always appears to originate
from 127.0.0.1 (see issue #5138).

This commit allows a user to specify if they want to revert to the previous approach
of leveraging slirp4netns add_hostfwd() api which, although not as stellar performance,
restores usefulness of seeing incoming traffic origin IP addresses.

The change should be transparent; when not specified, rootlessport will continue to be
used, however if specifying --net slirp4netns:slirplisten the old approach will be used.

Note: the above may imply the restored port-forwarding via slirp4netns is not as
performant as the new rootlessport approach, however the figures shared in the original
commit that introduced rootlessport are as follows:
slirp4netns: 8.3 Gbps,
RootlessKit: 27.3 Gbps,
which are more than sufficient for many use cases where the origin of traffic is more
important than limits that cannot be reached due to bottlenecks elsewhere.

Signed-off-by: Aleks Mariusz <m.k@alek.cx>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-15 08:04:35 +02:00
c4843d4e9c Merge pull request #6957 from rhatdan/sysdev
Mask out /sys/dev to prevent information leak from the host
2020-07-14 22:49:48 +02:00
f4edfe8430 Merge pull request #6964 from containers/dependabot/go_modules/github.com/containers/storage-1.21.1
Bump github.com/containers/storage from 1.21.0 to 1.21.1
2020-07-14 22:46:57 +02:00
50cd21e181 Merge pull request #6939 from rhatdan/entrypoint
Fix handling of entrypoint
2020-07-14 21:53:47 +02:00
c078e936bf Merge pull request #6951 from mheon/check_full_command
When determining systemd mode, use full command
2020-07-14 21:09:00 +02:00
a9a751feef Merge pull request #6931 from mheon/apply_sigproxy
Ensure sig-proxy default is propagated in start
2020-07-14 19:44:56 +02:00
ff8cd2db32 Bump github.com/containers/storage from 1.21.0 to 1.21.1
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.21.0 to 1.21.1.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.21.0...v1.21.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-14 13:38:16 -04:00
05988fc74f Add SystemdMode to inspect for containers
This allows us to determine if the container auto-detected that
systemd was in use, and correctly activated systemd integration.
Use this to wire up some integration tests to verify that systemd
integration is working properly.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-14 13:21:05 -04:00
6054985f87 Mask out /sys/dev to prevent information leak from the host
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-14 13:16:56 -04:00
6535c8b9e8 Fix handling of entrypoint
If a user specifies an entrypoint of "" then we should not use the images
entrypoint.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-14 13:10:03 -04:00
dc2ca45d75 When determining systemd mode, use full command
We were only using the Command field in specgen when determining
whether to enable systemd if systemd=true (the default) was used.
This does not include the entrypoint, and does not include any
entrypoint/command sourced from the image - so an image could be
running systemd and we'd not correctly detect this. Using the
full, final command resolves this and matches Podman v1.9.x
behavior.

Fixes #6920

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-14 12:55:37 -04:00
d83077b16c Merge pull request #6973 from baude/policygating
[CI:DOCS]Do not copy policy.json into gating image
2020-07-14 18:27:46 +02:00
cc1fd76ae0 [CI:DOCS]Do not copy policy.json into gating image
test/policy.json should not need to be copied into the gating image

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-07-14 11:01:12 -05:00
210f1040d2 Merge pull request #6952 from baude/systemdpid1fix
add systemd to fedora image
2020-07-14 17:59:12 +02:00
99cc076700 Fix systemd pid 1 test
fedora removed the systemd package from its standard container image causing our systemd pid1 test to fail.  Replacing usage of fedora to ubi-init.

adding ubi images to the cache for local tests.

also, remove installation of test/policy.json to the system wide /etc/containers

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-07-13 17:11:26 -05:00
3d3359086e Merge pull request #6959 from mheon/remove_seccomp_policy
[CI:DOCS] Remove outdated seccomp policy
2020-07-13 23:33:05 +02:00
237fe441b3 Remove outdated seccomp policy
Some time ago, we moved the Seccomp policy (and related setup
code) to a place where all our tools could share it [1]. We did
not, however, remove the in-repo seccomp.json file. Over the last
year or so, the in-repo seccomp policy has become progressively
more and more outdated, with no effort made to maintain it
(because what sense is there in keeping a duplicate?). Today, a
friend came to me and asked if a Podman container could access
keyctl, assuming it could not because he was reading the outdated
Seccomp policy which does not allow it. Since it's becoming clear
that this file is doing no good and actively causing confusion,
let's just drop it.

[1] https://github.com/seccomp/containers-golang

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-13 16:35:04 -04:00
d86acf2cae Merge pull request #6842 from rhatdan/pids-limit
Pids-limit should only be set if the user set it
2020-07-13 20:53:20 +02:00
e2a8e037d1 Merge pull request #6896 from mheon/fix_remote_createcommand
Fix container and pod create commands for remote create
2020-07-13 13:20:26 +02:00
e38001f123 Merge pull request #6926 from containers/dependabot/go_modules/github.com/containers/storage-1.21.0
Bump github.com/containers/storage from 1.20.2 to 1.21.0
2020-07-11 13:23:56 +02:00
88b8d2829c Merge pull request #6932 from rhafer/aa_priv
Don't setup AppArmor provile for privileged pods
2020-07-11 13:21:15 +02:00
a4e080fd2a Merge pull request #6936 from mheon/matt_cant_count
Correctly print STDOUT on non-terminal remote exec
2020-07-11 13:16:08 +02:00
1dc0a335fb Merge pull request #6929 from vrothberg/fix-9627
version/info: format: allow more json variants
2020-07-11 13:13:31 +02:00
be4b4bd862 Correctly print STDOUT on non-terminal remote exec
I confused STDIN and STDOUT's file descriptors (it's 0 and 1, I
thought they were 1 and 0). As such, we were looking at whether
we wanted to print STDIN when we looked to print STDOUT. This
bool was set when `-i` was set in at the `podman exec` command
line, which masked the problem when it was set.

Fixes #6890
Fixes #6891
Fixes #6892

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-10 17:15:33 -04:00
1d7175314c Merge pull request #6918 from skorhone/fix/hijacked_connection_handling
Fix: Correct connection counters for hijacked connections
2020-07-10 22:03:56 +02:00
677ad10e07 Pids-limit should only be set if the user set it
Currently we are sending over pids-limits from the user even if they
never modified the defaults.  The pids limit should be set at the server
side unless modified by the user.

This issue has led to failures on systems that were running with cgroups V1.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-10 12:46:16 -04:00
b3f15c09cd Don't setup AppArmor provile for privileged pods
This is essentially db218e7162c2 forward-ported to specgen

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-07-10 17:55:18 +02:00
dd30e0a73a Ensure sig-proxy default is propagated in start
We properly determined what sig-proxy should be set to, but we
never passed that along to the backend. As such, cases where the
default swapped (mostly when `--attach` was specified but the
`--sig-proxy` flag was not) were not handled correctly

Fixes #6928

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-10 11:37:30 -04:00
c4627b5846 Fix container and pod create commands for remote create
In `podman inspect` output for containers and pods, we include
the command that was used to create the container. This is also
used by `podman generate systemd --new` to generate unit files.

With remote podman, the generated create commands were incorrect
since we sourced directly from os.Args on the server side, which
was guaranteed to be `podman system service` (or some variant
thereof). The solution is to pass the command along in the
Specgen or PodSpecgen, where we can source it from the client's
os.Args.

This will still be VERY iffy for mixed local/remote use (doing a
`podman --remote run ...` on a remote client then a
`podman generate systemd --new` on the server on the same
container will not work, because the `--remote` flag will slip
in) but at the very least the output of `podman inspect` will be
correct. We can look into properly handling `--remote` (parsing
it out would be a little iffy) in a future PR.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-10 11:22:23 -04:00
bb9d939155 version/info: format: allow more json variants
Allow more variants to yield json output for `podman version` and
`podman info`.  Instead of comparing strings, use a regex and add
unit and e2e tests.

Fixes: #6927
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-10 15:44:17 +02:00
2ac8c69534 Merge pull request #6917 from mheon/retErr_for_libpod
Remove all instances of named return "err" from Libpod
2020-07-10 12:35:48 +02:00
e7085599f5 Bump github.com/containers/storage from 1.20.2 to 1.21.0
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.20.2 to 1.21.0.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.20.2...v1.21.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-10 06:30:06 -04:00
324a02ec60 Fix: Correct connection counters for hijacked connections
This patch fixes connection counters for v2 endpoints

Idletracker was moved to a new package to prevent package cycle.
Hijacking code still remains in wrong place and should be moved
later to isolated package

Signed-off-by: Sami Korhonen <skorhone@gmail.com>
2020-07-09 22:17:27 +03:00
8b07ae3278 Fix: Hijacking v2 endpoints to follow rfc 7230 semantics
After this patch v2 hijacking endpoints, exec/start and
containers/attach follow rfc 7230 specification.

Connection will only be upgraded, if client specifies upgrade
headers:

For tcp connections:

Connection: Upgrade
Upgrade: tcp

For unix socket connections:

Connection: Upgrade
Upgrade: sock

There are currently no checks if upgrade type actually matches with
available protocols. Implementation just protocol that client
requested

Signed-off-by: Sami Korhonen <skorhone@gmail.com>
2020-07-09 22:16:16 +03:00
cf64e3cad8 Remove hijacked connections from active connections list
StateHijacked is a terminal state. If hijacked connection
is registered as an active connection, connection will
never be unregistered. This causes two issues

First issue is that active connection counters are off.

Second issue is a resource leak caused by connection
object that is stored to a map.

After this patch hijacked connections are no longer
visible in counters. If a counter for hijacked
connections is required, podman must track
connections returned by Hijacker.Hijack()

It might make sense to develop abstraction layer for
hijacking - and move all hijacking related code to a
separate package. Hijacking code is prone to resource
leaks and it should be thoroughly tested.

Signed-off-by: Sami Korhonen <skorhone@gmail.com>
2020-07-09 22:16:07 +03:00
d9cd0032f7 Merge pull request #6906 from rhatdan/VENDOR
Vendor in new version of Buildah
2020-07-09 19:59:58 +02:00
4b784b377c Remove all instances of named return "err" from Libpod
This was inspired by https://github.com/cri-o/cri-o/pull/3934 and
much of the logic for it is contained there. However, in brief,
a named return called "err" can cause lots of code confusion and
encourages using the wrong err variable in defer statements,
which can make them work incorrectly. Using a separate name which
is not used elsewhere makes it very clear what the defer should
be doing.

As part of this, remove a large number of named returns that were
not used anywhere. Most of them were once needed, but are no
longer necessary after previous refactors (but were accidentally
retained).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-09 13:54:47 -04:00
059bd37511 Merge pull request #6835 from zhangguanzhang/master
fix API: Create container with an invalid configuration
2020-07-09 19:28:38 +02:00
bc3b3b373f Merge pull request #6916 from vrothberg/logs-fixes
log API: add context to allow for cancelling
2020-07-09 17:05:47 +02:00
b020d1ad13 Vendor in new version of Buildah
This also pulls in latest runc and containers/common

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-09 11:02:28 -04:00
f86782c052 Merge pull request #6814 from QiWang19/oci-dir
Fix saving in oci format
2020-07-09 16:38:39 +02:00
5c6002bf9d Remove dependency on github.com/opencontainers/libpod/configs
We are using these dependencies just to get the device from path.
These dependencies no longer build on Windows, so simply cloning
the deviceFromPath function, we can eliminate the need for this
vendoring.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-09 10:03:40 -04:00
d0ebea0643 logs: enable e2e tests
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-09 15:18:15 +02:00
09dc77aedf log API: add context to allow for cancelling
Add a `context.Context` to the log APIs to allow for cancelling
streaming (e.g., via `podman logs -f`).  This fixes issues for
the remote API where some go routines of the server will continue
writing and produce nothing but heat and waste CPU cycles.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-09 15:13:07 +02:00
a1d6114177 Fix saving in oci format
- fix saving&loading oci format. Close #6544
- support loading using image name without "localhost/" prefix when reading from ociarchive/dir saved from this semantics

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-07-09 08:03:54 -04:00
2086e22624 fix API: Create container with an invalid configuration
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-07-09 10:26:04 +08:00
edf5fe8b17 Merge pull request #6889 from mheon/update_master_releasenotes
[CI:DOCS] Update release notes on Master for v2.0.2
2020-07-08 16:17:26 -04:00
b1623a1ba5 Update release notes on Master for v2.0.2
Also update README to reflect the new release.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-08 15:54:09 -04:00