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

[vcenterreceiver]collects metric and still prompts x509 error when TLS.Insecure and TLS.InsecureSkipVerify is set #15701

Closed
wzy531a opened this issue Oct 28, 2022 · 2 comments
Labels
bug Something isn't working receiver/vcenter

Comments

@wzy531a
Copy link
Contributor

wzy531a commented Oct 28, 2022

What happened?

Description

In a local area network, a self-signed CA certificate is usually used. At this time, I want to skip the certification. Usually, TLS.Insecure and TLS.InsecureSkipVerify are set, but this seems to have no effect, and an x509-related error is still prompted when connecting to the vcenter.

When I was troubleshooting the problem, I found that in gommomi.NewClient, when parameter TLS.Insecure is true, a TLSConfig will be automatically generated to vm.client. While in the LoadTLSConfig method, when the CA certificate path is nil, the mothod return TLSConfig is nil, overrides the default generated TLSConfig in Line#68, resulting in TLS.InsecureSkipVerify not taking effect.

Collector version

v0.63.0

Environment information

Environment

OS: centos 7

OpenTelemetry Collector configuration

receivers:
  vcenter:
    endpoint: *
    username: *
    password: *
    collection_interval: 10s
    tls:
      insecure: true
      insecure_skip_verify: true
exporters:
  file:
    path: "/opt/otelcol/test.txt"
service:
  pipelines:
    metrics:
      exporters: [ file ]
      receivers: [ vcenter ]

Log output

2022/10/27 10:01:33	error	scraperhelper/scrapercontroller.go:197	Error scraping metrics	{"error": "Post \"https://*.*.*.*:443/sdk\": x509: cannot validate certificate for *.*.*.* because it doesn't contain any IP SANs ...

Additional context

No response

@wzy531a
Copy link
Contributor Author

wzy531a commented Oct 28, 2022

I have submitted PR to fix this problem.

@wzy531a wzy531a changed the title Vcenterreceiver collects metric and still prompts x509 error when TLS.Insecure and TLS.InsecureSkipVerify is set [vcenterreceiver]collects metric and still prompts x509 error when TLS.Insecure and TLS.InsecureSkipVerify is set Oct 28, 2022
@fatsheep9146 fatsheep9146 added receiver/vcenter and removed needs triage New item requiring triage labels Oct 28, 2022
@github-actions
Copy link
Contributor

Pinging code owners: @djaglowski @schmikei. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@wzy531a wzy531a closed this as completed Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/vcenter
Projects
None yet
Development

No branches or pull requests

2 participants