Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -430,6 +430,7 @@ otherwise no tag is added. {issue}42208[42208] {pull}42403[42403]
- Update beat module with apm-server tail sampling monitoring metrics fields {pull}42569[42569]
- Log every 401 response from Kubernetes API Server {pull}42714[42714]
- Add a new `match_by_parent_instance` option to `perfmon` module. {pull}43002[43002]
- Add a warning log to metricbeat.vsphere in case vSphere connection has been configured as insecure. {pull}43104[43104]

*Metricbeat*
- Add benchmark module {pull}41801[41801]
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/vsphere/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"

"github.com/vmware/govmomi"
"github.com/vmware/govmomi/property"
Expand Down Expand Up @@ -75,6 +76,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err != nil {
return nil, err
}

security.WarnIfInsecure(ms.Logger(), "cluster", ms.Insecure)
return &ClusterMetricSet{ms}, nil
}

Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/vsphere/datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"

"github.com/vmware/govmomi"
"github.com/vmware/govmomi/performance"
Expand Down Expand Up @@ -52,6 +53,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err != nil {
return nil, err
}

security.WarnIfInsecure(ms.Logger(), "datastore", ms.Insecure)
return &DataStoreMetricSet{ms}, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"

"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
Expand Down Expand Up @@ -56,6 +58,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err != nil {
return nil, fmt.Errorf("failed to create vSphere metricset: %w", err)
}

security.WarnIfInsecure(ms.Logger(), "datastorecluster", ms.Insecure)
return &DatastoreClusterMetricSet{ms}, nil
}

Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/vsphere/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"

"github.com/vmware/govmomi"
"github.com/vmware/govmomi/performance"
Expand Down Expand Up @@ -52,6 +53,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err != nil {
return nil, err
}

security.WarnIfInsecure(ms.Logger(), "host", ms.Insecure)
return &HostMetricSet{ms}, nil
}

Expand Down
4 changes: 4 additions & 0 deletions metricbeat/module/vsphere/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"

"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
Expand Down Expand Up @@ -55,6 +57,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err != nil {
return nil, fmt.Errorf("failed to create vSphere metricset: %w", err)
}

security.WarnIfInsecure(ms.Logger(), "network", ms.Insecure)
return &NetworkMetricSet{ms}, nil
}

Expand Down
4 changes: 4 additions & 0 deletions metricbeat/module/vsphere/resourcepool/resourcepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"

"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
Expand Down Expand Up @@ -56,6 +58,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err != nil {
return nil, err
}

security.WarnIfInsecure(ms.Logger(), "resourcepool", ms.Insecure)
return &ResourcePoolMetricSet{ms}, nil
}

Expand Down
26 changes: 26 additions & 0 deletions metricbeat/module/vsphere/security/logging.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 security

import "github.com/elastic/elastic-agent-libs/logp"

func WarnIfInsecure(logger *logp.Logger, metricSet string, isInsecure bool) {
if isInsecure {
logger.With("metricset", metricSet).Warn("Your vSphere connection is configured as insecure. This can lead to man-in-the-middle attack.")
}
}
3 changes: 3 additions & 0 deletions metricbeat/module/vsphere/virtualmachine/virtualmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/vsphere"
"github.com/elastic/beats/v7/metricbeat/module/vsphere/security"
"github.com/elastic/elastic-agent-libs/mapstr"

"github.com/vmware/govmomi"
Expand Down Expand Up @@ -94,6 +95,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
if err := base.Module().UnpackConfig(&config); err != nil {
return nil, err
}

security.WarnIfInsecure(ms.Logger(), "virtualmachine", ms.Insecure)
return &MetricSet{
MetricSet: ms,
GetCustomFields: config.GetCustomFields,
Expand Down
Loading