Add insecureSkipVerify option to source to accept all influxdb certs

The insecureSkipVerify defaults to false, but when true, instructs
the server to accept any certificate coming from the InfluxDB server.
pull/728/head
Chris Goller 2017-01-04 19:35:07 -06:00
parent 29c6197691
commit 439a4d32e8
11 changed files with 238 additions and 113 deletions

View File

@ -6,6 +6,7 @@
1. [#718](https://github.com/influxdata/chronograf/issues/718): Fix bug that stopped apps from displaying
### Upcoming Features
1. [#660](https://github.com/influxdata/chronograf/issues/660): Add option to accept any certificate from InfluxDB.
## v1.1.0-beta4 [2016-12-30]

View File

@ -44,14 +44,15 @@ func UnmarshalExploration(data []byte, e *chronograf.Exploration) error {
// MarshalSource encodes a source to binary protobuf format.
func MarshalSource(s chronograf.Source) ([]byte, error) {
return proto.Marshal(&Source{
ID: int64(s.ID),
Name: s.Name,
Type: s.Type,
Username: s.Username,
Password: s.Password,
URL: s.URL,
Default: s.Default,
Telegraf: s.Telegraf,
ID: int64(s.ID),
Name: s.Name,
Type: s.Type,
Username: s.Username,
Password: s.Password,
URL: s.URL,
InsecureSkipVerify: s.InsecureSkipVerify,
Default: s.Default,
Telegraf: s.Telegraf,
})
}
@ -68,6 +69,7 @@ func UnmarshalSource(data []byte, s *chronograf.Source) error {
s.Username = pb.Username
s.Password = pb.Password
s.URL = pb.URL
s.InsecureSkipVerify = pb.InsecureSkipVerify
s.Default = pb.Default
s.Telegraf = pb.Telegraf
return nil

View File

@ -39,13 +39,13 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type Exploration struct {
ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
UserID int64 `protobuf:"varint,3,opt,name=UserID,proto3" json:"UserID,omitempty"`
Data string `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
UpdatedAt int64 `protobuf:"varint,6,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
Default bool `protobuf:"varint,7,opt,name=Default,proto3" json:"Default,omitempty"`
ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
UserID int64 `protobuf:"varint,3,opt,name=UserID,json=userID,proto3" json:"UserID,omitempty"`
Data string `protobuf:"bytes,4,opt,name=Data,json=data,proto3" json:"Data,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=CreatedAt,json=createdAt,proto3" json:"CreatedAt,omitempty"`
UpdatedAt int64 `protobuf:"varint,6,opt,name=UpdatedAt,json=updatedAt,proto3" json:"UpdatedAt,omitempty"`
Default bool `protobuf:"varint,7,opt,name=Default,json=default,proto3" json:"Default,omitempty"`
}
func (m *Exploration) Reset() { *m = Exploration{} }
@ -54,14 +54,15 @@ func (*Exploration) ProtoMessage() {}
func (*Exploration) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{0} }
type Source struct {
ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
Type string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"`
Username string `protobuf:"bytes,4,opt,name=Username,proto3" json:"Username,omitempty"`
Password string `protobuf:"bytes,5,opt,name=Password,proto3" json:"Password,omitempty"`
URL string `protobuf:"bytes,6,opt,name=URL,proto3" json:"URL,omitempty"`
Default bool `protobuf:"varint,7,opt,name=Default,proto3" json:"Default,omitempty"`
Telegraf string `protobuf:"bytes,8,opt,name=Telegraf,proto3" json:"Telegraf,omitempty"`
ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
Type string `protobuf:"bytes,3,opt,name=Type,json=type,proto3" json:"Type,omitempty"`
Username string `protobuf:"bytes,4,opt,name=Username,json=username,proto3" json:"Username,omitempty"`
Password string `protobuf:"bytes,5,opt,name=Password,json=password,proto3" json:"Password,omitempty"`
URL string `protobuf:"bytes,6,opt,name=URL,json=uRL,proto3" json:"URL,omitempty"`
Default bool `protobuf:"varint,7,opt,name=Default,json=default,proto3" json:"Default,omitempty"`
Telegraf string `protobuf:"bytes,8,opt,name=Telegraf,json=telegraf,proto3" json:"Telegraf,omitempty"`
InsecureSkipVerify bool `protobuf:"varint,9,opt,name=InsecureSkipVerify,json=insecureSkipVerify,proto3" json:"InsecureSkipVerify,omitempty"`
}
func (m *Source) Reset() { *m = Source{} }
@ -70,8 +71,8 @@ func (*Source) ProtoMessage() {}
func (*Source) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{1} }
type Dashboard struct {
ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
Cells []*DashboardCell `protobuf:"bytes,3,rep,name=cells" json:"cells,omitempty"`
}
@ -103,12 +104,12 @@ func (*DashboardCell) ProtoMessage() {}
func (*DashboardCell) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{3} }
type Server struct {
ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
Username string `protobuf:"bytes,3,opt,name=Username,proto3" json:"Username,omitempty"`
Password string `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"`
URL string `protobuf:"bytes,5,opt,name=URL,proto3" json:"URL,omitempty"`
SrcID int64 `protobuf:"varint,6,opt,name=SrcID,proto3" json:"SrcID,omitempty"`
ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
Username string `protobuf:"bytes,3,opt,name=Username,json=username,proto3" json:"Username,omitempty"`
Password string `protobuf:"bytes,4,opt,name=Password,json=password,proto3" json:"Password,omitempty"`
URL string `protobuf:"bytes,5,opt,name=URL,json=uRL,proto3" json:"URL,omitempty"`
SrcID int64 `protobuf:"varint,6,opt,name=SrcID,json=srcID,proto3" json:"SrcID,omitempty"`
}
func (m *Server) Reset() { *m = Server{} }
@ -117,11 +118,11 @@ func (*Server) ProtoMessage() {}
func (*Server) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{4} }
type Layout struct {
ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
Application string `protobuf:"bytes,2,opt,name=Application,proto3" json:"Application,omitempty"`
Measurement string `protobuf:"bytes,3,opt,name=Measurement,proto3" json:"Measurement,omitempty"`
Cells []*Cell `protobuf:"bytes,4,rep,name=Cells" json:"Cells,omitempty"`
Autoflow bool `protobuf:"varint,5,opt,name=Autoflow,proto3" json:"Autoflow,omitempty"`
ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
Application string `protobuf:"bytes,2,opt,name=Application,json=application,proto3" json:"Application,omitempty"`
Measurement string `protobuf:"bytes,3,opt,name=Measurement,json=measurement,proto3" json:"Measurement,omitempty"`
Cells []*Cell `protobuf:"bytes,4,rep,name=Cells,json=cells" json:"Cells,omitempty"`
Autoflow bool `protobuf:"varint,5,opt,name=Autoflow,json=autoflow,proto3" json:"Autoflow,omitempty"`
}
func (m *Layout) Reset() { *m = Layout{} }
@ -162,13 +163,13 @@ func (m *Cell) GetQueries() []*Query {
}
type Query struct {
Command string `protobuf:"bytes,1,opt,name=Command,proto3" json:"Command,omitempty"`
DB string `protobuf:"bytes,2,opt,name=DB,proto3" json:"DB,omitempty"`
RP string `protobuf:"bytes,3,opt,name=RP,proto3" json:"RP,omitempty"`
GroupBys []string `protobuf:"bytes,4,rep,name=GroupBys" json:"GroupBys,omitempty"`
Wheres []string `protobuf:"bytes,5,rep,name=Wheres" json:"Wheres,omitempty"`
Label string `protobuf:"bytes,6,opt,name=Label,proto3" json:"Label,omitempty"`
Range *Range `protobuf:"bytes,7,opt,name=Range" json:"Range,omitempty"`
Command string `protobuf:"bytes,1,opt,name=Command,json=command,proto3" json:"Command,omitempty"`
DB string `protobuf:"bytes,2,opt,name=DB,json=dB,proto3" json:"DB,omitempty"`
RP string `protobuf:"bytes,3,opt,name=RP,json=rP,proto3" json:"RP,omitempty"`
GroupBys []string `protobuf:"bytes,4,rep,name=GroupBys,json=groupBys" json:"GroupBys,omitempty"`
Wheres []string `protobuf:"bytes,5,rep,name=Wheres,json=wheres" json:"Wheres,omitempty"`
Label string `protobuf:"bytes,6,opt,name=Label,json=label,proto3" json:"Label,omitempty"`
Range *Range `protobuf:"bytes,7,opt,name=Range,json=range" json:"Range,omitempty"`
}
func (m *Query) Reset() { *m = Query{} }
@ -184,8 +185,8 @@ func (m *Query) GetRange() *Range {
}
type Range struct {
Upper int64 `protobuf:"varint,1,opt,name=Upper,proto3" json:"Upper,omitempty"`
Lower int64 `protobuf:"varint,2,opt,name=Lower,proto3" json:"Lower,omitempty"`
Upper int64 `protobuf:"varint,1,opt,name=Upper,json=upper,proto3" json:"Upper,omitempty"`
Lower int64 `protobuf:"varint,2,opt,name=Lower,json=lower,proto3" json:"Lower,omitempty"`
}
func (m *Range) Reset() { *m = Range{} }
@ -194,10 +195,10 @@ func (*Range) ProtoMessage() {}
func (*Range) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{8} }
type AlertRule struct {
ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
JSON string `protobuf:"bytes,2,opt,name=JSON,proto3" json:"JSON,omitempty"`
SrcID int64 `protobuf:"varint,3,opt,name=SrcID,proto3" json:"SrcID,omitempty"`
KapaID int64 `protobuf:"varint,4,opt,name=KapaID,proto3" json:"KapaID,omitempty"`
ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
JSON string `protobuf:"bytes,2,opt,name=JSON,json=jSON,proto3" json:"JSON,omitempty"`
SrcID int64 `protobuf:"varint,3,opt,name=SrcID,json=srcID,proto3" json:"SrcID,omitempty"`
KapaID int64 `protobuf:"varint,4,opt,name=KapaID,json=kapaID,proto3" json:"KapaID,omitempty"`
}
func (m *AlertRule) Reset() { *m = AlertRule{} }
@ -206,8 +207,8 @@ func (*AlertRule) ProtoMessage() {}
func (*AlertRule) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{9} }
type User struct {
ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
Email string `protobuf:"bytes,2,opt,name=Email,proto3" json:"Email,omitempty"`
ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
Email string `protobuf:"bytes,2,opt,name=Email,json=email,proto3" json:"Email,omitempty"`
}
func (m *User) Reset() { *m = User{} }
@ -232,49 +233,52 @@ func init() {
func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) }
var fileDescriptorInternal = []byte{
// 693 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0xdd, 0x6e, 0xd3, 0x4a,
0x10, 0xd6, 0xc6, 0x76, 0x12, 0x4f, 0x7a, 0x7a, 0x8e, 0x56, 0xd5, 0xc1, 0x42, 0x5c, 0x44, 0x16,
0x48, 0x41, 0x82, 0x5e, 0xb4, 0x4f, 0x90, 0xc6, 0x15, 0x0a, 0x94, 0x52, 0xb6, 0x8d, 0xb8, 0x02,
0x69, 0x9b, 0x6c, 0x9b, 0x48, 0x9b, 0xd8, 0xac, 0x6d, 0xd2, 0x3c, 0x02, 0x12, 0xcf, 0xc0, 0x43,
0xc0, 0x0b, 0xf0, 0x0e, 0xbc, 0x10, 0x9a, 0xd9,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 0xf5, 0x93, 0xc5, 0x38, 0xf8, 0xcf, 0xcf, 0x5f, 0x9d, 0x56, 0x8e, 0xc7, 0x78, 0xeb,
0x53, 0xaf, 0xe1, 0x53, 0x5c, 0xe8, 0x85, 0xcc, 0xe4, 0x38, 0x21, 0x61, 0x3d, 0xe1, 0x50, 0xfc,
0x04, 0x7c, 0xfc, 0x1e, 0x1a, 0x93, 0x7d, 0x9a, 0xbc, 0x07, 0xc1, 0xf1, 0x52, 0x2e, 0xb4, 0x1b,
0x6d, 0xc1, 0x65, 0x9b, 0x7e, 0xf9, 0x87, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x31, 0x9b, 0xcb,
0xb7, 0x04, 0x06, 0x00, 0x00,
// 750 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x55, 0x6d, 0x6e, 0xdb, 0x46,
0x10, 0xc5, 0x8a, 0x5c, 0x8a, 0x5c, 0xb9, 0x6e, 0xb1, 0x30, 0x5a, 0xa2, 0xe8, 0x0f, 0x81, 0x68,
0x01, 0x15, 0x68, 0xfd, 0xc3, 0x3e, 0x81, 0x2c, 0x1a, 0x85, 0x5a, 0xd5, 0x76, 0x57, 0x56, 0xfb,
0xab, 0x05, 0xd6, 0xe2, 0xc8, 0x62, 0xbd, 0x22, 0xd9, 0x25, 0x59, 0x99, 0x47, 0x08, 0x90, 0x33,
0xe4, 0x10, 0xc9, 0x51, 0x72, 0x91, 0x1c, 0x21, 0xd8, 0xe1, 0xea, 0x0b, 0x4e, 0x02, 0x03, 0xf9,
0xf9, 0x66, 0x46, 0xc3, 0x37, 0xef, 0x3d, 0x8a, 0xec, 0x38, 0xcd, 0x2a, 0xd0, 0x99, 0x54, 0xa7,
0x85, 0xce, 0xab, 0x9c, 0xfb, 0x1b, 0x1c, 0xbd, 0x21, 0xac, 0x77, 0xf9, 0x58, 0xa8, 0x5c, 0xcb,
0x2a, 0x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x04, 0x55, 0x06, 0x44, 0x7f, 0xb3, 0x60,
0xa8, 0x40, 0x57, 0xa2, 0x56, 0xf0, 0x24, 0x62, 0x9c, 0xb9, 0xbf, 0x4e, 0xaf, 0xaf, 0x36, 0x89,
0xff, 0x77, 0x7a, 0x7d, 0xb5, 0xcb, 0xa9, 0xb3, 0x97, 0x53, 0x73, 0xd0, 0x6f, 0xb2, 0x90, 0xe3,
0x18, 0x8d, 0x75, 0x84, 0xf7, 0x80, 0x28, 0xfa, 0x89, 0xb9, 0xe6, 0xfd, 0xd8, 0xdb, 0xec, 0xe2,
0xe6, 0x13, 0x46, 0x2f, 0x57, 0x32, 0x55, 0x76, 0x35, 0x05, 0x03, 0xee, 0x3c, 0xfc, 0x44, 0x9c,
0xbf, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x83, 0xb5, 0x2a, 0x34, 0x06, 0x00, 0x00,
}

View File

@ -20,6 +20,7 @@ message Source {
string URL = 6; // URL are the connections to the source
bool Default = 7; // Flags an exploration as the default.
string Telegraf = 8; // Telegraf is the db telegraf is written to. By default it is "telegraf"
bool InsecureSkipVerify = 9; // InsecureSkipVerify accepts any certificate from the influx server
}
message Dashboard {

View File

@ -50,6 +50,16 @@ func TestMarshalSource(t *testing.T) {
} else if !reflect.DeepEqual(v, vv) {
t.Fatalf("source protobuf copy error: got %#v, expected %#v", vv, v)
}
// Test if the new insecureskipverify works
v.InsecureSkipVerify = true
if buf, err := internal.MarshalSource(v); err != nil {
t.Fatal(err)
} else if err := internal.UnmarshalSource(buf, &vv); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(v, vv) {
t.Fatalf("source protobuf copy error: got %#v, expected %#v", vv, v)
}
}
func TestMarshalServer(t *testing.T) {

View File

@ -38,6 +38,15 @@ func TestSourceStore(t *testing.T) {
URL: "toyota-hilux.lyon-estates.local",
Default: true,
},
chronograf.Source{
Name: "HipToBeSquare",
Type: "influx",
Username: "calvinklein",
Password: "chuck b3rry",
URL: "https://toyota-hilux.lyon-estates.local",
InsecureSkipVerify: true,
Default: false,
},
}
ctx := context.Background()
@ -94,7 +103,7 @@ func TestSourceStore(t *testing.T) {
Default: true,
})
srcs[2] = mustAddSource(t, s, srcs[2])
srcs[3] = mustAddSource(t, s, srcs[3])
if srcs, err := s.All(ctx); err != nil {
t.Fatal(err)
} else {
@ -121,22 +130,25 @@ func TestSourceStore(t *testing.T) {
}
// Delete the other source we created
if err := s.Delete(ctx, srcs[2]); err != nil {
if err := s.Delete(ctx, srcs[3]); err != nil {
t.Fatal(err)
}
if bsrcs, err := s.All(ctx); err != nil {
t.Fatal(err)
} else if len(bsrcs) != 1 {
t.Fatalf("After delete All returned incorrect number of srcs; got %d, expected %d", len(bsrcs), 1)
} else if len(bsrcs) != 2 {
t.Fatalf("After delete All returned incorrect number of srcs; got %d, expected %d", len(bsrcs), 2)
} else if !reflect.DeepEqual(bsrcs[0], srcs[1]) {
t.Fatalf("After delete All returned incorrect source; got %v, expected %v", bsrcs[0], srcs[1])
}
// Delete the final source
// Delete the final sources
if err := s.Delete(ctx, srcs[1]); err != nil {
t.Fatal(err)
}
if err := s.Delete(ctx, srcs[2]); err != nil {
t.Fatal(err)
}
// Try to add one source as a non-default and ensure that it becomes a
// default

View File

@ -78,14 +78,15 @@ type Response interface {
// Source is connection information to a time-series data store.
type Source struct {
ID int `json:"id,omitempty,string"` // ID is the unique ID of the source
Name string `json:"name"` // Name is the user-defined name for the source
Type string `json:"type,omitempty"` // Type specifies which kinds of source (enterprise vs oss)
Username string `json:"username,omitempty"` // Username is the username to connect to the source
Password string `json:"password,omitempty"` // Password is in CLEARTEXT
URL string `json:"url"` // URL are the connections to the source
Default bool `json:"default"` // Default specifies the default source for the application
Telegraf string `json:"telegraf"` // Telegraf is the db telegraf is written to. By default it is "telegraf"
ID int `json:"id,omitempty,string"` // ID is the unique ID of the source
Name string `json:"name"` // Name is the user-defined name for the source
Type string `json:"type,omitempty"` // Type specifies which kinds of source (enterprise vs oss)
Username string `json:"username,omitempty"` // Username is the username to connect to the source
Password string `json:"password,omitempty"` // Password is in CLEARTEXT
URL string `json:"url"` // URL are the connections to the source
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` // InsecureSkipVerify as true means any certificate presented by the source is accepted.
Default bool `json:"default"` // Default specifies the default source for the application
Telegraf string `json:"telegraf"` // Telegraf is the db telegraf is written to. By default it is "telegraf"
}
// SourcesStore stores connection information for a `TimeSeries`

View File

@ -2,6 +2,7 @@ package influx
import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"net/http"
@ -12,7 +13,8 @@ import (
// Client is a device for retrieving time series data from an InfluxDB instance
type Client struct {
URL *url.URL
URL *url.URL
InsecureSkipVerify bool
Logger chronograf.Logger
}
@ -64,8 +66,15 @@ func (c *Client) query(u *url.URL, q chronograf.Query) (chronograf.Response, err
params.Set("rp", q.RP)
params.Set("epoch", "ms")
req.URL.RawQuery = params.Encode()
httpClient := &http.Client{}
resp, err := httpClient.Do(req)
hc := &http.Client{}
if c.InsecureSkipVerify {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
hc.Transport = tr
}
resp, err := hc.Do(req)
if err != nil {
return nil, err
}
@ -145,6 +154,10 @@ func (c *Client) Connect(ctx context.Context, src *chronograf.Source) error {
return err
}
u.User = url.UserPassword(src.Username, src.Password)
// Only allow acceptance of all certs if the scheme is https AND the user opted into to the setting.
if u.Scheme == "https" && src.InsecureSkipVerify {
c.InsecureSkipVerify = src.InsecureSkipVerify
}
c.URL = u
return nil
}

View File

@ -44,6 +44,82 @@ func Test_Influx_MakesRequestsToQueryEndpoint(t *testing.T) {
}
}
func Test_Influx_HTTPS_Failure(t *testing.T) {
called := false
ts := httptest.NewTLSServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
called = true
}))
defer ts.Close()
ctx := context.Background()
var series chronograf.TimeSeries
series, err := influx.NewClient(ts.URL, log.New(log.DebugLevel))
if err != nil {
t.Fatal("Unexpected error initializing client: err:", err)
}
src := chronograf.Source{
URL: ts.URL,
}
if err := series.Connect(ctx, &src); err != nil {
t.Fatal("Unexpected error connecting to client: err:", err)
}
query := chronograf.Query{
Command: "show databases",
}
_, err = series.Query(ctx, query)
if err == nil {
t.Error("Expected error but was successful")
}
if called == true {
t.Error("Expected http request to fail, but, succeeded")
}
}
func Test_Influx_HTTPS_InsecureSkipVerify(t *testing.T) {
t.Parallel()
called := false
ts := httptest.NewTLSServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
rw.WriteHeader(http.StatusOK)
rw.Write([]byte(`{}`))
called = true
if path := r.URL.Path; path != "/query" {
t.Error("Expected the path to contain `/query` but was", path)
}
}))
defer ts.Close()
ctx := context.Background()
var series chronograf.TimeSeries
series, err := influx.NewClient(ts.URL, log.New(log.DebugLevel))
if err != nil {
t.Fatal("Unexpected error initializing client: err:", err)
}
src := chronograf.Source{
URL: ts.URL,
InsecureSkipVerify: true,
}
if err := series.Connect(ctx, &src); err != nil {
t.Fatal("Unexpected error connecting to client: err:", err)
}
query := chronograf.Query{
Command: "show databases",
}
_, err = series.Query(ctx, query)
if err != nil {
t.Fatal("Expected no error but was", err)
}
if called == false {
t.Error("Expected http request to Influx but there was none")
}
}
func Test_Influx_CancelsInFlightRequests(t *testing.T) {
t.Parallel()

View File

@ -150,6 +150,7 @@ func (h *Service) UpdateSource(w http.ResponseWriter, r *http.Request) {
}
src.Default = req.Default
src.InsecureSkipVerify = req.InsecureSkipVerify
if req.Name != "" {
src.Name = req.Name
}

View File

@ -1747,7 +1747,7 @@
}
}
}
},
}
},
"definitions": {
"Kapacitors": {
@ -1969,6 +1969,10 @@
"format": "url",
"description": "URL for the time series data source backend (e.g. http://localhost:8086)"
},
"insecureSkipVerify": {
"type": "boolean",
"description": "True means any certificate presented by the source is accepted. Typically used for self-signed certs. Probably should only be used for testing."
},
"default": {
"type": "boolean",
"description": "Indicates whether this source is the default source"