question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow authorization also against insecure registries (at least for testing)

See original GitHub issue

Description of the issue: Currently if registry offers only insecure access, there’s no way to authenticate against it (https://github.com/GoogleContainerTools/jib/blob/master/jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryEndpointCaller.java#L165). It would be good for testing to be able to authenticate over http (partly because of #543).

Expected behavior: Parameter where user acknowledges that it’s very bad idea to send credentials over http, but still allowing that.

Steps to reproduce: Create local registry with authentication and without TLS.

Environment: Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T22:39:06+03:00) Java version: 1.8.0_131, vendor: Oracle Corporation Default locale: en_US, platform encoding: Cp1252 OS name: “windows 7”, version: “6.1”, arch: “amd64”, family: “windows” jib-plugin version: 0.9.6

jib-maven-plugin Configuration:

<plugin>
	<groupId>com.google.cloud.tools</groupId>
	<artifactId>jib-maven-plugin</artifactId>
	<version>${jib.version}</version>
	<configuration>
		<from>
			<image>${jib.fromImage}</image>
		</from>
		<to>
			<image>${jib.toImage}</image>
		</to>
		<container>
			<ports>
				<port>${jib.applicationPort}</port>
			</ports>
		</container>
		<allowInsecureRegistries>${jib.allowInsecureRegistries}</allowInsecureRegistries>
	</configuration>
	<executions>
		<execution>
			<phase>compile</phase>
			<goals>
				<goal>build</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Log output: Without allowInsecureRegitstries:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.6:build (default) on project jib-demo-project: Build image failed, perhaps you should use a registry that supports HTTPS or set the configuration parameter 'allowInsecureRegistries': Only secure connections are allowed, but tried to reach URL http://artifactory/project/baseImage/manifests/latest -> [Help 1]

With allowInsecureRegitstries:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.6:build (default) on project jib-demo-project: Build image failed, perhaps you should make sure your credentials for 'artifactory' are set up correctly: Unauthorized for http://artifactory/project/baseImage: 401 Unauthorized
[ERROR] {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}

Additional Information: If this is not possible, at least error message should state that authentication (username+password) was not even used, because connection was made with http instead of https.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Hi-Ficommented, Aug 6, 2018

0.9.8 seems have fixed this, so now authentication is sent to both directions correctly.

1reaction
chanseokohcommented, Jul 13, 2018

It seems worth having a discussion to sort out things around HTTP, HTTPS, and allowInsecureRegistries. For example about the behavior of allowInsecureRegistries,

  • It falls back to HTTP if HTTPS fails for any reason (I believe), which includes invalid or unverifiable certificates. In the certificate case, some people may expect Jib should just completely ignore the certificate problem and proceed with HTTPS (which might be risky and they should know what they are doing), like what curl --insecure does. For example, if a port is explicitly given like localhost:5000 that accepts HTTPS, the 5000 port won’t accept HTTP at all.
  • It falls back to HTTP only after HTTPS fails. When a failure occurs, in many cases it is unclear if it is HTTP or HTTPS that failed. Also, I wonder if there should be a way to set Jib to just start with HTTP, instead of having this fallback feature. sendCredentialsOverHttp might make things more confusing when combined with the current behavior of allowInsecureRegistries.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Test an insecure registry - Docker Documentation
Warning: It's not possible to use an insecure registry with basic authentication. This procedure configures Docker to entirely disregard security for your ...
Read more >
How to work with a private registry - MicroK8s
Let's assume the private insecure registry is at 10.141.241.175 on port 32000 . The images we build need to be tagged with the...
Read more >
Authorization - OWASP Cheat Sheet Series
Analyze the technologies capabilities with an understanding that the authorization logic provided by the component may be insufficient for your application's ...
Read more >
Running Your Own Docker Registry Made Easy - Medium
This article will cover how you can easily set up a local or externally accessible Docker registry for hosting your own built Docker...
Read more >
Using Image Registries - k3d
This file can also be used for providing additional information necessary for accessing some registries, like authentication and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found