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

Database TLS "insecure" mode does not generate client certificate #10803

Closed
r0mant opened this issue Mar 3, 2022 · 0 comments · Fixed by #10899
Closed

Database TLS "insecure" mode does not generate client certificate #10803

r0mant opened this issue Mar 3, 2022 · 0 comments · Fixed by #10899
Assignees
Labels
bug database-access Database access related issues and PRs

Comments

@r0mant
Copy link
Collaborator

r0mant commented Mar 3, 2022

Description

What happened:

With the following database configuration:

db_service:
  enabled: "yes"
  databases:
  - name: "postgres"
    description: "🐘 PostgreSQL 13.0: Local"
    protocol: "postgres"
    uri: "localhost:5432"
    tls:
      mode: insecure

Connection to Postgres fails with:

Original Error: *pgconn.connectError failed to connect to `host=localhost user=postgres database=postgres`: server error (FATAL: connection requires a valid client certificate (SQLSTATE 28000))

In the Postgres logs:

2022-03-03 19:29:31.600 GMT [50] FATAL:  connection requires a valid client certificate

It looks like TLS "insecure" mode just sets InsecureSkipVerify to true and does not actually generate client certificate for the connection:

https://github.com/gravitational/teleport/blob/v9.0.0-beta.1/lib/srv/db/common/auth.go#L384-L393

The setting should only apply to validating the server certificate.

What you expected to happen:

Connection to self-hosted database which presents an invalid certificate should still succeed with "insecure" mode.

Reproduction Steps

As minimally and precisely as possible, describe step-by-step how to reproduce the problem.

  1. Configure a self-hosted Postgres with an invalid certificate.
  2. Configure database access with TLS insecure mode.
  3. Try to tsh db connect to it.
@r0mant r0mant added bug database-access Database access related issues and PRs labels Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug database-access Database access related issues and PRs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants