使用Spring Boot通过SSL / TLS连接Maria DB

时间:2019-11-14 14:17:04

标签: spring-boot ssl mariadb keystore tls1.2

my.cnf数据

# MySQL Server
[mysqld]
ssl-ca=/etc/mysql/ssl/ca-cert.pem  
ssl-cert=/etc/mysql/ssl/server-cert.pem  
ssl-key=/etc/mysql/ssl/server-key.pem  

# MySQL Client
[client]
ssl-ca=/etc/mysql/ssl/ca-cert.pem  
ssl-cert=/etc/mysql/ssl/client-cert.pem  
ssl-key=/etc/mysql/ssl/client-key.pem  

如何使用客户端文件通过SSL连接到maria db?

我在application.properties中的值

spring.datasource.url=jdbc:mysql://172.29.222.215:3306/test_schema?verifyServerCertificate=true&useSSL=true&requireSSL=true

Pom.xml中的依赖性

<dependency>
            <groupId>org.mariadb.jdbc</groupId>    
            <artifactId>mariadb-java-client</artifactId>     
            <version>2.3.0</version>
</dependency>

需要什么文件(.jks)以及如何在application.properties中进行配置?

0 个答案:

没有答案