Commit Graph

14 Commits

Author SHA1 Message Date
Clark Boylan 4c40b92950 Prevent leaks of buildset registry credentials
Because buildset registries may be used by jobs that finish before other
jobs are finished using the buildset registry we must be careful not to
expose the registry credentials in the jobs that finish sooner.
Otherwise logs for the earlier job runs could potentially be used to
poison the registry for later jobs.

This is likely currently incomplete. Other Zuulians should look over it
carefully to ensure we're covering all the bases here.

The cases I've identified so far are:

* Setting facts that include passwords
* Reading and writing to files that include passwords (as content may be
  logged)
* Calling modules with passwords passed as arguments (the module
  invocation is logged)

I've also set no_log on zuul_return that passes up credentials because
while the logging for zuul_return is minimal today, I don't want to
count on it remaining that way.

We also use the yet to be merged secret_data attribute on zuul_return to
ensure that zuul_return itself does not expose anything unwanted.

Finally it would be great if others could check over the use of
buildset_registry variables to make sure there aren't any that got
missed. One thing I'm not sure of is whether or not when conditionals
get logged and if we need to be careful about their use too.

Temporarily remove some buildset-regitry jobs which are in a catch-22.

Change-Id: I2dea683e27f00b99a7766bf830981bf91b925265
2021-06-24 09:56:19 -07:00
Sorin Sbarnea 856866fdde More E208 mode fixes
Change-Id: I8157ec1f31b8c5a064b63002e8311b91ef9ce9ab
See: https://ansible-lint.readthedocs.io/en/latest/default_rules.html#file-permissions-not-mentioned
2020-10-31 07:34:03 +00:00
James E. Blair b4dc66ec33 use-buildset-registry: protect against /var/user/1000 not existing
This is the case on Xenial; we'll just accept that podman and friends
may not work there.

Change-Id: Icd14e4502ff21640a1948671a475448adaf868f5
2020-03-20 13:28:03 -07:00
James E. Blair d48667a3c5 use-buildset-registry: Add podman support
Change-Id: I41718073962c8e7eb3d8810276e550fb84bd6e99
2019-12-05 11:44:15 -08:00
James E. Blair 8766890012 Use zuul-registry as buildset registry
The proxy functionality is no longer needed so it is removed.

Change-Id: I29ff75d331b433ea4ad3b66ed723eee14a90b404
Depends-On: https://review.opendev.org/689829
2019-10-28 15:42:26 -07:00
Jeff Liu 2c33db2674 Add auth config to kubelet user for buildset registries
Change-Id: I3c6b434382aab2f7ef565808954873e9aa6b9b42
2019-07-30 16:48:27 -04:00
Clark Boylan 23826e05a6 Only alias docker registries on test nodes
Skopeo has problems with ipv6 address literals just like docker as they
use the same underlying checks for url validity. However, we think we
can fix that by using a port forward from the executor to the buildset
registry so that skopeo can connect via ipv4

Go back to aliases the registries on test nodes via /etc/hosts.

Change-Id: I5f9316ffe84de06cb2fb2b65a7e1c31d9f8b0e35
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2019-04-22 10:37:33 -07:00
Clark Boylan ba4b2c68b9 Revert "Only alias registries on build nodes"
This reverts commit 05f20a5396.

Apparently skopeo is properly cloud native too and doesn't support ipv6
either. I think it is pulling the same docker
distribution/reference/regexp.go lib in and using docker's regex.

The error we get from skopeo:

 time="2019-04-10T15:15:48Z" level=fatal msg="Invalid source name docker://[2607:ff68:100:54:f816:3eff:fef2:fc69]:5000/zuul/nodepool:latest: invalid reference format"

Change-Id: I6f916574c9f46e8fdd2464465e2b36ecf8719b16
2019-04-10 08:22:04 -07:00
Clark Boylan 05f20a5396 Only alias registries on build nodes
We only need to alias registries on the build nodes when running docker.
We cannot alias them in /etc/hosts in roles that are expected to run on
localhost beacuse /etc/hosts is bindmounted read only on localhost. This
assumes that skopeo handles ipv6 properly (which has not been tested).

If skopeo does not handle ipv6 properly then we'll need additional
fixing.

Change-Id: I40e5b1bac5aeaf2d42aa05a72b9ced72b7d222c0
2019-04-09 14:45:19 -07:00
Clark Boylan 3a29935f32 Revert "Use /etc/hosts with docker registries to handle ipv6"
This reverts commit a307259776.

We need to additionally handle this on localhost (the zuul executor)
where we cannot edit /etc/hosts. At least I don't think we can. We also
need to handle the case where buildset_regsitry is not yet defined.

Change-Id: I4928f7fcf58e88cf360de253f01b16546220aace
2019-04-09 10:10:03 -07:00
Clark Boylan a307259776 Use /etc/hosts with docker registries to handle ipv6
Docker doesn't appear to understand properly escaped ipv6 addrs in its
"urls". Address this by adding /etc/hosts entries for any
buildset_registry that is specified by an ip address (v4 or v6). This
allows us to use a named alias instead of the ipv6 address.

An example failure for posterity:

  "[2607:ff68:100:54:f816:3eff:fe7c:e98a]:5000/zuul/nodepool:latest" is not a valid repository/tag: invalid reference format

Change-Id: Id865dc7d3382174b61f9eaa76e29b637a85f5142
2019-04-08 13:40:58 -07:00
James E. Blair 325b666b6d Use ipwrap filter in registry roles
We need to escape some ipv6 addresses in URLs.

Change-Id: Ica5fe73dd65e138cdc4817de3903cdd271402941
2019-04-05 16:15:02 -07:00
James E. Blair 9c0d25f349 Fix buildset registry
The approach of having the proxy serve the local data as well as
the remote wasn't working -- it seems that the proxy would always
check upstream and prefer that data even if it had been pushed
locally.

To correct this, separate the data stores of the two registries,
and add both of them to the registry_mirror setting for the
docker daemon.  Now we will pull from our buildset registry first,
and fall back on the proxy to talk to upstream if an image is not
found locally.

The proxy is still required in order to mask out the username and
password which dockerd will otherwise use when talking to upstream.

Change-Id: Iab11954a4b5431d3b1a4d4753f519b6b71f64094
2019-03-01 15:52:01 -08:00
James E. Blair 42df455705 use-buildset-registry: support running before docker installed
To accomodate running in a production-simulation environment,
make it safe to run this role on a host before docker is installed.

This also adds support for the new dual-registry configuration
that run-buildset-registry uses.

This removes the region-local proxy from the registry-mirrors
configuration.  Because the buildset registry acts as a pull-through
proxy, the region-local proxy won't be used even if we did include it.
Instead, we should update the run-buildset-registry role to proxy
to the region-local proxy if present.

Change-Id: I21011a3708f17ee61afd0034d90d75e8dc885575
2019-02-21 14:07:33 -08:00