api: fall back to using public cert on cert error #7338

Merged
merged 1 commit into from May 18, 2017

Conversation

Projects
None yet
4 participants
Owner

rogpeppe commented May 12, 2017

If we get a certificate error trying to connect to a controller,
then it's possible that we're using the private CA but
the address we're connecting to is a proxy that doesn't
have a private CA certificate. In this case, try
again with the public CA.

To test this properly, some refactoring was required. A brief overview:

  • separate concerns between internal and external dial parameters by creating
    an internal dialOpts type rather than having unexported fields in the otherwise-public
    DialOpts type.
  • add a Clock to DialOpts so that we can fake the clock logic used by Open.
  • make DialWebsocket return an interface so that we can easily return a fake connection in tests.
  • add jsoncodec.NewWebsocketConn to make that possible.

QA do a model migration to a controller with a frontend proxy.

LGTM

Owner

rogpeppe commented May 17, 2017

!!build!!

axw approved these changes May 18, 2017

api/apiclient.go
urlStr string
tlsConfig *tls.Config
}
+// Close implements io.Close by closing the websocket
@axw

axw May 18, 2017

Member

io.Closer

Owner

rogpeppe commented May 18, 2017

$$merge$$

Contributor

jujubot commented May 18, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 18, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10915

api: fall back to using public cert on cert error
If we get a certificate error trying to connect to a controller,
then it's possible that we're using the private CA but
the address we're connecting to is a proxy that doesn't
have a private CA certificate. In this case, try
again with the public CA.
Owner

rogpeppe commented May 18, 2017

$$merge$$

Contributor

jujubot commented May 18, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Owner

rogpeppe commented May 18, 2017

$$merge$$

Contributor

jujubot commented May 18, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10916

Owner

rogpeppe commented May 18, 2017

$$merge$$

Contributor

jujubot commented May 18, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit b2b4b05 into juju:develop May 18, 2017

1 check failed

github-check-merge-juju Built PR, ran unit tests, and tested LXD deploy. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment