Install SSL Certificate di Apache Tomcat – Linux

Untuk menginstall certificate di Apache Tomcat, ada beberapa langkah utama yang harus dilakukan.

Note : apache tomcat yang saya gunakan versi 5.5

Pertama, kita akan membuat local certificate atau keystore dan Certificate Signing Request (CSR) file.

  • Masuk ke direktori di mana anda akan membuat certificate :
    # cd /usr/share/tomcat5/
  • Buat local certificate atau keystore :
    # keytool -genkey -alias tomcat -keyalg RSA -keystore myserver.key
    jika anda diminta memasukkan password, maka silahkan masukkan, misal : pass123
  • Buat CSR :
    # keytool -certreq -keyalg RSA -alias tomcat -file certreq.csr -keystore myserver.key
    jika anda diminta memasukkan password, maka silahkan masukkan, misal : pass123

Dari langkah-langkah di atas, kita akan mendapatkan dua buah file, yaitu myserver.key dan certreq.csr

Untuk penamaan myserver.key dan certreq.csr terserah anda.

Kedua, anda harus me-register/submit file certreq.csr ke sebuah Certificate Authority ( verisign.com, geotrust.com, thawte.com, dan sebagainya) agar certreq.csr anda dapat mengidentifikasi website anda sebagai “secure” website.

Ketiga, setelah certreq.csr anda ter-registrasi (misal nama file nya certreq-ssl.csr), saatnya mengimport certificate anda ke local keystore.

  • Download Chain Certificate dari  Certificate Authority anda.
    Misal di sini Certificate Authority saya adalah  geotrust.com, maka saya bisa mendownloadnya di sini :
    # wget http://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_eBusiness_CA-1.cer
  • Import Chain Certificate tersebut ke keystore :
    # keytool -import -alias root -keystore myserver.key -trustcacerts -file Equifax_Secure_Global_eBusiness_CA-1.cer
    Enter keystore password: pass123
    Certificate already exists in system-wide CA keystore under alias <equifaxsecureglobalebusinessca1>
    Do you still want to add it to your own keystore? [no]:
    yes
    Certificate was added to keystore
  • Import Certificate baru anda :
    # keytool -import -alias tomcat -keystore myserver.key -trustcacerts -file certreq-ssl.csr
    Enter keystore password: pass123
    Certificate reply was installed in keystore

Keempat, edit file server.xml di direktori installasi apache tomcat.

  • Edit file server.xml :
    # vi /etc/tomcat5/server.xml
  • Anda akan melihat isi file tersebut seperti di bawah ini, port yang digunakan adalah port 8443 :
    <-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
    <!--
    <Connector
    port="8443" minProcessors="5" maxProcessors="75"
    enableLookups="true" disableUploadTimeout="true"
    acceptCount="100" debug="0" scheme="https" secure="true";
    clientAuth="false" sslProtocol="TLS"/>
    -->
  • Tentukan letak keystoreFile dan keystorePass yang telah anda tentukan seperti langkah di atas. Karena menggunakan vi, tekan tombol i dahulu untuk mengeditnya :
    keystoreType="PKCS12"
    keystoreFile="/usr/share/tomcat5/myserver.key"
    keystorePass="pass123"
  • Save file server.xml dan exit :
    :wq!

Kelima, langkah terakhir, reboot service apache tomcat dan coba test halaman website anda melaui browser.

  • Reboot service apache tomcat :
    # /etc/init.d/tomcat5 restart
  • Jalankan browser dan buka website anda, misal :
    https://mywebsite.com:8443

Sumber

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.