Hello,
I am using Hibernate Search 6 beta 8 with my Spring Boot application. I’ve included both dependencies of Hibernate ORM mapper and hibernate-search-elasticsearch into pom.xml
org.hibernate.search hibernate-search-mapper-orm 6.0.0.Beta8 org.hibernate.search hibernate-search-backend-elasticsearch 6.0.0.Beta8My issue is when using https protocol and I set the hosts property of the elasticsearch backend to something like “test.elk.local:9200”
I generated the certificate/key using Elastic’s certutil tool for common name ".elk.local", and added a bunch of SAN entries to it:
DNS Name=elk
DNS Name=.elk.local
DNS Name=elk.local
DNS Name=test.elk.local
DNS Name=test2.elk.local
IP Address=127.0.0.1
and then imported the certificate in the java keystore. It works if I use localhost/elk, but starts complaining if I use any of the names with a dot:
Host name ‘test.elk.local’ does not match the certificate subject provided by the peer (CN=*.elk.local, OU=IT, DC=elk, DC=local)
I figured it is something with the Apache Http library being used when hibernate search builds the elastic client. Specifically, the DefaultHostnameVerifier class where it tries to match the domain with a public list of domain from ICANN:
if (publicSuffixMatcher != null && host.contains(".")) {
if (!matchDomainRoot(host, publicSuffixMatcher.getDomainRoot(identity, domainType))) {
return false;
}
}
I am trying to override this behavior by defining a bean in Spring. Is there a better/easier way to do this? Am I missing something in the documentation?