eve support datastore https certs#2136
Conversation
5300b12 to
15bc1d4
Compare
eriknordmark
left a comment
There was a problem hiding this comment.
Writing the cert to the ShareCertDirName means that other comunication such as other downloads will also trust the added cert, and here we just want to allow it for a particular download using that datastore.
Thus I think it is a lot safer to use the pattern which the zedcloud package uses, where we have a GetTlsConfig which loads certificates to get a tlsconfig struct, then this is used to form a transport and the transport is used to client := &http.Client{Transport: transport}
Here we have a ep.hClient which can be modified to have a particular TlsConfig with the specified certificate.
Alternatively, you can add an argument to httpClientSrcIP() to takes an optional certificate to use to create the TlsConfig. That ensures that the added cert only applies to this particular http client.
Also, presumably we should do this for sftp and the other transports; we have the same approach for all that we create a client with a source IP hence we should be able to specify the TlsConfig for all of them as well.
Sure. I'll make the cert specific to the datastore attached for downloading. the sftp is not http/https related. we can have a separate story on that |
fc60213 to
2bb4bd5
Compare
| caCertPool := x509.NewCertPool() | ||
| for _, pem := range certs { | ||
| if !caCertPool.AppendCertsFromPEM(pem) { | ||
| return fmt.Errorf("Failed to append datastore certs") | ||
| } | ||
| } |
There was a problem hiding this comment.
This is fine with me, but then we need to document that the certs in the UI are not added to the base Linux set of root CAs. Thus different than what we do for the proxy where we add the cert(s) to that base set.
There was a problem hiding this comment.
right. in proxy case, there is a transport.Proxy item and also the proxy cert chain append into the linux certs directory. In this datastore case, the user explicitly want to have this cert chain to verify for this endpoint of https.
2bb4bd5 to
8f48b72
Compare
eriknordmark
left a comment
There was a problem hiding this comment.
Run eden tests again
6907e3a to
df47099
Compare
bd0a30a to
eb98305
Compare
|
@naiming-zededa as I can see, we should also modify url for oci transport as well as sftp, because we split it eve/pkg/pillar/cmd/downloader/syncop.go Line 90 in cf9ed6e Seems, something like should work |
@giggsoff Right, i did change those in my workspace, but i'm waiting for eden error we have seen on 'route unreachable', any ida? |
Signed-off-by: Naiming Shen <naiming@zededa.com>
eb98305 to
52cc2b8
Compare
eriknordmark
left a comment
There was a problem hiding this comment.
LGTM. Let's run eden tests once more
Signed-off-by: Naiming Shen naiming@zededa.com