create self-signed ssl certificate, membuat sendiri sertifikat ssl dengan openssl

0
1393

halo semua kali ini saya akan memberika tutorial create self-signed ssl certificate with atau yang dalam bahasa indonesianya membuat sendiri sertifikat ssl dengan openssl, yang mana sertifikat ini bergunakan untuk mode authentikasi baik itu https ataupun authentikasi email baik STARTTLS ataupun SSL/TLS, sebenernya ada cara lainnya yaitu dengan membuatkan di CACert.org namun untuk tutorial via website CACert.org akan kita bahas ditutorial berikutnya 😀

install module dan plugin sslnya dahulu

yum install mod_ssl openssl openssl-devel

jika sudah selanjutnya kita buat direktori baru di /root untuk menyimpam file sertifikat ssl nya

mkdir /root/akbar
cd /root/akbar

jika sudah sekarang saatnya membuat file sertifkat sslnya 😀

pertama membuat Private Key

[root@relay akbar]# openssl genrsa -des3 -out sekolahlinux.key 1024
Generating RSA private key, 1024 bit long modulus
..........................++++++
..........++++++
e is 65537 (0x10001)
Enter pass phrase for sekolahlinux.key:
Verifying - Enter pass phrase for sekolahlinux.key:
[root@relay akbar]#

langkah berikutnya Generate file CSR (Certificate Signing Request)

[root@relay akbar]# openssl req -new -key sekolahlinux.key -out sekolahlinux.csr
Enter pass phrase for sekolahlinux.key:
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) [XX]:ID
State or Province Name (full name) []:Jawabarat
Locality Name (eg, city) [Default City]:Bekasi
Organization Name (eg, company) [Default Company Ltd]:sekolahlinux
Organizational Unit Name (eg, section) []:ITDept
Common Name (eg, your name or your server's hostname) []:relay.sekolahlinux.com
Email Address []:akbar@sekolahlinux.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@relay akbar]#

berikutnya menghapus Passphrase dari file Private Key

[root@relay akbar]# cp sekolahlinux.key sekolahlinux.key.com
[root@relay akbar]# openssl rsa -in sekolahlinux.key.com -out sekolahlinux.key
Enter pass phrase for sekolahlinux.key.com:
writing RSA key
[root@relay akbar]#

tahap terakhir yaitu generate file crt atau yang bahasa inggrisnya ( create self-signed ssl certificate )

[root@relay akbar]# openssl x509 -req -days 365 -in sekolahlinux.csr -signkey sekolahlinux.key -out sekolahlinux.crt
Signature ok
subject=/C=ID/ST=Jawabarat/L=Bekasi/O=sekolahlinux/OU=ITDept/CN=relay.sekolahlinux.com/emailAddress=akbar@sekolahlinux.com
Getting Private key

jika sudah coba lihat ada file apa saja, dan yang nantinya akan kita gunakan adalah file sekolahlinux.key dan sekolahlinux.crt

[root@relay akbar]# ls
sekolahlinux.crt  sekolahlinux.csr  sekolahlinux.key  sekolahlinux.key.com
[root@relay akbar]#

untuk peletakannya bisa di konfig file postfix ataupun konfig apache untuk https.

ouu iya untuk tutorial ini sudah saya terapkan pada server smtp relay saya dan berhasil

penerapannya akan kita lanjutkan di tutorial berikutnya ya 😀

 

sumber: http://www.akadia.com/services/ssh_test_certificate.html