Skip to content

DNS names in certificate terminate with an dot - violates standard #4316

@dkrizic

Description

@dkrizic

I installed the operator and created a cluster named 'master' with basically default configuration:

apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
  name: master
  namespace: persistence

spec:
  config:
  postgresVersion: 16
  instances:
    - name: instance1
      replicas: 2
...

When I do a port-forward to localhost:5432 and try to connect with a Go application I get the following error

Error connecting to database: tls: failed to parse certificate from server: x509: SAN dNSName is malformed

I took a look in the the secret master-server-cert and then the tls.crt and found this:

            X509v3 Subject Alternative Name: 
                DNS:master-primary.persistence.svc.cluster.local., DNS:master-primary.persistence.svc, DNS:master-primary.persistence, DNS:master-primary, DNS:master-replicas.persistence.svc.cluster.local., DNS:master-replicas.persistence.svc, DNS:master-replicas.persistence, DNS:master-replicas

All the names that terminate with a dot are illegal according to X.509 standard. It looks like the go client library does not like the certificate. Is this a bug or do I see this wrong?

Additionally: Is there an easy way to add hosts like "localhost" or "db.example.com" (for a TCPRoute) to the certificate?

Fun fact: I am able to access the database remotely (either port-forward or TCPRoute) from the Database-Client in Golang which is Java-based. Obviously Java is more relaxed than Go regarding the certificate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions