notify_push icon indicating copy to clipboard operation
notify_push copied to clipboard

Failed to connect to Nextcloud database: received corrupt message

Open csware opened this issue 4 years ago • 1 comments

x86_64$ LOG=DEBUG ./notify_push -- config.php
[2021-05-24 15:26:03.946631 +02:00] DEBUG [rustls::client::hs] /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rustls-0.19.0/src/client/hs.rs:89: No cached session for DNSNameRef("localhost")
[2021-05-24 15:26:03.946674 +02:00] DEBUG [rustls::client::hs] /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rustls-0.19.0/src/client/hs.rs:211: Not resuming any session
Error:
   0: Failed to connect to Nextcloud database
   1: error communicating with the server: received corrupt message
   2: received corrupt message

Location:
   /tmp/krankerl.PNFmShx8gZmS/notify_push/src/storage_mapping.rs:57

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Dump-config looks correct:

./notify_push --dump-config config.php
Config {
    database: AnyConnectOptions(
        MySql(
            MySqlConnectOptions {
                host: "localhost",
                port: 3306,
                socket: Some(
                    "/var/run/mysqld/mysqld.sock",
                ),
                username: "nextcloud",
                password: Some(
                    "XXXXXXXXXX",
                ),
                database: Some(
                    "nextcloud",
                ),
                ssl_mode: Preferred,
                ssl_ca: None,
                statement_cache_capacity: 100,
                charset: "utf8mb4",
                collation: None,
                log_settings: LogSettings {
                    statements_level: Info,
                    slow_statements_level: Warn,
                    slow_statements_duration: 1s,
                },
            },
        ),
    ),
    database_prefix: "oc_",
    redis: [
        ConnectionInfo {
            addr: Unix(
                "/var/run/redis/redis.sock",
            ),
            db: 0,
            username: None,
            passwd: None,
        },
    ],
    nextcloud_url: "https://XXX.XXX.XX/",
    metrics_bind: None,
    log_level: "DEBUG",
    bind: Tcp(
        0.0.0.0:7867,
    ),
    allow_self_signed: false,
}

It seems to be as if the tools tries to establish an TLS connecion over the local unix socket what does not make any sense.

Using 127.0.0.1 as DB host also doesn't work (failing with InvalidDNSNameError what is correct, using the hostname in the server certificate doesn't work too with the very same error "received corrupt message"),

How can the ssl_mode config be controlled?

System:

  • Debian 10.9
  • DB: MariaDB 10.3
  • PHP 8.0
  • ./notify_push --version: notify_push 0.1.7

csware avatar May 24 '21 13:05 csware

Got the same error here. Using the binary from #83 https://github.com/nextcloud/notify_push/actions/runs/793350027 and the IP for the database instead of the hostname solved the issue, but it would be nice to have an extra option to turn TLS off for the database connection.

alx-tuilmenau avatar Jun 03 '21 11:06 alx-tuilmenau