diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/provider/pebble/PebbleHttpConnector.java b/acme4j-client/src/main/java/org/shredzone/acme4j/provider/pebble/PebbleHttpConnector.java index f9126dad..6a0ef451 100644 --- a/acme4j-client/src/main/java/org/shredzone/acme4j/provider/pebble/PebbleHttpConnector.java +++ b/acme4j-client/src/main/java/org/shredzone/acme4j/provider/pebble/PebbleHttpConnector.java @@ -26,8 +26,10 @@ import java.security.cert.CertificateException; import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.concurrent.ThreadSafe; +import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManagerFactory; @@ -41,13 +43,22 @@ import org.shredzone.acme4j.connector.HttpConnector; @ThreadSafe public class PebbleHttpConnector extends HttpConnector { + private static HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + private static SSLSocketFactory sslSocketFactory; @Override public HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException { HttpURLConnection conn = super.openConnection(url, proxy); if (conn instanceof HttpsURLConnection) { - ((HttpsURLConnection) conn).setSSLSocketFactory(createSocketFactory()); + HttpsURLConnection conns = (HttpsURLConnection) conn; + conns.setSSLSocketFactory(createSocketFactory()); + conns.setHostnameVerifier(ALLOW_ALL_HOSTNAME_VERIFIER); } return conn; }