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

Go's TLS cannot find root certs in 1.6.2-alpine #97

Closed
jmhodges opened this Issue Jun 27, 2016 · 9 comments

Comments

Projects
None yet
3 participants
@jmhodges
Contributor

jmhodges commented Jun 27, 2016

When trying to port to golang:1.6.2-alpine from golang:1.6.2, the Go HTTP client gets errors like:

x509: failed to load system roots and no roots provided

when making HTTPS requests.

Minimum case:

In the Dockerfile:

FROM golang:1.6.2-alpine
CMD ["sh"]`

And then run go run foo.go with a foo.go of

package main

import (
    "fmt"
    "net/http"
)

func main() {
    _, err := http.Get("https://www.google.com")
    fmt.Printf("welp %s\n", err)
}
@jmhodges

This comment has been minimized.

Show comment
Hide comment
@jmhodges

jmhodges Jun 27, 2016

Contributor

I see that there's an attempt to install ca-certificates in the the golang:1.6.2-alpine Dockerfile, but it doesn't seem to be enough. I don't know why. Perhaps, the place where alpine puts that package's contents isn't in the list that Go checks?

Contributor

jmhodges commented Jun 27, 2016

I see that there's an attempt to install ca-certificates in the the golang:1.6.2-alpine Dockerfile, but it doesn't seem to be enough. I don't know why. Perhaps, the place where alpine puts that package's contents isn't in the list that Go checks?

@yosifkit

This comment has been minimized.

Show comment
Hide comment
@yosifkit

yosifkit Jun 27, 2016

Member

ca-certificates gets removed with the rest of the build-deps. Looks like we need to specifically install and keep it if that is what is generally desired and expected on the super slim alpine images.

Member

yosifkit commented Jun 27, 2016

ca-certificates gets removed with the rest of the build-deps. Looks like we need to specifically install and keep it if that is what is generally desired and expected on the super slim alpine images.

@yosifkit

This comment has been minimized.

Show comment
Hide comment
@yosifkit

yosifkit Jun 27, 2016

Member

It seems that I forgot that it is on purpose: #96 (comment)

Member

yosifkit commented Jun 27, 2016

It seems that I forgot that it is on purpose: #96 (comment)

@jmhodges

This comment has been minimized.

Show comment
Hide comment
@jmhodges

jmhodges Jun 27, 2016

Contributor

Well, for evidence that including them might be nice, I don't have a Go container in production that doesn't do HTTPS requests (for SAAS logs, etc.).

Contributor

jmhodges commented Jun 27, 2016

Well, for evidence that including them might be nice, I don't have a Go container in production that doesn't do HTTPS requests (for SAAS logs, etc.).

@capkurmagati

This comment has been minimized.

Show comment
Hide comment
@capkurmagati

capkurmagati Jun 28, 2016

@yosifkit The problem to me is that the images changes its behaviour without any notification(e.g. create a tag).
I used to deploy my https services based on alpine images, but it doesn't work now.
From the immutable point of view, I think we need to do something.

capkurmagati commented Jun 28, 2016

@yosifkit The problem to me is that the images changes its behaviour without any notification(e.g. create a tag).
I used to deploy my https services based on alpine images, but it doesn't work now.
From the immutable point of view, I think we need to do something.

@yosifkit

This comment has been minimized.

Show comment
Hide comment
@yosifkit

yosifkit Jun 28, 2016

Member

This is a duplicate of #96. As I mentioned over there, the ca-certs problem stems from the update to alpine:3.4.

As for immutable image tags, you should probably look in to pulling images by digest. A full history of shas for each official image are in the docs: https://github.com/docker-library/docs/blob/master/golang/tag-details.md.

Member

yosifkit commented Jun 28, 2016

This is a duplicate of #96. As I mentioned over there, the ca-certs problem stems from the update to alpine:3.4.

As for immutable image tags, you should probably look in to pulling images by digest. A full history of shas for each official image are in the docs: https://github.com/docker-library/docs/blob/master/golang/tag-details.md.

@yosifkit

This comment has been minimized.

Show comment
Hide comment
@yosifkit

yosifkit Jun 28, 2016

Member

Closing as duplicate

Member

yosifkit commented Jun 28, 2016

Closing as duplicate

@yosifkit yosifkit closed this Jun 28, 2016

@jmhodges

This comment has been minimized.

Show comment
Hide comment
@jmhodges

jmhodges Jun 28, 2016

Contributor

Go is one of the few runtimes that had correctly working HTTPS clients working out of the box because it does the work of looking for the OS's root certs. People are more likely to enable insecure certificate verification than figure out how to fix this. Since these are the official Go images, not including the root certificates would have outsized impact on the community.

Please add the certs.

Contributor

jmhodges commented Jun 28, 2016

Go is one of the few runtimes that had correctly working HTTPS clients working out of the box because it does the work of looking for the OS's root certs. People are more likely to enable insecure certificate verification than figure out how to fix this. Since these are the official Go images, not including the root certificates would have outsized impact on the community.

Please add the certs.

@jmhodges

This comment has been minimized.

Show comment
Hide comment
@jmhodges

jmhodges Jun 28, 2016

Contributor

Also, I should note that adding just the certs adds only 0.621 MB to the 272MB image.

Contributor

jmhodges commented Jun 28, 2016

Also, I should note that adding just the certs adds only 0.621 MB to the 272MB image.

jmhodges added a commit to jmhodges/golang that referenced this issue Jun 29, 2016

add root certificates to Alpine images
Fixes #96 (and the duplicate #97).

This allows Go's HTTP library to make HTTPS client connections with secure
certificate validation. Without this change, `net/http` in these images return
the error `"x509: failed to load system roots and no roots provided"`.

This adds 0.6MB to the image (as measured with docker history).

jmhodges added a commit to jmhodges/golang that referenced this issue Jun 29, 2016

add root certificates to Alpine images
Fixes #96 (and the duplicate #97).

This allows Go's HTTP library to make HTTPS client connections with secure
certificate validation. Without this change, `net/http` in these images return
the error `"x509: failed to load system roots and no roots provided"`.

This adds 0.6MB to the image (as measured with docker history).

@rickmak rickmak referenced this issue Oct 6, 2016

Closed

Update the image to include ca-certificate #154

0 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment