Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Google Cloud Platform support #13598

Merged
merged 35 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
73a6be9
initialize GCP support
kvch Jul 18, 2019
8c020df
tmp
kvch Nov 21, 2019
2be6675
move go.mod
kvch Dec 11, 2019
d1a264b
update vendor
kvch Dec 12, 2019
35ab57b
update go.mod
kvch Dec 12, 2019
bc01ef6
add folder
kvch Dec 12, 2019
bf3dfb7
use vendor when uploading function
kvch Dec 12, 2019
1d96ecb
add vendor folder to pkg
kvch Jan 6, 2020
176f687
rm unused file
kvch Jan 6, 2020
7e6b60c
fix rebase
kvch Jan 6, 2020
d7ab36a
minor fixes
kvch Jan 6, 2020
da0a9ea
mark it beta
kvch Jan 6, 2020
bfd2f6c
address review notes
kvch Jan 7, 2020
67a11a4
more addressing
kvch Jan 7, 2020
f18cb77
feed the hound
kvch Jan 7, 2020
9edf6e7
more addressing
kvch Jan 8, 2020
04cd032
moar address
kvch Jan 8, 2020
44cedcd
feed the hound
kvch Jan 8, 2020
40b7f0f
move config back
kvch Jan 8, 2020
83151d1
mage config
kvch Jan 8, 2020
1cfcc25
pass context via constructor
kvch Jan 9, 2020
4fbc832
fix path
kvch Jan 9, 2020
1400084
adjust error message
kvch Jan 9, 2020
2a3da59
adjust deps
kvch Jan 9, 2020
a55c9f5
refactor packaging
kvch Jan 13, 2020
c7e8a01
more rebase
kvch Jan 13, 2020
42b53af
remove ZipResourcer
kvch Jan 13, 2020
ed570e8
sore excluded deps
kvch Jan 14, 2020
c556ae8
collect deps properly
kvch Jan 14, 2020
93c66f7
fix path
kvch Jan 14, 2020
1a6d4ae
add reference to resource limits
kvch Jan 14, 2020
80228fe
do not use beta api anymore
kvch Jan 14, 2020
0872410
add testing
kvch Jan 14, 2020
419be75
Exclude TLS1.3 support if older go version is used (#15543)
Jan 14, 2020
19919f5
add changelog entry
kvch Jan 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Make `bulk_max_size` configurable in outputs. {pull}13493[13493]
- Add `index` option to all functions to directly set a per-function index value. {issue}15064[15064] {pull}15101[15101]
- Add monitoring info about triggered functions. {pull}14876[14876]
- Add Google Cloud Platform support. {pull}13598[13598]

*Winlogbeat*

Expand Down
7 changes: 7 additions & 0 deletions dev-tools/mage/gotool/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func ListPackages(pkgs ...string) ([]string, error) {
return getLines(callGo(nil, "list", pkgs...))
}

// ListDeps calls `go list -dep` for every package spec given.
func ListDeps(pkg string) ([]string, error) {
const tmpl = `{{if not .Standard}}{{.ImportPath}}{{end}}`

return getLines(callGo(nil, "list", "-deps", "-f", tmpl, pkg))
}

// ListTestFiles lists all go and cgo test files available in a package.
func ListTestFiles(pkg string) ([]string, error) {
const tmpl = `{{ range .TestGoFiles }}{{ printf "%s\n" . }}{{ end }}` +
Expand Down
25 changes: 14 additions & 11 deletions libbeat/common/transport/tlscommon/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ func TestApplyEmptyConfig(t *testing.T) {
}

cfg := tmp.BuildModuleConfig("")
assert.Equal(t, int(tls.VersionTLS11), int(cfg.MinVersion))
assert.Equal(t, int(tls.VersionTLS13), int(cfg.MaxVersion))
assert.Equal(t, int(TLSVersionDefaultMin), int(cfg.MinVersion))
assert.Equal(t, int(TLSVersionDefaultMax), int(cfg.MaxVersion))
assert.Len(t, cfg.Certificates, 0)
assert.Nil(t, cfg.RootCAs)
assert.Equal(t, false, cfg.InsecureSkipVerify)
Expand Down Expand Up @@ -163,8 +163,8 @@ func TestApplyWithConfig(t *testing.T) {
assert.NotNil(t, cfg.RootCAs)
assert.Equal(t, true, cfg.InsecureSkipVerify)
assert.Len(t, cfg.CipherSuites, 2)
assert.Equal(t, int(tls.VersionTLS11), int(cfg.MinVersion))
assert.Equal(t, int(tls.VersionTLS13), int(cfg.MaxVersion))
assert.Equal(t, int(TLSVersionDefaultMin), int(cfg.MinVersion))
assert.Equal(t, int(TLSVersionDefaultMax), int(cfg.MaxVersion))
assert.Len(t, cfg.CurvePreferences, 1)
assert.Equal(t, tls.RenegotiateOnceAsClient, cfg.Renegotiation)
}
Expand All @@ -188,8 +188,8 @@ func TestServerConfigDefaults(t *testing.T) {
assert.Len(t, cfg.CurvePreferences, 0)
// values set by default
assert.Equal(t, false, cfg.InsecureSkipVerify)
assert.Equal(t, int(tls.VersionTLS11), int(cfg.MinVersion))
assert.Equal(t, int(tls.VersionTLS13), int(cfg.MaxVersion))
assert.Equal(t, int(TLSVersionDefaultMin), int(cfg.MinVersion))
assert.Equal(t, int(TLSVersionDefaultMax), int(cfg.MaxVersion))
assert.Equal(t, tls.NoClientCert, cfg.ClientAuth)
})
t.Run("when CA is explicitly set", func(t *testing.T) {
Expand All @@ -214,8 +214,8 @@ func TestServerConfigDefaults(t *testing.T) {
assert.Len(t, cfg.CurvePreferences, 0)
// values set by default
assert.Equal(t, false, cfg.InsecureSkipVerify)
assert.Equal(t, int(tls.VersionTLS11), int(cfg.MinVersion))
assert.Equal(t, int(tls.VersionTLS13), int(cfg.MaxVersion))
assert.Equal(t, int(TLSVersionDefaultMin), int(cfg.MinVersion))
assert.Equal(t, int(TLSVersionDefaultMax), int(cfg.MaxVersion))
assert.Equal(t, tls.RequireAndVerifyClientCert, cfg.ClientAuth)
})
}
Expand All @@ -227,14 +227,17 @@ func TestApplyWithServerConfig(t *testing.T) {
certificate_authorities: [ca_test.pem]
verification_mode: none
client_authentication: optional
supported_protocols: [TLSv1.1, TLSv1.2, TLSv1.3]
cipher_suites:
- "ECDHE-ECDSA-AES-256-CBC-SHA"
- "ECDHE-ECDSA-AES-256-GCM-SHA384"
curve_types: [P-384]
`
var c ServerConfig
config, err := common.NewConfigWithYAML([]byte(yamlStr), "")
for i, ver := range TLSDefaultVersions {
config.SetString("supported_protocols", i, ver.String())
}

if !assert.NoError(t, err) {
return
}
Expand All @@ -254,8 +257,8 @@ func TestApplyWithServerConfig(t *testing.T) {
assert.NotNil(t, cfg.ClientCAs)
assert.Equal(t, true, cfg.InsecureSkipVerify)
assert.Len(t, cfg.CipherSuites, 2)
assert.Equal(t, int(tls.VersionTLS11), int(cfg.MinVersion))
assert.Equal(t, int(tls.VersionTLS13), int(cfg.MaxVersion))
assert.Equal(t, int(TLSVersionDefaultMin), int(cfg.MinVersion))
assert.Equal(t, int(TLSVersionDefaultMax), int(cfg.MaxVersion))
assert.Len(t, cfg.CurvePreferences, 1)
assert.Equal(t, tls.VerifyClientCertIfGiven, cfg.ClientAuth)
}
Expand Down
55 changes: 0 additions & 55 deletions libbeat/common/transport/tlscommon/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,6 @@ var tlsRenegotiationSupportTypes = map[string]tlsRenegotiationSupport{
"freely": tlsRenegotiationSupport(tls.RenegotiateFreelyAsClient),
}

// TLSVersion type for TLS version.
type TLSVersion uint16

// Define all the possible TLS version.
const (
TLSVersionSSL30 TLSVersion = tls.VersionSSL30
TLSVersion10 TLSVersion = tls.VersionTLS10
TLSVersion11 TLSVersion = tls.VersionTLS11
TLSVersion12 TLSVersion = tls.VersionTLS12
TLSVersion13 TLSVersion = tls.VersionTLS13
)

// TLSDefaultVersions list of versions of TLS we should support.
var TLSDefaultVersions = []TLSVersion{
TLSVersion11,
TLSVersion12,
TLSVersion13,
}

type tlsClientAuth int

const (
Expand All @@ -132,24 +113,6 @@ var tlsClientAuthTypes = map[string]tlsClientAuth{
"required": tlsClientAuthRequired,
}

var tlsProtocolVersions = map[string]TLSVersion{
"SSLv3": TLSVersionSSL30,
"SSLv3.0": TLSVersionSSL30,
"TLSv1": TLSVersion10,
"TLSv1.0": TLSVersion10,
"TLSv1.1": TLSVersion11,
"TLSv1.2": TLSVersion12,
"TLSv1.3": TLSVersion13,
}

var tlsProtocolVersionsInverse = map[TLSVersion]string{
TLSVersionSSL30: "SSLv3",
TLSVersion10: "TLSv1.0",
TLSVersion11: "TLSv1.1",
TLSVersion12: "TLSv1.2",
TLSVersion13: "TLSv1.3",
}

// TLSVerificationMode represents the type of verification to do on the remote host,
// `none` or `full` and we default to `full`, internally this option is transformed into the
// `insecure` field in the `tls.Config` struct.
Expand All @@ -166,24 +129,6 @@ const (
// VerifyCertificate
)

func (v TLSVersion) String() string {
if s, ok := tlsProtocolVersionsInverse[v]; ok {
return s
}
return "unknown"
}

//Unpack transforms the string into a constant.
func (v *TLSVersion) Unpack(s string) error {
version, found := tlsProtocolVersions[s]
if !found {
return fmt.Errorf("invalid tls version '%v'", s)
}

*v = version
return nil
}

var tlsVerificationModes = map[string]TLSVerificationMode{
"": VerifyFull,
"full": VerifyFull,
Expand Down
41 changes: 41 additions & 0 deletions libbeat/common/transport/tlscommon/versions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package tlscommon

import "fmt"

// TLSVersion type for TLS version.
type TLSVersion uint16

func (v TLSVersion) String() string {
if s, ok := tlsProtocolVersionsInverse[v]; ok {
return s
}
return "unknown"
}

//Unpack transforms the string into a constant.
func (v *TLSVersion) Unpack(s string) error {
version, found := tlsProtocolVersions[s]
if !found {
return fmt.Errorf("invalid tls version '%v'", s)
}

*v = version
return nil
}
70 changes: 70 additions & 0 deletions libbeat/common/transport/tlscommon/versions_default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// +build go1.13

package tlscommon

import "crypto/tls"

// Define all the possible TLS version.
const (
TLSVersionSSL30 TLSVersion = tls.VersionSSL30
TLSVersion10 TLSVersion = tls.VersionTLS10
TLSVersion11 TLSVersion = tls.VersionTLS11
TLSVersion12 TLSVersion = tls.VersionTLS12
TLSVersion13 TLSVersion = tls.VersionTLS13

// TLSVersionMin is the min TLS version supported.
TLSVersionMin = TLSVersionSSL30

// TLSVersionMax is the max TLS version supported.
TLSVersionMax = TLSVersion13

// TLSVersionDefaultMin is the minimal default TLS version that is
// enabled by default. TLSVersionDefaultMin is >= TLSVersionMin
TLSVersionDefaultMin = TLSVersion11

// TLSVersionDefaultMax is the max default TLS version that
// is enabled by default.
TLSVersionDefaultMax = TLSVersionMax
)

// TLSDefaultVersions list of versions of TLS we should support.
var TLSDefaultVersions = []TLSVersion{
TLSVersion11,
TLSVersion12,
TLSVersion13,
}

var tlsProtocolVersions = map[string]TLSVersion{
"SSLv3": TLSVersionSSL30,
"SSLv3.0": TLSVersionSSL30,
"TLSv1": TLSVersion10,
"TLSv1.0": TLSVersion10,
"TLSv1.1": TLSVersion11,
"TLSv1.2": TLSVersion12,
"TLSv1.3": TLSVersion13,
}

var tlsProtocolVersionsInverse = map[TLSVersion]string{
TLSVersionSSL30: "SSLv3",
TLSVersion10: "TLSv1.0",
TLSVersion11: "TLSv1.1",
TLSVersion12: "TLSv1.2",
TLSVersion13: "TLSv1.3",
}
66 changes: 66 additions & 0 deletions libbeat/common/transport/tlscommon/versions_legacy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// +build !go1.13

package tlscommon

import "crypto/tls"

const (
TLSVersionSSL30 TLSVersion = tls.VersionSSL30

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const TLSVersionSSL30 should have comment (or a comment on this block) or be unexported

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const TLSVersionSSL30 should have comment (or a comment on this block) or be unexported

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const TLSVersionSSL30 should have comment (or a comment on this block) or be unexported

TLSVersion10 TLSVersion = tls.VersionTLS10
TLSVersion11 TLSVersion = tls.VersionTLS11
TLSVersion12 TLSVersion = tls.VersionTLS12

// TLSVersionMin is the min TLS version supported.
TLSVersionMin = TLSVersionSSL30

// TLSVersionMax is the max TLS version supported.
TLSVersionMax = TLSVersion12

// TLSVersionDefaultMin is the minimal default TLS version that is
// enabled by default. TLSVersionDefaultMin is >= TLSVersionMin
TLSVersionDefaultMin = TLSVersion10

// TLSVersionDefaultMax is the max default TLS version that
// is enabled by default.
TLSVersionDefaultMax = TLSVersionMax
)

// TLSDefaultVersions list of versions of TLS we should support.
var TLSDefaultVersions = []TLSVersion{
TLSVersion10,
TLSVersion11,
TLSVersion12,
}

var tlsProtocolVersions = map[string]TLSVersion{
"SSLv3": TLSVersionSSL30,
"SSLv3.0": TLSVersionSSL30,
"TLSv1": TLSVersion10,
"TLSv1.0": TLSVersion10,
"TLSv1.1": TLSVersion11,
"TLSv1.2": TLSVersion12,
}

var tlsProtocolVersionsInverse = map[TLSVersion]string{
TLSVersionSSL30: "SSLv3",
TLSVersion10: "TLSv1.0",
TLSVersion11: "TLSv1.1",
TLSVersion12: "TLSv1.2",
}
14 changes: 0 additions & 14 deletions libbeat/outputs/transport/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@ type TLSConfig = tlscommon.TLSConfig
// TLSVersion type for TLS version.
type TLSVersion = tlscommon.TLSVersion

// Define all the possible TLS version.
const (
TLSVersionSSL30 = tlscommon.TLSVersionSSL30
TLSVersion10 = tlscommon.TLSVersion10
TLSVersion11 = tlscommon.TLSVersion11
TLSVersion12 = tlscommon.TLSVersion12
)

// Constants of the supported verification mode.
const (
VerifyFull = tlscommon.VerifyFull
VerifyNone = tlscommon.VerifyNone
)

func TLSDialer(forward Dialer, config *TLSConfig, timeout time.Duration) (Dialer, error) {
return TestTLSDialer(testing.NullDriver, forward, config, timeout)
}
Expand Down
19 changes: 19 additions & 0 deletions vendor/cloud.google.com/go/functions/metadata/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading