Skip to content

Error loading TLS certificates from single line #12963

@jscancella

Description

@jscancella

Component(s)

No response

What happened?

Describe the bug
When loading the cert_pem and key_pem from a single line (using \n character to delimit the needed newlines) it fails to understand the cert

Steps to reproduce
reformat SSL cert and key to a single line using \n to replacement newline

What did you expect to see?
SSL cert and key are accepted. It would greatly help being able to pull from systems that only allow for a single line per key.

What did you see instead?

Error: cannot start pipelines: failed to start "otlp" receiver: failed to load TLS config: failed to load TLS cert and key: failed to load TLS cert and key PEMs: tls: failed to find any PEM data in certificate input
2025/05/05 17:59:33 collector server run finished with error: cannot start pipelines: failed to start "otlp" receiver: failed to load TLS config: failed to load TLS cert and key: failed to load TLS cert and key PEMs: tls: failed to find any PEM data in certificate input

Dockerfile.txt

Collector version

0.123.0

Environment information

Environment

OS: docker container on AWS ECS fargate

OpenTelemetry Collector configuration

receivers:
    otlp:
        protocols:
            http:
                endpoint: 0.0.0.0:4318
                tls:
                    cert_pem: ${CERT_PEM}
                    key_pem: ${KEY_PEM}
                    ca_file: /etc/ssl/certs/ca-certificates.crt

exporters:
    debug:
        verbosity: detailed

service:
    pipelines:
        traces:
            receivers: [otlp]
            processors: []
            exporters: [debug]

Log output

PS C:\Users\John\Documents\repos\otel-collector> docker run --rm -it foo
2025-05-05T17:59:33.290Z        info    service@v0.123.0/service.go:197 Setting up own telemetry...
2025-05-05T17:59:33.290Z        info    builders/builders.go:26 Development component. May change in the future.
2025-05-05T17:59:33.291Z        info    service@v0.123.0/service.go:264 Starting otelcol-contrib...     {"Version": "0.123.0", "NumCPU": 12}
2025-05-05T17:59:33.291Z        info    extensions/extensions.go:41     Starting extensions...
2025-05-05T17:59:33.291Z        info    otlpreceiver@v0.123.0/otlp.go:173       Starting HTTP server    {"endpoint": "0.0.0.0:4318"}
2025-05-05T17:59:33.293Z        error   graph/graph.go:438      Failed to start component       {"error": "failed to load TLS config: failed to load TLS cert and key: failed to load TLS cert and key PEMs: tls: failed to find any PEM data in certificate input", "type": "Receiver", "id": "otlp"}
2025-05-05T17:59:33.293Z        info    service@v0.123.0/service.go:329 Starting shutdown...
2025-05-05T17:59:33.293Z        info    extensions/extensions.go:69     Stopping extensions...
2025-05-05T17:59:33.293Z        info    service@v0.123.0/service.go:343 Shutdown complete.
Error: cannot start pipelines: failed to start "otlp" receiver: failed to load TLS config: failed to load TLS cert and key: failed to load TLS cert and key PEMs: tls: failed to find any PEM data in certificate input
2025/05/05 17:59:33 collector server run finished with error: cannot start pipelines: failed to start "otlp" receiver: failed to load TLS config: failed to load TLS cert and key: failed to load TLS cert and key PEMs: tls: failed to find any PEM data in certificate input

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions