Verify whether --require_secure_transport=ON for MySQL is working using Spring Boot

跟風遠走 提交于 2021-01-29 19:36:48

问题


I have to enable SSL for Spring Boot + MySQL App

I have enabled SSL for MySQL and set --require_secure_transport=ON in my.cnf.


When I try to log in to MySQL using

mysql -unon_ssl_user -p -h XXX.XXX.100.158

I get

ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.

which is correct as secure transport is forced.


I am able to login to mysql using

mysql -ussl_user -p -h XXX.XXX.100.158 --ssl-ca=ca.pem --ssl-cert=client-cert.pem --ssl-key=client-key.pem

this also correct.


When I am using non_ssl_user or ssl_user without certificates using spring boot, I am able to connect to database.

My application.properties file contains:

-----
spring.datasource.url=jdbc:mysql://XXX.XXX.100.158:3306/ssl_db
spring.datasource.username=ssl_user
spring.datasource.password=*********
-----

I think mysql should not allow user/springboot app to connect to database without certificates.


Is this the intended behaviour?

Am I missing something here?

Thank you!

来源:https://stackoverflow.com/questions/60333247/verify-whether-require-secure-transport-on-for-mysql-is-working-using-spring-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!