3 Haziran 2020 Çarşamba

Tomcat server.xml İle HTTPS (Sertifika) Kullanma

Giriş
Normalde server.xml içinde şöyle bir satır var. Bu satırı açıp biraz değiştirmek gerekiyor.
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS" />
-->
Bu satırı açıp kabaca şu hale getiriyoruz
<Connector SSLEnabled="true" acceptCount="100" clientAuth="false"

    disableUploadTimeout="true" enableLookups="false" maxThreads="25"

    port="8443" keystoreFile="/Users/loiane/.keystore" keystorePass="password"

    protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"

    secure="true" sslProtocol="TLS" />

1. scheme https olmalı
Açıklaması şöyle.
Set this attribute to the name of the protocol you wish to have returned by calls. The default value is "HTTP."
2. secure true olmalı
Bu alan zaten true geliyor.

3. SSLEnabled true olmalı
Bu alan zaten true geliyor.

4. keystoreFile ile sertifika dosyamız belirtilmeli
Sertifika dosyalarımızı bir dosyaya ithal etmek için şöyle yaparız.
keytool -import -alias root -keystore gvia.keystore -trustcacerts -file gdroot-g2.crt
keytool -import -alias intermed -keystore gvia.keystore -trustcacerts -file gdig2.crt
keytool -import -alias tomcat -keystore gvia.keystore -trustcacerts -file gvia.cert
5. keystorePass ile sertifika dosyasının şifresi belirtilmeli
Bu alanı ayarlamak gerekir.

6. clientAuth false ile istemcinin sertifika sunması beklenmemeli
Bu alan zaten false geliyor.

7. sslProtocol TLS olmalı
Bu alan zaten TLS olarak geliyor.

Örnek
Şöyle yaparız.
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
  maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
  clientAuth="false" sslProtocol="TLS" />
Örnek
Şöyle yaparız.
<Connector 
  port="8443" maxThreads="200"
  scheme="https" secure="true" SSLEnabled="true"
  keystoreFile="/home/gv14pr0d/ssl_helper/2019/gvia.keystore" keystorePass="*****"
  clientAuth="false" sslProtocol="TLS" />
Örnek
Şöyle yaparız.
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
  maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
  clientAuth="true" sslProtocol="TLS"
  keystoreFile="/etc/pki/mykeystore.jks"
  keystoreType="JKS" keystorePass="password"
  truststoreFile="/etc/pki/server_truststore.jks"
  truststoreType="JKS"   truststorePass="password"/>

Hiç yorum yok:

Yorum Gönder