Skip to content

[BUG] Postgres SSL connection complains about /root/.postgresql #7

@mmomjian

Description

@mmomjian

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am using version 0.15.5 of both the LSIO and the SpeedtestTracker docker images. When using the LSIO Docker container, I get the following error:

[2024-02-19 17:37:16] production.ERROR: SQLSTATE[08006] [7] connection to server at "postgres.domain" (100.64.x.x), port 5430 failed: could not open certificate file "/root/.postgresql/postgresql.crt": Permission denied

The directory /root/.postgresql doesn't exist in either Docker image as far as I can tell. In the original Docker image, it connects fine. I think somewhere along the line sslmode is changing from prefer to verify-ca. link

Expected Behavior

The Docker container should establish an SSL connection even without certificate files - most people use SSL for encryption not authentication in the setting of a Docker container / server.

Steps To Reproduce

  1. Establish a Postgres database mode with required SSL connection
  2. Try to connect to it using the LSIO Docker image
  3. I tried DB_SSLMODE=require and DB_SSLMODE=no-verify, the same issue persists

Environment

- OS: Debian 12
- How docker service was installed: official repos

CPU architecture

x86-64

Docker creation

speedtest-tracker:
        container_name: speedtest-tracker
        hostname: speedtest-tracker
        ports:
            - '15781:443'
        networks:
            docknet_teal:
                ipv4_address: 172.28.0.81
        environment:
            TZ: ${tz}
            PUID: '17683'
            PGID: '17683'
            DB_CONNECTION: 'pgsql'
            DB_HOST: ${pghost2}
            DB_PORT: ${pgport}
            DB_DATABASE: ${pgspeeddb}
            DB_USERNAME: ${pgspeeduser}
            DB_PASSWORD: ${pgspeedpw}
            FORCE_HTTPS: 'true'
        volumes:
            - '${dockerdata}/speedtest-tracker:/config'
            - '${ssl}/fullchain.pem:/etc/ssl/web/ssl.crt:ro'
            - '${ssl}/privkey.pem:/etc/ssl/web/ssl.key:ro'
#        image: 'ghcr.io/alexjustesen/speedtest-tracker:v0.15.5'
        image: lscr.io/linuxserver/speedtest-tracker:v0.15.5-ls4

Container logs

[2024-02-19 17:44:33] production.ERROR: SQLSTATE[08006] [7] connection to server at "postgres.host" (100.64.x.x), port 5430 failed: could not open certificate file "/root/.postgresql/postgresql.crt": Permission denied
connection to server at "postgres.host" (100.64.x.x), port 5430 failed: FATAL:  no pg_hba.conf entry for host "172.28.0.81", user "speedtesttracker", database "speedtesttracker", no encryption (Connection: pgsql, SQL: select * from information_schema.tables where table_catalog = speedtesttracker and table_schema = public and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 7): SQLSTATE[08006] [7] connection to server at \"postgres.host\" (100.6.x.x), port 5430 failed: could not open certificate file \"/root/.postgresql/postgresql.crt\": Permission denied
connection to server at \"postgres.host\" (100.64.x.x), port 5430 failed: FATAL:  no pg_hba.conf entry for host \"172.28.0.81\", user \"speedtesttracker\", database \"speedtesttracker\", no encryption (Connection: pgsql, SQL: select * from information_schema.tables where table_catalog = speedtesttracker and table_schema = public and table_name = migrations and table_type = 'BASE TABLE') at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829)
[stacktrace]
#0 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\\Database\\Connection->runQueryCallback()
#1 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->run()
#2 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(401): Illuminate\\Database\\Connection->select()
#3 /app/www/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php(51): Illuminate\\Database\\Connection->selectFromWriteConnection()
#4 /app/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(184): Illuminate\\Database\\Schema\\PostgresBuilder->hasTable()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions