7081 Commits

Author SHA1 Message Date
156ce5cd7d add pkg/capabilities
Add pkg/capabibilities to deal with capabilities.  The code has been
copied from Docker (and attributed with the copyright) but changed
significantly to only do what we really need.  The code has also been
simplified and will perform better due to removed redundancy.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-14 12:00:45 +01:00
d26edff820 build(deps): bump github.com/rootless-containers/rootlesskit
Bumps [github.com/rootless-containers/rootlesskit](https://github.com/rootless-containers/rootlesskit) from 0.7.2 to 0.8.0.
- [Release notes](https://github.com/rootless-containers/rootlesskit/releases)
- [Commits](https://github.com/rootless-containers/rootlesskit/compare/v0.7.2...v0.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-14 11:50:01 +01:00
b4fa6f4f08 Fix SELinux labels of volumes
If we attempt to label a volume and the file system
does not support labeling, then just warn.  SELinux
may or may not work, on the volume.

There is no way to setup a private label on a newly
created volume without using the container mountlabel.

If we don't have a mount label at the time of creation of
the volume, the only option we have is to create a shared
label.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-13 21:42:57 -05:00
3fd9f0c028 podman(1): fixes
I saw some bad formatting when reading "man podman-run" and
proceeded to fix it. I have now opened a can of worms...

This commit tries to fix some of the formatting, wording and
other bugs I came across (unfortunately not all of them).

Can't list every fix that I made here, but in general:
- format lists as such (prepend items with "- ");
- format examples as such (enclose in ```...```);
- format literal values (option names, literal values) as **bold**;
- format man page references as **page**(1).
- format replacements (option values) and file names as _italic_;
- remove some duplicate info (such as what's the default value);
- move option value description to option syntax;
- end sentences with a period.

To test:
```console
$ make docs
$ man ./docs/build/man/podman-run.1 ### check terminal formatting
$ man -Tps ./docs/build/man/podman-run.1 > podman-run.ps
$ ps2pdf podman-run.ps ### optional
$ evince podman-run.pdf ### check printer formatting (or use ps viewr
```

NOTE
 - there is much more to do here;
 - I haven't checked any factual contents, this is about formatting

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-02-13 16:28:31 -08:00
0c060dace1 Merge pull request #5190 from baude/apiv2cockpit3
filtering behavior correction
2020-02-14 00:32:33 +01:00
1b290f995b Merge pull request #5074 from jwhonce/wip/swagger_endpoint
Add /swagger/ endpoint to serve swagger yaml to clients
2020-02-14 00:32:26 +01:00
ebfd253fc6 fix bug "" disable detach keys
fix #5166
This patch enables `--detach-keys ""` to disable the feature. "ctrl-p, ctrl-q" will not work after this command.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-02-13 16:57:13 -05:00
3e0475eb88 Merge pull request #5189 from mheon/only_set_all_on_status
Only set --all when a status filter is given to ps
2020-02-13 20:51:22 +01:00
27f861f785 Fixed a bug about bash automatically complete
When I input podman start in bash , and then type tab , cannot automatically complete container name , this pr will fix the bug .

Signed-off-by: 李俊杰 <phpor@users.noreply.github.com>
2020-02-14 00:10:37 +08:00
9abfc32e05 Enhance fuse-overlayfs instructions.
The `fuse-overlayfs` package provided by Ubuntu up to 19.10,  is not
recent enough and causes errors on `buildah commit`, for instance.

Adjust the rootless tutorial to point this out and to provide more
detailed instructions on how to obtain `fuse-overlayfs` and configure it
for use by `libpod`.

Signed-off-by: Leonardo Rochael Almeida <leorochael@gmail.com>
2020-02-13 12:58:05 -03:00
e4e5efc12b Merge pull request #5195 from vrothberg/fix-5106
[CI:DOCS] README: fix docs links
2020-02-13 16:00:51 +01:00
cd9e6b4143 Merge pull request #5172 from giuseppe/api-fix-cpu-stats
api: fix the CPU stats reported
2020-02-13 15:42:53 +01:00
f8443eb83a README: fix docs links
Fix: #5106
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-13 14:28:58 +01:00
f4b5e600a1 Merge pull request #5179 from containers/dependabot/go_modules/k8s.io/api-0.17.3
build(deps): bump k8s.io/api from 0.17.2 to 0.17.3
2020-02-13 13:45:00 +01:00
d6ba8b4110 Merge pull request #5177 from rhatdan/kube
Fix up play kube to use image data
2020-02-13 13:09:07 +01:00
5418c9c06b Fix up play kube to use image data
podman play kube was ignoring the
imageData.Config
   Volumes
   WorkingDir
   Labels
   StopSignal

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-13 05:46:27 -05:00
2814995a92 Merge pull request #5115 from QiWang19/images-format
images --format compatible with docker
2020-02-13 11:42:47 +01:00
990a4fb57e build(deps): bump k8s.io/api from 0.17.2 to 0.17.3
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.17.2 to 0.17.3.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](https://github.com/kubernetes/api/compare/v0.17.2...v0.17.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-13 10:11:26 +01:00
a9969c23a3 Merge pull request #5191 from baude/fedoraminimaliskillingme
use quay.io/libpod/fedora-minimal for reliability
2020-02-13 04:56:28 +01:00
5ea6cad20c Merge pull request #5183 from giuseppe/rootlessport-avoid-hang
rootlessport: fix potential hang
2020-02-13 02:50:41 +01:00
c16e12f6c5 Merge pull request #5181 from containers/dependabot/go_modules/github.com/gorilla/mux-1.7.4
build(deps): bump github.com/gorilla/mux from 1.7.3 to 1.7.4
2020-02-13 02:34:57 +01:00
502a87a1b1 Merge pull request #5180 from containers/dependabot/go_modules/k8s.io/apimachinery-0.17.3
build(deps): bump k8s.io/apimachinery from 0.17.2 to 0.17.3
2020-02-13 02:34:50 +01:00
a65f6b888a Merge pull request #5152 from QiWang19/device-cgroup-rule
support device-cgroup-rule
2020-02-13 02:34:42 +01:00
d2100cd473 Only set --all when a status filter is given to ps
The changes in #5075 turn out to be too aggressive; we should
only be setting --all if a status= filter is given. Otherwise
only running containers are filtered.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-12 20:14:20 -05:00
2aacfade75 use quay.io/libpod/fedora-minimal for reliability
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-12 16:45:03 -06:00
ce7c9c998c filtering behavior correction
when filtering containers, if a status= is provided as an input filter, then we should override the all to always be true.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-12 16:08:07 -06:00
2281cbdd6d Merge pull request #5171 from baude/apiv2cockpit2
Fix container filters
2020-02-12 22:43:59 +01:00
d3260738d3 support device-cgroup-rule
fix #4876
Add `--device-cgroup-rule` to podman create and run. This enables to add device rules after the container has been created.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-02-12 14:30:23 -05:00
e74ad35963 Merge pull request #5187 from vrothberg/pkg-seccomp
add pkg/seccomp
2020-02-12 19:13:23 +01:00
5b69e7f2ef rootlessport: drop Pdeathsig in favor of Kill
there is a race condition where the child process is immediately
killed:

[pid 2576752] arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdf612f170) = -1 EINVAL (Invalid argument)
[pid 2576752] access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
[pid 2576752] --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=2576742, si_uid=0} ---
[pid 2576752] +++ killed by SIGTERM +++

this happens because the parent process here really means the "parent
thread".

Since there is no way of running it on the main thread,
let's skip this functionality altogether and use kill(2).

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-12 18:48:42 +01:00
dd5df42be9 Merge pull request #5168 from mheon/do_not_overwrite_volumes
Do not copy up when volume is not empty
2020-02-12 18:46:35 +01:00
2550ded989 rootlessport: fix potential hang
write to the error pipe only in case of an error.  Otherwise we may
end up in a race condition in the select statement below as the read
from errChan happens before initComplete and the function returns
immediately nil.

Closes: https://github.com/containers/libpod/issues/5182

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-12 18:13:30 +01:00
65d10ffab3 add pkg/seccomp
Add pkg/seccomp to consolidate all seccomp-policy related code which is
currently scattered across multiple packages and complicating the
creatconfig refactoring.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 17:10:18 +01:00
c140ecdc9b Do not copy up when volume is not empty
When Docker performs a copy up, it first verifies that the volume
being copied into is empty; thus, for volumes that have been
modified elsewhere (e.g. manually copying into then), the copy up
will not be performed at all. Duplicate this behavior in Podman
by checking if the volume is empty before copying.

Furthermore, move setting copyup to false further up. This will
prevent a potential race where copy up could happen more than
once if Podman was killed after some files had been copied but
before the DB was updated.

This resolves CVE-2020-1726.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-12 10:58:42 -05:00
0e9c637c42 Merge pull request #5185 from vrothberg/v2-pull-fix
[CI:DOCS] api: pull: fix reference parsing
2020-02-12 16:55:06 +01:00
62e20b6cd8 Merge pull request #5184 from vrothberg/refactor-pull
cmd/podman/pull: refactor code
2020-02-12 16:15:33 +01:00
9fbacd8305 api: pull: fix reference parsing
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 15:25:25 +01:00
61b890268a cmd/podman/pull: refactor code
Refactor and simplify the code in cmd/podman/pull.go to address a couple
of issues w.r.t. how the arguments were passed.  Also make sure to
always use the c/image API for parsing instead of working around it.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 15:11:17 +01:00
e223675625 Merge pull request #5144 from marusak/doc_fixes
[CI:DOCS] podman system service doc fixes
2020-02-12 13:48:56 +01:00
be37d144e7 Merge pull request #5175 from baude/apiv2events
apiv2 stream events
2020-02-12 13:28:55 +01:00
4f44a1a3a2 Merge pull request #5165 from edsantiago/test_apiv2
API v2 tests: catch up to moving target
2020-02-12 12:56:19 +01:00
510fa4ebc8 stats: add SystemUsage
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-12 11:58:29 +01:00
964a2c0e2d build(deps): bump k8s.io/apimachinery from 0.17.2 to 0.17.3
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.17.2 to 0.17.3.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.17.2...v0.17.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-12 05:21:49 -05:00
b916263d01 build(deps): bump github.com/gorilla/mux from 1.7.3 to 1.7.4
Bumps [github.com/gorilla/mux](https://github.com/gorilla/mux) from 1.7.3 to 1.7.4.
- [Release notes](https://github.com/gorilla/mux/releases)
- [Commits](https://github.com/gorilla/mux/compare/v1.7.3...v1.7.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-12 05:20:50 -05:00
d0452ae6f3 Merge pull request #5176 from edsantiago/304_is_not_an_error
HTTP 304 (NotModified) is not an error!
2020-02-12 09:19:44 +01:00
ba30bb8409 HTTP 304 (NotModified) is not an error!
Even after #5169, my test logs kept showing:

   ERRO[0004] unable to write json: "http: request method or response status code does not allow body"

Cause: overly-helpful code trying to treat condition as an
error and include a diagnostic message. This is forbidden
per rfc2616.

This PR fixes the faulty response, as well as three others
found via:

    $ ack 'Error.*NotMod'  (4 hits total)
    $ ack 'Error.*NoCont'  (no hits)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 15:15:20 -07:00
0af16eb15b API v2 tests: catch up to moving target
Lots has changed since I first checked this in:

 * Switch to new podman system service invocation
 * /containers API has changed drastically
 * /pods API has some fixes; check for them (e.g.
   container-exists is now 409 Conflict, not 500)
 * One test ('?invalidparam=x') still doesn't work;
   comment it out so we can get everything passing.

Also, some work on the test framework itself:

 * Cleaner port-open testing (the bash /dev/tcp check).
 * Add a 'podman' function to invoke local podman and
   log its output.

The above two allow us to:

 * Get rid of stderr special-casing

Furthermore:

 * t() no longer needs leading '.'; this allows jq
   features such as 'length' and perhaps other filters
 * special-case handling of 204 and 304: rfc2616 demands
   that they return no message body; assert that it is so.
 * new root & rootless helper functions (check server)
 * remove the "unlikely to work" message for rootless;
   it seems to be working fine
 * fix pod tests for rootless
   * BUT: add a bolder FIXME because the ID field seems wrong

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 14:31:12 -07:00
6215e1bb21 api: fix the CPU stats reported
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-11 22:24:14 +01:00
4bdfeed5bf Merge pull request #5169 from edsantiago/apiv2_pod_status_codes
API v2: pods: fix two incorrect return codes
2020-02-11 22:22:55 +01:00
5b830cca90 apiv2 stream events
the events endpoint should be stream-based.  it also needed to be registered to answer and not produce 404s.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-11 15:00:41 -06:00