{"id":835,"date":"2015-12-10T17:06:17","date_gmt":"2015-12-10T10:06:17","guid":{"rendered":"http:\/\/whplus.com\/blog\/?p=835"},"modified":"2015-12-10T17:06:17","modified_gmt":"2015-12-10T10:06:17","slug":"cara-install-ssl-letsencrypt","status":"publish","type":"post","link":"https:\/\/www.whplus.com\/blog\/2015\/12\/10\/cara-install-ssl-letsencrypt.html","title":{"rendered":"Cara Install SSL LetsEncrypt"},"content":{"rendered":"<p>Berikut tutorial cara install SSL LetsEncrypt<\/p>\n<p><strong>1. Install LetsEncrypt Client<\/strong><br \/>\n<code>rpm -ivh https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-6.noarch.rpm<br \/>\nrpm -ivh https:\/\/rhel6.iuscommunity.org\/ius-release.rpm<br \/>\nyum -y install git python27 python27-devel python27-pip python27-setuptools python27-virtualenv --enablerepo=ius<br \/>\ncd \/root<br \/>\ngit clone https:\/\/github.com\/letsencrypt\/letsencrypt<br \/>\ncd \/root\/letsencrypt<br \/>\nsed -i \"s|--python python2|--python python2.7|\" letsencrypt-auto<br \/>\n.\/letsencrypt-auto --verbose<br \/>\n<\/code><\/p>\n<p><strong>2. Generate SSL<\/strong><br \/>\n<code>cd \/root\/letsencrypt<br \/>\n.\/letsencrypt-auto --text --agree-tos --email email@domain.com certonly --renew-by-default --webroot --webroot-path \/home\/user\/public_html\/ -d domain.com -d www.domain.com<br \/>\n<\/code><br \/>\nganti user dengan user cpanel<br \/>\n<!--more--><\/p>\n<p>Selanjutnya bisa gunakan perintah berikut:<br \/>\n<code>cd \/root\/.local\/share\/letsencrypt\/bin\/<br \/>\n.\/letsencrypt --text certonly --renew-by-default --webroot --webroot-path \/home\/user\/public_html\/ -d domain.com -d www.domain.com<br \/>\n<\/code><\/p>\n<p>3. Buat script utk install ssl<br \/>\n<code>#!\/usr\/local\/cpanel\/3rdparty\/bin\/perl<\/p>\n<p>use strict;<br \/>\nuse LWP::UserAgent;<br \/>\nuse LWP::Protocol::https;<br \/>\nuse MIME::Base64;<br \/>\nuse IO::Socket::SSL;<br \/>\nuse URI::Escape;<\/p>\n<p>my $user = \"root\";<br \/>\nmy $pass = \"rootpass\";<\/p>\n<p>my $auth = \"Basic \" . MIME::Base64::encode( $user . \":\" . $pass );<\/p>\n<p>my $ua = LWP::UserAgent->new(<br \/>\n    ssl_opts   => { verify_hostname => 0, SSL_verify_mode => 'SSL_VERIFY_NONE', SSL_use_cert => 0 },<br \/>\n);<\/p>\n<p>my $dom = $ARGV[0];<\/p>\n<p>my $certfile = \"\/etc\/letsencrypt\/live\/$dom\/cert.pem\";<br \/>\nmy $keyfile = \"\/etc\/letsencrypt\/live\/$dom\/privkey.pem\";<br \/>\nmy $cafile =  \"\/etc\/letsencrypt\/live\/bundle.txt\";<\/p>\n<p>my $certdata;<br \/>\nmy $keydata;<br \/>\nmy $cadata;<\/p>\n<p>open(my $certfh, '< ', $certfile) or die \"cannot open file $certfile\";\n    {\n        local $\/;\n        $certdata = <$certfh>;<br \/>\n    }<br \/>\n    close($certfh);<\/p>\n<p>open(my $keyfh, '< ', $keyfile) or die \"cannot open file $keyfile\";\n    {\n        local $\/;\n        $keydata = <$keyfh>;<br \/>\n    }<br \/>\n    close($keyfh);<\/p>\n<p>open(my $cafh, '< ', $cafile) or die \"cannot open file $cafile\";\n    {\n        local $\/;\n        $cadata = <$cafh>;<br \/>\n    }<br \/>\n    close($cafh);<\/p>\n<p>my $cert = uri_escape($certdata);<br \/>\nmy $key = uri_escape($keydata);<br \/>\nmy $ca = uri_escape($cadata);<\/p>\n<p>my $request = HTTP::Request->new( POST => \"https:\/\/127.0.0.1:2087\/json-api\/installssl?api.version=1&domain=$dom&crt=$cert&key=$key&cab=$ca\" );<br \/>\n$request->header( Authorization => $auth );<br \/>\nmy $response = $ua->request($request);<br \/>\nprint $response->content;<br \/>\n<\/code><br \/>\nsimpan dengan nama file installssl.pl<br \/>\ncara penggunaannya:<\/p>\n<p><code>chmod +x installssl.pl<br \/>\n.\/installssl.pl domain.com<br \/>\n<\/code><\/p>\n<p>Buat CA Bundle<br \/>\n<code>nano \/etc\/letsencrypt\/live\/bundle.txt<\/code><\/p>\n<p>Isi CA Bundle<br \/>\n<code>-----BEGIN CERTIFICATE-----<br \/>\nMIIEqDCCA5CgAwIBAgIRAJgT9HUT5XULQ+dDHpceRL0wDQYJKoZIhvcNAQELBQAw<br \/>\nPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD<br \/>\nEw5EU1QgUm9vdCBDQSBYMzAeFw0xNTEwMTkyMjMzMzZaFw0yMDEwMTkyMjMzMzZa<br \/>\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD<br \/>\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMTCCASIwDQYJKoZIhvcNAQEBBQAD<br \/>\nggEPADCCAQoCggEBAJzTDPBa5S5Ht3JdN4OzaGMw6tc1Jhkl4b2+NfFwki+3uEtB<br \/>\nBaupnjUIWOyxKsRohwuj43Xk5vOnYnG6eYFgH9eRmp\/z0HhncchpDpWRz\/7mmelg<br \/>\nPEjMfspNdxIknUcbWuu57B43ABycrHunBerOSuu9QeU2mLnL\/W08lmjfIypCkAyG<br \/>\ndGfIf6WauFJhFBM\/ZemCh8vb+g5W9oaJ84U\/l4avsNwa72sNlRZ9xCugZbKZBDZ1<br \/>\ngGusSvMbkEl4L6KWTyogJSkExnTA0DHNjzE4lRa6qDO4Q\/GxH8Mwf6J5MRM9LTb4<br \/>\n4\/zyM2q5OTHFr8SNDR1kFjOq+oQpttQLwNh9w5MCAwEAAaOCAZIwggGOMBIGA1Ud<br \/>\nEwEB\/wQIMAYBAf8CAQAwDgYDVR0PAQH\/BAQDAgGGMH8GCCsGAQUFBwEBBHMwcTAy<br \/>\nBggrBgEFBQcwAYYmaHR0cDovL2lzcmcudHJ1c3RpZC5vY3NwLmlkZW50cnVzdC5j<br \/>\nb20wOwYIKwYBBQUHMAKGL2h0dHA6Ly9hcHBzLmlkZW50cnVzdC5jb20vcm9vdHMv<br \/>\nZHN0cm9vdGNheDMucDdjMB8GA1UdIwQYMBaAFMSnsaR7LHH62+FLkHX\/xBVghYkQ<br \/>\nMFQGA1UdIARNMEswCAYGZ4EMAQIBMD8GCysGAQQBgt8TAQEBMDAwLgYIKwYBBQUH<br \/>\nAgEWImh0dHA6Ly9jcHMucm9vdC14MS5sZXRzZW5jcnlwdC5vcmcwPAYDVR0fBDUw<br \/>\nMzAxoC+gLYYraHR0cDovL2NybC5pZGVudHJ1c3QuY29tL0RTVFJPT1RDQVgzQ1JM<br \/>\nLmNybDATBgNVHR4EDDAKoQgwBoIELm1pbDAdBgNVHQ4EFgQUqEpqYwR93brm0Tm3<br \/>\npkVl7\/Oo7KEwDQYJKoZIhvcNAQELBQADggEBANHIIkus7+MJiZZQsY14cCoBG1hd<br \/>\nv0J20\/FyWo5ppnfjL78S2k4s2GLRJ7iD9ZDKErndvbNFGcsW+9kKK\/TnY21hp4Dd<br \/>\nITv8S9ZYQ7oaoqs7HwhEMY9sibED4aXw09xrJZTC9zK1uIfW6t5dHQjuOWv+HHoW<br \/>\nZnupyxpsEUlEaFb+\/SCI4KCSBdAsYxAcsHYI5xxEI4LutHp6s3OT2FuO90WfdsIk<br \/>\n6q78OMSdn875bNjdBYAqxUp2\/LEIHfDBkLoQz0hFJmwAbYahqKaLn73PAAm1X2kj<br \/>\nf1w8DdnkabOLGeOVcj9LQ+s67vBykx4anTjURkbqZslUEUsn2k5xeua2zUk=<br \/>\n-----END CERTIFICATE-----<br \/>\n<\/code><\/p>\n<p>Source: https:\/\/forums.cpanel.net\/threads\/how-to-installing-ssl-from-lets-encrypt.513621\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Berikut tutorial cara install SSL LetsEncrypt 1. Install LetsEncrypt Client rpm -ivh https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-6.noarch.rpm rpm -ivh https:\/\/rhel6.iuscommunity.org\/ius-release.rpm yum -y install git python27 python27-devel python27-pip python27-setuptools python27-virtualenv &#8211;enablerepo=ius cd \/root git clone https:\/\/github.com\/letsencrypt\/letsencrypt cd \/root\/letsencrypt sed -i &#8220;s|&#8211;python python2|&#8211;python python2.7|&#8221; letsencrypt-auto .\/letsencrypt-auto &#8211;verbose 2. Generate SSL cd \/root\/letsencrypt .\/letsencrypt-auto &#8211;text &#8211;agree-tos &#8211;email email@domain.com certonly &#8211;renew-by-default &#8211;webroot &#8211;webroot-path\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.whplus.com\/blog\/2015\/12\/10\/cara-install-ssl-letsencrypt.html\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-835","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":1,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"predecessor-version":[{"id":836,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions\/836"}],"wp:attachment":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}