kaniko/pkg
Eric 7525828ef9
Add mTLS (client cert) registry authentication (#2180)
* Add mTLS (client cert) support

Add support for Mutual TLS (mTLS) client certificate authentication.
The expected format of the new --registry-client-cert flag is the same
as the existing --registry-certificate flag, which will allow
different client certificates for different registries:

--registry-client-cert my.registry.url=/path/to/cert.crt,/path/to/key.key

* tidy: Rename mTLS (Client Cert) flag to be in line with others

This flag didn't describe that it was for the client certs uses with
the registry. Although this should be reasonably obvious, I like the
consistency with the other registry flag.

* test: Added unit tests for mTLS (Client Cert) loading

* test: Add 2 more tests for comma split formatting

since the comma splitting is a new portion of code let's make sure
that that format works well too in other cases

* tidy: Fix formatting of flag help text

* tidy: Made invalid cert format error consistent

I was running the tests and saw the message:

Failed to load client certificate/key '/path/to/client/certificate.cert' for my.registry.name, format is my.registry.name=/path/to/cert,/path/to/key

I then realized that it'd be a lot nicer if this showed the user what
they input, and how they should change it (rather than decomposing it:

Failed to load client certificate/key 'my.registry.name=/path/to/client/certificate.cert', expected format: my.registry.name=/path/to/cert,/path/to/key

* test: Fixed incorrect test argument

This didn't fail the test before because it's only attempting to show
that certs only get loaded and used for their associated registry but
it's important to keep this correct.

This case is covered by the test below, "RegistriesClientCertificates
incorrect cert format"

* doc: Add new flag to README.md

* mod: Fail to push if there was a problem loading client certs

Rather than warning that there was an issue, we should fail if the
requested client certificates were not found or failed to load.

This feels a lot better than waiting for the build to finish then
failing later.

* mod: Return an error if the certificate authority fails to load, just like client certs

The MakeTransport function was changed in the previous commit to
allow returning errors if there was a problem loading certificates,
rather than just print warnings.

This feels a lot better as you get the error immediately that there's
a problem to fix, rather than getting a warning, then later an error
that the server's certificate could not be verified.

* tidy: fix golint issues
2023-05-18 14:20:51 -07:00
..
buildcontext fix: use debian buster to fix tests using no longer supported stretch which had broken apt-get urls (#2485) 2023-04-27 22:05:37 -04:00
cache Add mTLS (client cert) registry authentication (#2180) 2023-05-18 14:20:51 -07:00
commands Upgrade docker (#2440) 2023-03-23 20:34:25 -04:00
config Add mTLS (client cert) registry authentication (#2180) 2023-05-18 14:20:51 -07:00
constants Upgrade docker (#2440) 2023-03-23 20:34:25 -04:00
creds Add GitLab CI credentials helper (#2040) 2022-04-11 13:13:47 -04:00
dockerfile fix: use debian buster to fix tests using no longer supported stretch which had broken apt-get urls (#2485) 2023-04-27 22:05:37 -04:00
executor Add mTLS (client cert) registry authentication (#2180) 2023-05-18 14:20:51 -07:00
fakes refactor cache.Warm and add tests 2020-01-10 12:29:17 -08:00
filesystem chore: remove duplicate word in comments (#2232) 2022-08-30 06:02:39 -04:00
image Add mTLS (client cert) registry authentication (#2180) 2023-05-18 14:20:51 -07:00
logging Add timestamp to logs 2020-04-23 13:40:47 +02:00
mocks/go-containerregistry/mockv1 rename mock pkg for lint 2020-01-17 14:59:14 -08:00
snapshot Fix Integration tests (#2425) 2023-03-21 12:30:54 -04:00
timing Fix Integration tests (#2425) 2023-03-21 12:30:54 -04:00
util Add mTLS (client cert) registry authentication (#2180) 2023-05-18 14:20:51 -07:00
version Set a user-agent for registry pushes. (#87) 2018-04-13 14:25:58 -07:00