Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support plain http registries that are not localhost/127.x.x.x #2301

Merged
merged 5 commits into from
Aug 30, 2022

Conversation

carolynvs
Copy link
Member

What does this change

After fixing insecure registries, that use an untrusted TLS certificate, it was discovered that unsecured registries (plain http) don't work when communicating with a non-localhost or loopback address. Basically the library has no way to automatically determine that we should use http, and we need to rely on the --insecure-registry flag to know that plain
http is okay too.

The porter publish --archive and porter copy commands were affected by this because they used the github.com/pivotal/image-relocation library, which never supported configuring plain http, only detecting based on the hostname (e.g. localhost/127.0.0.1).

I have created a fork of the image relocation library at https://github.com/cnabio/image-relocation that has a workaround for not being able to configure plain http. I am checking if skipTLS is configured for the http transport passed to the image-relocation library, and also allowing plain http in that case too. This means that the --insecure-registry flag now properly controls plain http too for that library.

The fork has a different go module name so that we don't need to forever maintain a replace statement for that library since it's archived/unmaintained.

I have updated the airgap smoke test to check insecure and unsecured registry functions and included a copy as well so that the bulk of our --insecure-registry test cases are in that one test.

What issue does it fix

Closes #2297

Notes for the reviewer

I will update the go.mod with a tagged release of github.com/cnabio/image-relocation once that is merged.

Checklist

  • Did you write tests?
  • Did you write documentation? Already documented in Fix support for insecure registries #2273
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

@carolynvs carolynvs force-pushed the use-image-relocation-fork branch 8 times, most recently from f9c5ac0 to ab97b1d Compare August 16, 2022 20:28
After fixing insecure registries, that use an untrusted TLS certificate,
it was discovered that unsecured registries (plain http) don't work when
communicating with a non-localhost or loopback address. Basically the
library has no way to automatically determine that we should use http,
and we need to rely on the --insecure-registry flag to know that plain
http is okay too.

The porter publish --archive and porter copy commands were affected by
this because they used the github.com/pivotal/image-relocation library,
which never supported configuring plain http, only detecting based on
the hostname (e.g. localhost/127.0.0.1).

I have created a fork of the image relocation library at
https://github.com/cnabio/image-relocation that has a workaround for not
being able to configure plain http. I am checking if skipTLS is
configured for the http transport passed to the image-relocation
library, and also allowing plain http in that case too. This means that
the --insecure-registry flag now properly controls plain http too for
that library.

The fork has a different go module name so that we don't need to forever
maintain a replace statement for that library since it's
archived/unmaintained.

I have updated the airgap smoke test to check insecure and unsecured
registry functions and included a copy as well so that the bulk of our
--insecure-registry test cases are in that one test.

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs force-pushed the use-image-relocation-fork branch from ab97b1d to 939480e Compare August 16, 2022 21:08
* Remove the mybuns-with-img-ref and use an image reference in mybuns so
  that it's a more complete test case.
* Use mybuns in the airgap test instead of mybuns-with-img-ref.
* Install the mybuns bundle in the airgap test so that we know that what
  we relocated still runs. I am running it without its dependencies to
  keep things simple for now but long term, after we rewrite dependencies,
  understanding how to move bundles with deps across an airgap is
  something we need to document, add regression tests for, etc.
* Add plain http test case to the airgap test that doesn't require using
  --insecure-registry or a registry alias.

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs force-pushed the use-image-relocation-fork branch from 059d5b6 to 0bc0e08 Compare August 17, 2022 17:29
@carolynvs carolynvs marked this pull request as ready for review August 17, 2022 19:35
@carolynvs carolynvs merged commit d815218 into getporter:release/v1 Aug 30, 2022
@carolynvs carolynvs deleted the use-image-relocation-fork branch August 30, 2022 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

image relocation library doesn't let you specify that plain http is allowed
1 participant