Batman Begins - Help Select

Kamis, 20 Agustus 2015

Konfigurasi Securing Web Server (HTTPS)


       HTTP adalah protokol yang digunakan oleh web server. Semua data yang dikirim menggunakan protokol tersebut tidak terenkripsi (PLAIN Text biasa). Oleh karena itu, perlu kita tambahkan protokol tambahan yang bernama SSL atau TLS. Protokol tersebut berfungsi menambal protokol HTTP, agar menjadi secure (HTTPS).
 OpenSSL merupakan kepangjangan dari Secure Socket Layer. Terlebih dahulu, pastikan bahwa aplikasi apache2 untuk web server sudah terinstall, jika belum ada, maka install dahulu.
Lalu anda harus mengistall paket “ssl-cert” dan “openssl” biasanya paket tersebut sudah ikut terinstall bersamaan dengan paket apache2 , setelah terinstall anda harus melakukan hal berikut

1. Membuat Sertifikat SSL

  • Masuk ke debian sebagai super user
$ su
  •  Masuk ke directory /etc/ssl/private
# cd /etc/ssl/private
  • Kemudian masukan perintah
# openssl genrsa -des3 -out server.key 2048
  • Maka akan muncul tulisan berikut
 Generating RSA private key, 2048 bit long modulus
...................+++
.....+++
e is 65537 (0x10001)
Enter pass phrase for server.key:                          # set password

Verifying - Enter pass phrase for server.key:          # konfirmasi password
  •  Hapus password dari kunci pribadi
# openssl req -new -days 3650 -key server.key -out server.csr
 Enter pass phrase for server.key:                     # masukan password
writing RSA key
  • Lalu masukan perintah
# openssl req -new -days 3650 -key server.key -out server.csr
  You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: ID                   # Negara

State or Province Name (full name) [Some-State]: Central Java   # Provinsi
Locality Name (eg, city) []: Kendal         # Kota
Organization Name (eg, company) [Internet Widgits Pty Ltd]: BLC     # company
Organizational Unit Name (eg, section) []:          # department
Common Name (e.g. server FQDN or YOUR name) []:        # server's FQDN

Email Address []: admin@smk7kendal.sch.id        # email address

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:

An optional company name []:
  •  Setelah itu masukan perintah
# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
Signature ok
subject=/C=ID/ST=Central Java/L=Kendal/O=BLC/OU=/emailAddress=admin@smk7kendal.sch.id
Getting Private key
  • Lalu beri hak akses
 # chmod 400 server.* 

2. Konfigurasi Apache2 untuk SSL

  • Edit file /etc/apache2/sites-available/default-ssl.conf dengan perintah
# nano /etc/apache2/sites-available/default-ssl.conf
- Pada baris ke 3 dapat anda ganti
ServerAdmin taufik@smk7kendal.sch.id

- Pada baris ke 32 dan 33 ganti dari

SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

menjadi

SSLCertificateFile /etc/ssl/private/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

  • Kemudian aktifkan site default-ssl dengan perintah
# a2ensite default-ssl
Enabling site default-ssl.
To activate the new configuration, you need to run:
  service apache2 reload

  •  Dan masukan perintah 
# a2enmod ssl
  •  Setelah itu restart apache2
# /etc/init.d/apache2 restart

 3. Testing

  • Setelah selesai mengkonfigurasi sekarang silakan anda coba.
  • Masuk firefox
  • Coba masuk ke server dengan https
  • Maka akan ada security
  •  Setelah di konfirmasi barulah anda dapat masuk

0 komentar:

Posting Komentar