Skip to content

Problems accessing databases over TLS with outdated cert signing algorithm #289

Open
@Anonymous-Coward

Description

@Anonymous-Coward

I have a database accessible over TLS with a certificate signed with SHA1 and with key algorithm RSA - I have no control over the certificate used by the database. Any attempt to migrate that database using Java 17 (openjdk) and mybatis will fail with the following error:

ERROR: Error getting connection. Cause: org.postgresql.util.PSQLException: SSL error: Certificates do not conform to algorithm constraints.

The reason for this is that SHA1 with RSA was found to be insecure some time in the past and more recent JDKs/JREs have disabled it.

When you configure other clients for accessing the database, you can change ${JAVA_HOME}/conf/security/java.security to allow that algorithm combination - remove offending entries from jdk.certpath.disabledAlgorithms - and set the SSL factory used by the driver to org.postgresql.ssl.DefaultJavaSSLFactory.

There's no way to influence the behavior of the postgres driver when being used from mybatis migrations - or at least not a documented one that I could find.

Same goes for the mybatis migrations plugin. Even if the java global security settings file is changed, the driver will still complain about outdated algorithms by throwing the exception.

Mybatis migrations version: MyBatis Migrations 3.3.11
Mybatis migrations maven plugin: 1.1.4
Postgres jdbc driver: 4.2.25 (both with the maven plugin and the CLI)

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