Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Error: self signed certificate in certificate chain when connecting to TLS enabled Postgres instance with sslmode=prefer #3135

Closed
1 of 3 tasks
NiklasRosenstein opened this issue Jul 6, 2023 · 2 comments

Comments

@NiklasRosenstein
Copy link

NiklasRosenstein commented Jul 6, 2023

The bug

This is a follow up to #902. I'm connecting to a Postgres database that uses TLS. I don't want to verify the CA, but I want to ensure that Immich connects to the Postgres cluster with SSL.

The DB_URL I pass is postgresql://immich:password@postgres-main-primary.default.svc:5432/immich?sslmode=prefer. According to the Postgres documentation, prefer means that SSL will be used if available, but the CA will not be verified. Yet, Immich fails to start with the following error:

[Nest] 1  - 07/06/2023, 11:42:05 PM   ERROR [ExceptionHandler] self signed certificate in certificate chain
Error: self signed certificate in certificate chain
    at TLSSocket.onConnectSecure (node:_tls_wrap:1532:34)
    at TLSSocket.emit (node:events:527:28)
    at TLSSocket._finishInit (node:_tls_wrap:946:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:727:12)

The expected behaviour would be to use SSL but ignore the fact that the certificate is not trusted.

The OS that Immich Server is running on

Kubernetes, Ubuntu 22

Version of Immich Server

v1.53.0 v1.66.1

Version of Immich Mobile App

n/a

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

Using https://github.com/immich-app/immich-charts/ v0.1.2

Your .env content

See `DB_URL` above

Reproduction steps

1. Set up Postgres cluster with TLS with self-signed certificate
2. Try to connect Immich to it

Additional information

No response

@NiklasRosenstein NiklasRosenstein added bug Something isn't working needs triage Bug that needs triage from maintainer labels Jul 6, 2023
@NiklasRosenstein
Copy link
Author

I realized there's a comment about "not requiring a CA certificate" in #902, but I can't figure out how I would go about configuring this.

This should be enough to allow SSL connections without requiring a CA certificate:

  ssl: {
    require: true,
    rejectUnauthorized: false
  }

@someonewating
Copy link

Hi @NiklasRosenstein . Can you share how do you passed DB_URL to the container?

@uhthomas uhthomas removed bug Something isn't working needs triage Bug that needs triage from maintainer labels Jul 9, 2023
@immich-app immich-app locked and limited conversation to collaborators Jul 9, 2023
@uhthomas uhthomas converted this issue into discussion #3185 Jul 9, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants