Включить ssl на производство tomcat + spring - PullRequest
0 голосов
/ 29 сентября 2019

У меня есть производственный хостинг, на котором я установил tomcat.Я развернул там свое весеннее загрузочное приложение.Моя проблема в том, что я не могу правильно настроить ssl.Я прочитал много уроков, но каждый раз возникает какая-то проблема.

Это мои конфигурации, если вам нужна дополнительная информация, просто спросите.

В моем весеннем приложении в src /main / resources / keystore У меня есть cert.key, cert.pem (эти 2 были сгенерированы с помощью let encrypt на хост-сервере), а keystore.p12 преобразован с помощью openssl.

У меня также есть keystore.p12 в папке confна tomcat.

application.properties

spring.datasource.url=jdbc:mysql://censorship/m1158_spotmap?useTimezone=true&serverTimezone=UTC
server.port: 8443
security.require-ssl=true
server.ssl.key-store=classpath:keystore/keystore.p12
server.ssl.key-store-password: censorship
server.ssl.keyStoreType: PKCS12
server.ssl.keyAlias: keystore

разъемы server.xml

<!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
     <!--<Connector port="38501" protocol="HTTP/1.1" 
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->

    <!-- <Connector executor="tomcatThreadPool"  
               port="38501" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" /> -->
    <Connector port="38501" redirectPort="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="conf/keystore.p12" keystorePass="censorship" keystoreType="PKCS12" />

    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Это ошибка консоли, которую я получаю при попытке получить доступ к API.

net::ERR_SSL_PROTOCOL_ERROR
...