feat(httpsettings): add tls auth option

- Three text areas where the user can paste
in the CA Cert (optional), Client Cert
and Client Key.

- Tooltips for Auth checkboxes with brief
descriptions of what With Credentials and
With CA Cert are.

- Adds popover for TLS Auth header too.

- Aligns gf-form elements as labels and
checkboxes were not aligned before.

- Makes CA Cert optional as it is only
needed for self-signed certs.
This commit is contained in:
Daniel Lee
2016-11-18 16:53:07 +01:00
parent b6b53c0f4b
commit 0618122bcd
3 changed files with 116 additions and 65 deletions

View File

@ -31,18 +31,18 @@ func DataProxyTransport(ds *m.DataSource) (*http.Transport, error) {
TLSHandshakeTimeout: 10 * time.Second,
}
var tlsAuth bool
var err error
var tlsAuth, tlsAuthWithCACert bool
if ds.JsonData != nil {
tlsAuth, err = ds.JsonData.Get("tlsAuth").Bool()
tlsAuth = ds.JsonData.Get("tlsAuth").MustBool(false)
tlsAuthWithCACert = ds.JsonData.Get("tlsAuthWithCACert").MustBool(false)
}
if err == nil && tlsAuth {
if tlsAuth {
transport.TLSClientConfig.InsecureSkipVerify = false
decrypted := ds.SecureJsonData.Decrypt()
if len(decrypted["tlsCACert"]) > 0 {
if tlsAuthWithCACert && len(decrypted["tlsCACert"]) > 0 {
caPool := x509.NewCertPool()
ok := caPool.AppendCertsFromPEM([]byte(decrypted["tlsCACert"]))
if ok {