Commit Graph

339 Commits

Author SHA1 Message Date
Ashley Cui c92b4705d1 Add to default machine volumes for MacOS
On MacOS, mount /Users, /private/, /var/folders by default for better docker compat. The homedir on MacOS is /Users/<username>, so that will be mounted automatically anyway with this change.

Docker also mounts /Volumes and /tmp, /Volumes fails with a Too many levels of symbolic links, as Volumes on Mac is just a symlink to / which seems like a bad idea to mount anyway.
/tmp fails because the Podman machine uses the tmp directory inside the machine and writes content to it on boot, causing the mount to fail. However, on Mac, /tmp is symlinked to /private/tmp anyway, so those files are accessible from there.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-12-09 15:36:20 -05:00
OpenShift Merge Robot a4cd996652 Merge pull request #1252 from rhatdan/caps
Rework default list of capabilities to minimal
2022-12-06 09:17:16 -05:00
Daniel J Walsh e2fb8c5133 Add ReadOnly flag to run containers in readonly mode
This is needed for Automotive.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-05 06:05:56 -05:00
Daniel J Walsh c552ab433d Revert "Revert "Rework default list of capabilities to minimal""
This reverts commit 91ba27095f.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-04 16:12:04 -05:00
OpenShift Merge Robot 23636dda9a Merge pull request #1243 from vrothberg/RUN-1702
containers.conf: add events_container_create_inspect_data
2022-11-28 07:44:29 -05:00
Valentin Rothberg 821a0657ca containers.conf: add events_container_create_inspect_data
Add an option to create a more verbose container-create event which
includes a JSON payload with detailed information about the container.

Jira: https://issues.redhat.com/browse/RUN-1702
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-28 13:01:46 +01:00
Daniel J Walsh f8045ec731 Remove conmon probe
This is taking time on every podman call, and provide limited
protection. Versioning should be handled in the packaging system
and this is an unlikely to happen.

Every exec done by container tools hurts us as we try to get container
startup team to absolute minimal amounts.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-27 07:16:29 -05:00
Valentin Rothberg 91ba27095f Revert "Rework default list of capabilities to minimal"
This reverts commit 962dbc3281.
As shown in containers/podman/pull/16610 the changes require a number of
changes in Podman's CI.  While many issues have been fixed in that PR,
there are some potentially controversial changes such as dropping
NET_RAW.

Let's revert the commit to unblock ongoing work.  For the next
iteration, Podman CI must be green before merging.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-25 09:37:41 +01:00
OpenShift Merge Robot 32d0d9fc59 Merge pull request #1239 from giuseppe/validate-cdi-devices
validate: ignore validation of CDI devices
2022-11-23 04:55:47 -05:00
OpenShift Merge Robot 5034979776 Merge pull request #1240 from rhatdan/caps
Rework default list of capabilities to minimal
2022-11-23 03:39:04 -05:00
Daniel J Walsh 962dbc3281 Rework default list of capabilities to minimal
For a couple of years now we have been shipping containers.conf settings
to use only 10 capabities. Docker uses 14, with the difference being
CAP_AUDIT_ALLOW, CAP_NET_RAW, CAP_MKNOD, CAP_CHROOT.

This allows us to run with a tighter security then Docker.

This PR makes the change to default config, so that if no
containers.conf overrides are present, we will run with the tighter
security. Currently most distros that ship the containers.conf already
run with this setting, but this makes it formal, and changes the man
page to match the defaults.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-22 12:55:25 -05:00
Giuseppe Scrivano 76d4399a75 validate: ignore validation of CDI devices
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-11-21 22:40:48 +01:00
Daniel J Walsh 3a429400c3 Deprecate UserNSSize, since we don't use it
Podman and Buildah do not use this field, and I
know of no users of it, remove it from docs and
the default conf file, so users will not expect
it to do anything.

Leaving implementation in the slight chance someone
has used it in a non containers project.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-21 13:06:10 -05:00
OpenShift Merge Robot 43bae401c0 Merge pull request #1225 from flouthoc/platform-to-oci-runtime
config: add support for `platform_to_oci_runtime` and default entries for `wasi/wasm`
2022-11-11 16:04:27 +00:00
Aditya R 1ea30aa853 config: add support for platform_to_oci_runtime and default entries for wasm
Containers.conf now supports `platform_to_oci_runtime` which allows end
users to map variant of OCI runtime for a particular platform.

Most ideal use-case of this feature is switching to crun's variant when
platform string is `wasm32/wasi`.

Example
```toml
[engine.platform_to_oci_runtime]
"wasi/wasm" = "crun-wasm"
"wasm/wasm32" = "crun-wasm"
"wasm/wasm64" = "crun-wasm"
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-11-11 20:44:59 +05:30
Doug Rabson 4b906d8159 pkg/config: Fix DefaultSignaturePath on FreeBSD
The correct location on FreeBSD is /usr/local/etc/containers/policy.json
which is consistent with path conventions for installed packages. This
fixes 'podman commit' on FreeBSD.

There are several definitions of this path:

- c/image/signature has builtinDefaultPolicyPath and DefaultPolicy
- c/podman/pkg/trust has systemDefaultPolicyPath and DefaultPolicyPath
- c/common/pkg/config has DefaultSignaturePolicyPath

As far as I can tell, buildah uses c/image/signature which is why 'buildah
commit' was already working for me. Podman is using the c/common one. Very
confusing.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-11-09 16:50:45 +00:00
unknowndevQwQ 5db50a2cb8 feat: add support for the youki OCI Runtime 2022-10-22 10:35:23 +08:00
Doug Rabson 8d0af4f01e config: Add config entry for ocijail
Another experimental OCI runtime for FreeBSD, similar to runj but with
a focus on podman/buildah compatiblity.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-10-19 12:02:47 +01:00
Valentin Rothberg e17483b871 bump to golangci-lint v1.50.0
Used `go fmt` rules to migrate away from deprecated functions, for
instance `gofmt -w -s -r 'ioutil.TempDir(a, b) -> os.MkdirTemp(a, b)'`

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-17 15:03:07 +02:00
Daniel J Walsh fc1a4a31ee Vendor in latest containers/(storage, image) and runtime-tools
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-10-14 09:58:29 -04:00
Jason T. Greene 45154dcc7e Fix Windows regression introduced by PR #1161
Before 50eb74a4b1 this code used unshare.IsRootless() which on Windows
always returns false (the behavior we want).

After 50eb74a4b1, a condition was unintentionally inverted, allowing
Windows to function.

Commit 18803495e8 fixed the inversion, but unintentionally excluded Windows
since it used == 0 instead of <= 0 (Windows returns -1)

Move the logic behind a function with a comment since the Windows path is a
bit exotic.

In the future, the Windows path should likely be refactored to be more
intuitive; however, this will get things working for now.

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-09-29 15:39:23 -05:00
Charlie Doern 2b86bc5d8a podman machine and podman-remote need some softer handling when it comes to key verification
this ensures that podman machine will still work (until we want to make this mandatory). I made the call back function more verbose so we know what is happening from now on.

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-09-26 15:36:00 -04:00
Giuseppe Scrivano 18803495e8 config: correct the check for root
originally the code had the condition "!unshare.IsRootless()", and
commit 50eb74a4b1 introduced the issue
by replacing it with "unshare.GetRootlessUID() != 0".

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-09-20 17:14:48 +02:00
Giuseppe Scrivano 50eb74a4b1 config: look user id instead of rootless
Change the check to look for the UID to decide whether to load the
default configuration files from the user directory instead of the
system path.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-09-16 16:46:09 +02:00
Paul Holzinger 7fff18ce94 phg/config: do not force default EventsLogFilePath
The problem with setting such defaults in c/common is that podman cannot
know if a user set this or it is the default. EventsLogFilePath is not a
static path, it depends on the --tmpdir value from podman.

check
b0b36430b8/libpod/runtime.go (L1041-L1043)

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-09 15:07:58 +02:00
Doug Rabson ccbe0c12ac Change default cgroups mode to enabled on FreeBSD
Setting it to disabled triggers NoCgroups logic in podman which adds
extra validation and changes the conmon command line in ways that are
messy to work around. It turns out that pretending cgroups is enabled
even though the platform doesn't support it is easier.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-08-27 11:14:54 +01:00
OpenShift Merge Robot af3185ad19 Merge pull request #1119 from rhatdan/path
Add support for returning image path with ARCH and OS Substitutions
2022-08-23 09:06:05 -04:00
Filipe Brandenburger bd82c36998 config: Update Darwin config to include a directory relative to $BINDIR
Look for helpers such as `gvproxy` under `$BINDIR/../libexec/podman`, which
helps this work on distributions such as Homebrew without the need to hardcode
paths into the binary, which makes a pre-built binary distribution work
regardless of the installation prefix.

Tested: Updated vendored package in podman, built it with `podman-remote`,
copied `gvproxy` to a `libexec/podman` at the same level as `bin/podman` and
confirmed that `podman machine start` worked as expected.

Signed-off-by: Filipe Brandenburger <filbranden@gmail.com>
2022-08-22 13:28:00 -07:00
Filipe Brandenburger de5bad0cc3 config: Allow specifying helper dirs with $BINDIR as base directory
This should make it easier to locate helper binaries relative to where the main
binary was installed, which should be useful in installations such as Homebrew
which install packages under a versioned directory.

Use a `$BINDIR` magic token as a prefix in the helper path to indicate it should
be relative to the directory where the binary is located. This is somewhat familiar
to the syntax used in the shell and Makefile and is still quite explicit about the
behavior (as opposed to, say, making all relative paths be relative to the directory
of the binary.)

Tested: After updating the Darwin config to include a `$BINDIR/../libexec/podman`
directory, updated vendored package in podman, built it with `podman-remote`,
copied `gvproxy` to a `libexec/podman` at the same level as `bin/podman` and
confirmed that `podman machine start` worked as expected. Also confirmed that
having the `podman` in search path be a symlink to a binary elsewhere works as
expected, the searched `../libexec/podman` directory is relative to the actual
binary and not the symlink (which matches the Homebrew use case.)

Signed-off-by: Filipe Brandenburger <filbranden@gmail.com>
2022-08-22 13:28:00 -07:00
OpenShift Merge Robot 07298b23a3 Merge pull request #1129 from mheon/add_volume_timeout
Add volume plugin timeout to containers.conf
2022-08-22 15:43:51 -04:00
Matthew Heon 4f7bd530ae Add volume plugin timeout to containers.conf
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-08-22 14:39:23 -04:00
Daniel J Walsh 3196de901c Add support for returning image path with ARCH and OS Substitutions
Allow distributions to specify the location of the podman image VM
images in the form of URIs with $ARCH and $OS specified.  This would
allow a distribution to pull the image based on the current OS and Arch.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-22 07:17:58 -04:00
Arthur Sengileyev 30d0948da5 Adjust default volumes for windows compatibility
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
2022-08-19 17:09:25 +03:00
Giuseppe Scrivano e4edaae628 config: return correct error
_conmonVersionFormatErr is a format string and it needs an error
argument.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-17 14:40:01 +02:00
Giuseppe Scrivano 815258862e config: look at the conmon-rs version string
instead of looking at the binary name, look at the different version
format used by conmon-rs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-16 23:30:17 +02:00
Jake Correnti 5128b5a72f Add conmon-rs paths
Adds the conmon-rs paths so Podman can find the right conmon-rs binary
when making a new runtime.

I also slightly modified the `FindConmon` function so that the code
could be shared with the `FindConmonRs` function that I added.

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-08-10 10:46:26 -04:00
Charlie Doern 64be63d976 ssh package
initial implementation of the ssh package including:

- nativeConnectionCreate() / golangConnectionCreate()
- n/a / golangConnectionDial()
- nativeConnectionScp() / golangConnectionScp()
- nativeConnectionExec() / golangConnectionExeC()

the way this works, is there are publicly accessible functions Create, Exec, Dial and Scp. podman will have a new global flag --ssh` that will allow users to choose native or golang based ssh functions. The functionality in containers/common (here) also checks if you have the necessary binaries installed

closes #1091

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-08-08 09:22:46 -04:00
openshift-ci[bot] 765893536d Merge pull request #1077 from saschagrunert/errors
Switch to golang native error wrapping
2022-07-12 11:21:37 +00:00
Sascha Grunert 426d69c00f Switch to golang native error wrapping
`github.com/pkg/errors` is deprecated since quite some time so we now
use the native error wrapping for more idiomatic golang.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-12 10:54:07 +02:00
Dominique Martinet 2e8943d3f7 add network dns_bind_port setting and set NETAVARK_DNS_PORT from it
This commit allows using aardvark with an alternate port as per
implementation in containers/netavark#323

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2022-07-08 09:45:15 +09:00
Dominique Martinet 837a035e34 pkgs/config tests: fix tests when /usr/libexec/foo does not exist
cni_plugin_dirs validation require directories to exist, use a
directory that is more likely to exist like /tmp instead of an
arbitrary path that won't exist on most systems

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2022-07-08 08:07:37 +09:00
Valentin Rothberg ce49908068 [CI:DOCS] improve pull-policy documentation
Going through containers/podman/issues/14846 let me improve the
documentation here so it can be copied over to the man pages of
Podman and Buildah.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-07-07 14:08:32 +02:00
Daniel J Walsh a390d0c66c Change github.com/pkg/errors to use errors in pkg/config
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-18 10:33:53 -04:00
Daniel J Walsh 58f58410a6 Support setting image_volume_mode in containers.conf
Begins to fix https://github.com/containers/podman/issues/14230

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-18 10:10:06 -04:00
Kir Kolyshkin 27bf522212 .golanci-lint: enable gofumpt
gofumpt is more opinionated version of gofmt. One can use it from their
$EDITOR, or IDE, or gopls to better format the source code.

Previously, commit b951b72412 already formatted all the code with
gofumpt, but since then a couple of things crept in.

Fix these (with gofumpt v0.3.1) and enable the gofumpt linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-05-16 20:01:08 -07:00
Doug Rabson c4cbb913bd Change some defaults for FreeBSD and add a sample containers.conf
Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-05-09 14:07:58 +01:00
Doug Rabson a4a658034b Config files should live in /usr/local on FreeBSD
Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-05-09 14:07:58 +01:00
Doug Rabson faf3c75d8f Add runj which is an experimental OCI runtime based on FreeBSD jails
Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-05-09 14:07:58 +01:00
OpenShift Merge Robot 030366b89e Merge pull request #1024 from Luap99/linters
enable unparam, exportloopref and revive linters
2022-05-06 08:57:16 -04:00
Paul Holzinger cc110440e4 enable unparam, exportloopref and revive linters
unparam and exportloopref already work without changes.
For revive I had to silence many naming issues. I decided to silence them
instead of changing the name because I didn't want to break any code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-06 13:32:35 +02:00