Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
f6aa0e41
Commit
f6aa0e41
authored
Sep 28, 2017
by
Matt Bostock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return error if datasource TLS CA not parsed
parent
e23c678d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
pkg/models/datasource_cache.go
+4
-3
No files found.
pkg/models/datasource_cache.go
View file @
f6aa0e41
...
@@ -3,6 +3,7 @@ package models
...
@@ -3,6 +3,7 @@ package models
import
(
import
(
"crypto/tls"
"crypto/tls"
"crypto/x509"
"crypto/x509"
"errors"
"net"
"net"
"net/http"
"net/http"
"sync"
"sync"
...
@@ -71,13 +72,13 @@ func (ds *DataSource) GetHttpTransport() (*http.Transport, error) {
...
@@ -71,13 +72,13 @@ func (ds *DataSource) GetHttpTransport() (*http.Transport, error) {
if
tlsClientAuth
||
tlsAuthWithCACert
{
if
tlsClientAuth
||
tlsAuthWithCACert
{
decrypted
:=
ds
.
SecureJsonData
.
Decrypt
()
decrypted
:=
ds
.
SecureJsonData
.
Decrypt
()
if
tlsAuthWithCACert
&&
len
(
decrypted
[
"tlsCACert"
])
>
0
{
if
tlsAuthWithCACert
&&
len
(
decrypted
[
"tlsCACert"
])
>
0
{
caPool
:=
x509
.
NewCertPool
()
caPool
:=
x509
.
NewCertPool
()
ok
:=
caPool
.
AppendCertsFromPEM
([]
byte
(
decrypted
[
"tlsCACert"
]))
ok
:=
caPool
.
AppendCertsFromPEM
([]
byte
(
decrypted
[
"tlsCACert"
]))
if
ok
{
if
!
ok
{
transport
.
TLSClientConfig
.
RootCAs
=
caPool
return
nil
,
errors
.
New
(
"Failed to parse TLS CA PEM certificate"
)
}
}
transport
.
TLSClientConfig
.
RootCAs
=
caPool
}
}
if
tlsClientAuth
{
if
tlsClientAuth
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment