16295 Commits

Author SHA1 Message Date
d122aa4935 Merge pull request #15469 from edsantiago/test_cleanup_apiv2
APIv2 test cleanup
2022-08-25 10:23:33 +02:00
274a533ef1 Merge pull request #15455 from baude/issue15247
Allow colons in windows file paths
2022-08-25 10:06:55 +02:00
c9565b051c Merge pull request #15467 from giuseppe/mount-test-private
test: use private instead of slave for the mount
2022-08-25 03:16:03 -04:00
10b4605124 Remove duplicate annotations in generated service yaml
Don't add the same annotations as the pod yaml to the
service yaml as it is not needed.

[NO NEW TESTS NEEDED]

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-08-24 23:47:38 -04:00
61fe95bb4f Preserve all unknown PolicyRequirement fields on (podman image trust set)
We are unmarshaling and re-marshaling JSON, which can _silently_ drop data
with the Go design decision.data.

Try harder, by using json.RawMessage at least for the data we care about.

Alternatively, this could use json.Decoder.DisallowUnknownFields.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
ad0c785f8e Reorganize the types in policy.go a bit
... to go from top to bottom.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
a7e88c8dac Add support for showing keyPaths in (podman image trust show)
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
752eceaecc Support (image trust show) for sigstoreSigned entries
sigstoreSigned does not have GPG IDs, so we add N/A in that column.

NOTE: this does not show the use-sigstore-attachments value from
registries.d.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
b36a1d1b79 BREAKING CHANGE: Change how (podman image trust show) represents multiple requirements
Currently
- the output uses the first entry's type, even if the requirements are different
  (notably signedBy + sigstoreSIgned)
- all public keys IDs are collected to a single line, even if some of them
  are interchangeable, and some are required (e.g. two signedBy requirements
  could require an image to be signed by (redhatProd OR redhatBeta) AND (vendor1 OR vendor2)

So, stop collapsing the requirements, and return a separate entry for each one. Multiple
GPG IDs on a single line used to mean AND or OR, now they always mean AND.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
bba306788a Reorganize descriptionsOfPolicyRequirements a bit
Do the registries.d lookup once, separately from building
an entry, so that we can share it across entries.

Also prepare a separate res to allow adding multiple entries.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
2f6c145e86 Use the full descriptionsOfPolicyRequirements for the default scope
... instead of taking a shortcut, e.g. not listing any keys if they are required.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
b15afce551 Rename haveMatchRegistry to registriesDConfigurationForScope
Just so that we don't have a boolean-named function returning a struct.
Also reorder the parameters to have the container first, and the lookup
key second.

Shoud not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
1a97c4d9fa Rename tempTrustShowOutput to entry
Now that it is the primary return value of a small function,
the long name only makes reading harder.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:59 +02:00
51064acc49 Split descriptionsOfPolicyRequirements out of getPolicyShowOutput
This will evetually allow us to use it for the default scope
as well, which currently uses a simplified version.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:52:57 +02:00
d4c5217280 Recognize the new lookaside names for simple signing sigstore
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:51:59 +02:00
4df1e2524b Add a unit test for trust.PolicyDescription
Add at least a basic unit test for the various entry types.

So that we don't have to actually deal with GPG keys and /usr/bin/gpg*,
parametrize the code with a gpgIDReader , and pass a fake one
in the unit test.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:51:58 +02:00
4b2bd1036b Make the output of (podman image trust show) deterministic
Sort map keys instead of iterating in the Go-imposed random order.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
35fa8c16a2 Make most of pkg/trust package-private
We now have only a few entrypoints that are called externally,
so make the rest private.  This will make it more obvious that
we are not breaking any external users.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
7723a1ea65 Move most of ImageEngine.ShowTrust into pkg/trust.PolicyDescription
This will allow us to write unit tests without setting up the complete Podman runtime
(and without the Linux dependency).

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
ff3f574fc0 Add support for sigstoreSigned in (podman image trust set)
NOTE: This does not edit the use-sigstore-attachments value
in registries.d, similarly to how (podman image trust set) didn't
set the lookaside paths for simple signing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
9828bc4453 Create new policy entries together with validating input
That way, we don't have to switch over trustType twice.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
e2d1bdd1d8 Improve validation of data in ImageEngine.SetTrust
- Also reject public keys with types that don't use them
- Reject unknown trust types
- And add unit tests

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
cbdbb025a3 Move most of imageEngine.SetTrust to pkg/trust.AddPolicyEntries
This will allow us to write unit tests without setting up the complete Podman runtime
(and without the Linux dependency).

Also, actually add a basic smoke test of the core functionality.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:42 +02:00
0ff0fde49e Man pages: refactor common options: log-related options
podman-logs and podman-pod-logs. Most of these were already
identical, needing no review. Exceptions:

  --follow : needed some container/pod tweaking. This is the
             only one that really needs careful review.

  --names  : I went with the longer version

Note that podman-events has --since and --until options too, but
those are too different to be combined here.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-08-24 17:48:02 -06:00
4f68075306 Add a variable for scope
Only process the incoming args[] (which is a single-element array
for some reason) once, and use a semantic variable name for the value
we care about.

Should not change behavior, the only caller already supposedly ensures
that len(args) == 1.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 00:35:59 +02:00
4c5366ee03 Make trust.CreateTempFile private
Nothing uses it outside the package.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 00:35:59 +02:00
5be00f2270 Reorganize pkg/trust
Split the existing code into policy.go and registries.go,
depending on which files it concerns.

Only moves unchanged code, should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 00:35:58 +02:00
1d2def8d06 Remove an unused trust.ShowOutput type
Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 00:35:08 +02:00
df1d8d0e93 Remove commented out code
We can always recover it from git, but it seems to serve
no purpose anyway.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 00:33:02 +02:00
010d495a34 APIv2 test cleanup
Whole slew of bugs that got introduced while I wasn't paying
attention. Most of them are of the form "let's use hand-crafted
curl commands and do our own error checking and exit uncleanly
on error and leave the system in an unstable state". To be
fair, those were done because there was no existing mechanism
for uploading JSON files or somesuch. So, add one.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-08-24 15:15:00 -06:00
a933269ba5 System test cleanup
Misspellings, broken code, missing tests

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-08-24 14:48:13 -06:00
35b4f26c70 test: use private instead of slave for the mount
using "slave" means that every mount operation on the host that
happens between the mount creation for `/host` and running `findmnt`
will be propagated to the container mount.  To prevent new mounts on
the host to appear in the container thus invalidating the test we
have, just create the mount as private and use `/sys` as source as it
has multiple mounts on the top but less likely to get new mounts once
it is configured.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-24 22:24:09 +02:00
9a83fe33b5 Merge pull request #15433 from arixmkii/win_compat3_rootless
Fixes isRootful check using qemu machine on Windows
2022-08-24 16:17:32 -04:00
6f4a6011d3 Merge pull request #15458 from edsantiago/docs_dedup_pid
[CI:DOCS] Man pages: refactor common options: --pid
2022-08-24 14:55:05 -04:00
46bfd3d0cf Merge pull request #15454 from vrothberg/bump-psgo
vendor containers/psgo@v1.7.3
2022-08-24 14:27:37 -04:00
2fed2a2829 Man pages: refactor common options: --pid
I chose the one from podman-run, but reordered ns/private
to put them in alphabetical order.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-08-24 11:48:43 -06:00
361eb42619 Merge pull request #15434 from rhatdan/manifest1
Allow podman to run in an environment with keys containing spaces
2022-08-24 13:29:20 -04:00
2b05f4a0e6 Merge pull request #15459 from giuseppe/fix-test-comment
test: fix comment
2022-08-24 13:25:55 -04:00
ea67d84f5a test: fix comment
it is not a kernel bug.

Rootless users are not allowed to use non recursive bind mounts,
otherwise they would be able to uncover mounts that were not visible
before to them.

[CI:DOCS] it is just a comment fix.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-24 17:39:15 +02:00
19a617eaab Allow colons in windows file paths
the `podman save` command was failing on windows due to the use of a
colon between the drive letter and first directory.  the check was
intended for Linux and not windows.

Fixes #15247

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-08-24 10:31:42 -05:00
1788b26c43 Fixes isRootfull check using qemu machine on Windows
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
2022-08-24 18:17:18 +03:00
88e4e4c82e vendor containers/psgo@v1.7.3
Add three new capabilities that would otherwise be reported as unknown.

Also add an e2e test making sure that `podman top` knows all
capabilities of the current kernel.  I refrained from adding a system
test since this may blow up in gating tests.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-08-24 17:13:58 +02:00
34d516840d Merge pull request #15453 from edsantiago/docs_dedup_ipc
[CI:DOCS] Man pages: refactor common options: --ipc
2022-08-24 10:15:34 -04:00
082388a159 Merge pull request #15439 from rhatdan/service
Fix documentation of use of tcp connections
2022-08-24 09:59:31 -04:00
0f92cf22a6 Merge pull request #15437 from mheon/default_volume_timeout
Add support for containers.conf volume timeouts
2022-08-24 09:35:57 -04:00
67c4068bb3 Merge pull request #15443 from flouthoc/env-merge-support
run,create: add support for `--env-merge` for preprocessing default environment variables
2022-08-24 09:14:42 -04:00
33ab7e846a Man pages: refactor common options: --ipc
This is not an easy one to review, sorry.

I went with the version from podman-create. The differences
against podman-run are subtle: apostrophes, whitespace, and
the arg description in the '####' line. Suggestion for review:
run hack/markdown-preprocess-review, then after you finish
with that, cd /tmp/markdown<TAB>/ipc and use your favorite
two-file diff tool to compare podman-run* against zzz*.

I did not even try to combine the podman-build one; that one
is too different.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-08-24 06:58:20 -06:00
1bcceadca4 Merge pull request #15450 from edsantiago/docs_dedup_gidmap
[CI:DOCS] Man pages: refactor common options: --gidmap
2022-08-24 08:56:34 -04:00
2195656d9e Merge pull request #15444 from foriequal0/podman-docker-rootless
Rootless Docker API socket alias can be exposed with user mode systemd-tmpfiles
2022-08-24 08:54:01 -04:00
e4cbbe7862 Merge pull request #15447 from sstosh/e2e-memswap
e2e: Add run --memory-swap test
2022-08-24 08:48:57 -04:00