Skip to content

Add TLS configuration options for VictoriaLogs connections - #86

Open
mkobozev wants to merge 1 commit into
VictoriaMetrics:mainfrom
mkobozev:feature/tls-skip-verify
Open

Add TLS configuration options for VictoriaLogs connections#86
mkobozev wants to merge 1 commit into
VictoriaMetrics:mainfrom
mkobozev:feature/tls-skip-verify

Conversation

@mkobozev

@mkobozev mkobozev commented Apr 21, 2026

Copy link
Copy Markdown

What does this PR do?

Adds two environment variables for connecting to VictoriaLogs instances that
serve a TLS certificate which is not trusted by the system certificate store:

Variable Effect
VL_INSTANCE_TLS_CA_FILE Path to a PEM-encoded CA bundle, appended to the system roots.
VL_INSTANCE_TLS_INSECURE_SKIP_VERIFY Disables certificate verification entirely.

Why is this needed?

On-premise and internal deployments often terminate TLS with a certificate
issued by a private CA. Today the MCP server cannot talk to such an instance
over HTTPS at all.

VL_INSTANCE_TLS_CA_FILE is the intended fix for that case, and matches what
the VictoriaMetrics components already offer via -*.tlsCAFile.
VL_INSTANCE_TLS_INSECURE_SKIP_VERIFY is the escape hatch for development and
testing, mirroring -*.tlsInsecureSkipVerify.

Changes

  • cmd/mcp-victorialogs/config/config.go: parses both variables and builds an
    *http.Client with the resulting TLS settings.
  • cmd/mcp-victorialogs/tools/utils.go: GetTextBodyForRequest uses the client
    from the config. The *config.Config parameter was already in the signature
    but unused.
  • cmd/mcp-victorialogs/main.go: logs a warning when verification is disabled.
  • README.md: both variables added to the configuration table.
  • cmd/mcp-victorialogs/config/config_test.go: subtests for defaults, valid and
    invalid values, a valid CA bundle, a missing CA file, a CA file with no
    certificates, and the mutually exclusive combination.

Notes

  • Both options are disabled by default, so there is no behavior change for
    existing users. When neither is set, http.DefaultClient is used exactly as
    before.
  • The custom transport lives on a client owned by Config rather than replacing
    http.DefaultTransport, so disabling verification cannot leak into unrelated
    outbound requests.
  • The two options are mutually exclusive: InsecureSkipVerify would silently
    ignore RootCAs, so setting both fails at startup instead.
  • The boolean is parsed with strconv.ParseBool and an invalid value fails at
    startup, consistent with how MCP_LOG_FORMAT, MCP_SERVER_MODE and
    MCP_HEARTBEAT_INTERVAL are handled.
  • No new dependencies: everything used here is from the standard library.
  • Happy to rename the branch or split the CA bundle support into a separate PR
    if you would prefer that.

@mkobozev
mkobozev requested a review from Amper as a code owner April 21, 2026 14:52
Add two environment variables for instances that serve certificates not
trusted by the system certificate store:

- VL_INSTANCE_TLS_CA_FILE: path to a PEM-encoded CA bundle, appended to
  the system roots. The preferred way to trust an internal CA.
- VL_INSTANCE_TLS_INSECURE_SKIP_VERIFY: disables certificate
  verification entirely. Meant for development and testing only, logs a
  warning when enabled.

Both options are disabled by default and are mutually exclusive, so
there is no behavior change for existing users.

The customized transport belongs to a client owned by Config instead of
replacing http.DefaultTransport, so that the settings apply only to
requests to the VictoriaLogs instance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mkobozev
mkobozev force-pushed the feature/tls-skip-verify branch from f8f5033 to 18e57b8 Compare July 26, 2026 11:24
@mkobozev mkobozev changed the title Add VL_INSTANCE_TLS_SKIP_VERIFY option to skip TLS certificate verification Add TLS configuration options for VictoriaLogs connections Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant