Cara Install Free SSL Dari Let’s Encrypt Dengan Apache2/Nginx Di Ubuntu 20.04 – SSL adalah protokol yang digunakan untuk mengenkripsi data antara server dan klien. Ini bertujuan untuk memastikan bahwa informasi apa pun yang dikirimkan melalui koneksi SSL tidak dapat dibagikan atau diubah oleh pihak ketiga tanpa sepengetahuan kunci rahasia. Sertifikat SSL sangat penting untuk mengamankan website, serta memastikan pengunjung dapat mempercayai website tersebut dengan informasi pribadi mereka.
Apa itu SSL?
SSL (Secure Sockets Layer) adalah protokol internet yang sangat umum digunakan yang dirancang untuk mengenkripsi lalu lintas jaringan dan karenanya memungkinkan komunikasi yang aman melalui jaringan. Setiap kali SSL diaktifkan di website, ada sertifikat SSL khusus yang terkait dengannya. Sertifikat ini berisi informasi seperti nama domain, webserver, nama otoritas penerbit sertifikat, tanggal kedaluwarsa sertifikat, dll.
Apa itu Let’s Encrypt?
Let’s Encrypt adalah Otoritas Sertifikasi (Certificate Authority biasa disingkat CA) yang gratis, terotomatisasi, dan terbuka. toritas sertifikat nirlaba yang dijalankan oleh Internet Security Research Group yang menyediakan sertifikat X.509 untuk enkripsi Transport Layer Security tanpa biaya. Yang diluncurkan pada 12 April 2016. Sertifikat Let’s Encrypt berlaku selama 90 hari, di mana pembaruan dapat dilakukan kapan saja.
Untuk mengaktifkan HTTPS di website, kita perlu mendapatkan sertifikat (sejenis file) dari Otoritas Sertifikat (CA). Let’s Encrypt adalah CA. Untuk mendapatkan sertifikat domain website kita dari Let’s Encrypt, kita harus menunjukkan kontrol atas domain tersebut. Dengan Let’s Encrypt, kita melakukan ini menggunakan perangkat lunak yang menggunakan protokol ACME (Automatic Certificate Management Environment) yang biasanya berjalan di webhosting kita.
Apa saja yang dibutuhkan untuk Install Free SSL Dari Let’s Encrypt
Apa saja yang dibutuhkan untuk Install Free SSL Dari Let’s Encrypt:
- Compute Engine/VPS/Virtual machine/Dedicated Server
- DNS Management. Baca disini untuk DNS Management AWS
- Konfigurasi Apache2 Virtual Host
- SSH dan user dengan sudo privilege
Test ini diuji menggunakan AWS (Amazon Web Services), juga akan berfungsi dengan baik di layanan cloud lain dan di VPS atau server khusus yang menjalankan Ubuntu.
Pastikan A Record sudah diarahkan ke alamat IPv4 publik instans virtual machine dan CNAME yang dibuat untuk nama domain.
Cara Install Free SSL Let’s Encrypt untuk Apache2/NginX
Step 1: Update Package index
Sebelum memulai instalasi, seperti biasa kita membutuhkan akses ke server via SSH. Setelah login ke server via SSH, pastikan dan biasakan untuk melakukan update package index. Agar semua package yang terinstall diperbarui ke versi yang baru.
sudo apt update -y && sudo apt upgrade -y
Step 2: Install snapd
Jalankan untuk memastikan bahwa kita memiliki versi terbaru snapd:
sudo snap install core; sudo snap refresh core
core 16-2.52.1 from Canonical✓ installed snap "core" has no updates available
Step 3: Install Certbot
sudo snap install --classic certbot
certbot 1.20.0 from Certbot Project (certbot-eff✓) installed
Install Free SSL Let’s Encrypt Untuk Apache2:
sudo certbot --apache
Install Free SSL Let’s Encrypt untuk NginX:
sudo certbot --nginx
Step 4: Mendaftarkan Email & Sertifikasi Domain
Kemudian isi email address untuk renewal dan pemberitahuan keamanan:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kemudian ketik Y atau Yes telah membaca ToS:
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Langkah berikutnya apakah kita ingin share email kita EFF:
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Account registered.
Langkah berikutnya menambahkan domain untuk sertifikasi, contoh: DOMAIN_NAME.COM WWW.DOMAIN_NAME.COM (bisa menggunakan tanda baca koma “,” atau space ” “).
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): bjxbro.online www.bjxbro.online
Sertifikat Apache2 webserver:
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/judis.my.id/fullchain.pem
Key is saved at: /etc/letsencrypt/live/judis.my.id/privkey.pem
This certificate expires on 2022-02-01.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for judis.my.id to /etc/apache2/sites-available/000-default-le-ssl.conf
We were unable to find a vhost with a ServerName or Address of www.judis.my.id.
Which virtual host would you like to choose?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: 000-default.conf | | | Enabled
2: 000-default-le-ssl.conf | judis.my.id | HTTPS | Enabled
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Pada instalasi certbot apache2, yaitu virtual host mana yang akan kita gunakan. Bisa memilih antara 1 atau 2 (HTTPS).
Successfully deployed certificate for www.judis.my.id to /etc/apache2/sites-available/000-default-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://judis.my.id and https://www.judis.my.id
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sertifikat Nginx webserver:
Requesting a certificate for bjxbro.online and www.bjxbro.online
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/bjxbro.online/fullchain.pem
Key is saved at: /etc/letsencrypt/live/bjxbro.online/privkey.pem
This certificate expires on 2022-02-01.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for bjxbro.online to /etc/nginx/sites-enabled/default
Successfully deployed certificate for www.bjxbro.online to /etc/nginx/sites-enabled/default
Congratulations! You have successfully enabled HTTPS on https://bjxbro.online and https://www.bjxbro.online
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Step 4: Auto Renewal
Sertifikat yang diberikan oleh Let’s Encrypt hanya berlaku selama 90 hari, jadi kita harus sering memperbaruinya. Sekarang kita menyiapkan cronjob untuk memeriksa sertifikat yang akan kedaluwarsa dalam 30 hari ke depan dan memperbaruinya secara otomatis.
Gunakan perintah berikut untuk memperbarui SSL secara otomatis:
sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/bjxbro.online.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account registered.
Simulating renewal of an existing certificate for bjxbro.online and www.bjxbro.online
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
/etc/letsencrypt/live/bjxbro.online/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Pengujian HTTPS
Dalam pengujian ini saya menggunakan 2 domain yang masing-masing diinstall Apache2 dan NginX.
Domain | Webserver |
---|---|
judis.my.id | Apache2 |
bjxbro.online | Nginx |
Atau bisa menggunakan perintah:
openssl s_client –showcerts –connect WebServerURL:PortNumber
Kesimpulan
Dengan mengikuti tutorial/cara/metode diatas, kita dapat mempelajari cara Install Free SSL Dari Let’s Encrypt Dengan Apache2/Nginx Di Ubuntu 20.04.
Semoga bermanfaat.