{"id":9334,"date":"2022-04-07T12:38:13","date_gmt":"2022-04-07T07:08:13","guid":{"rendered":"https:\/\/www.skynats.com\/?p=9334"},"modified":"2023-06-15T17:12:34","modified_gmt":"2023-06-15T11:42:34","slug":"digitalocean-certbot","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/","title":{"rendered":"DigitalOcean Certbot Let\u2019s Encrypt"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p><strong>DigitalOcean Certbot Standalone mode<\/strong><\/p>\n\n\n\n<p>Do you know that we can secure other kinds of services with Certbot&#8217;s standalone mode, such as a message broker, a mail server, and so on? Certbot provides a variety of options for validating the domain, configuring Apache and Nginx automatically, retrieving certificates, and so on.<\/p>\n\n\n\n<p>Our Technical Experts will walk you through the following topics in this in-depth guide:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Certbot installation<\/li><li>Running Certbot<\/li><li>Setting up the application<\/li><li>Taking care of Certbot&#8217;s automatic renewals<\/li><\/ul>\n\n\n\n<p>However, before we get started, let&#8217;s go over the prerequisites:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A server with a sudo-enabled and a non-root.user.&nbsp; It should also be equipped with a basic firewall.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>A domain name that indicates to the server<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>On the server, port 80 or 443 should be open and free.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-install-certbot\">How to install Certbot?<\/h2>\n\n\n\n<p>According to our Technical Support Team, we can install Certbot using the snap package. However, before we can do that, we must first install snapd. Fortunately, snaps are supported by Ubuntu 20.4; all we have to do now is ensure the snapd core is up to date:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo snap install core; sudo snap refresh core<\/code><\/pre>\n\n\n\n<p>If the server has a previous version of certbot, we can remove it with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt remove certbot<\/code><\/pre>\n\n\n\n<p>The certbot package must then be installed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo snap install --classic certbot<\/code><\/pre>\n\n\n\n<p>The certbot command from the installation directory must then be linked to our path:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/snap\/bin\/certbot \/usr\/bin\/certbot<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-run-certbot\">How to run Certbot?<\/h2>\n\n\n\n<p>To demonstrate our control over the domain, we&#8217;ll use port 80 or 443 to respond to the Let&#8217;s Encrypt API&#8217;s cryptographic challenge.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 443\nOutput\nRule added\nRule added (v6)<\/code><\/pre>\n\n\n\n<p>We can then use Certbot to obtain the certificate. The \u2013standalone option can be used here so that the Certbot can manage the challenge using its built-in web server. We can also use the -d flag to specify the domain for which we want the certificate. We can also use multiple -d options to cover multiple domains with a single certificate.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot certonly --standalone -d the_domain<\/code><\/pre>\n\n\n\n<p>After running the above command, we must enter an email address and accept the terms of service. This is followed by a message indicating that the process was completed successfully and the location of the certificates.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-should-the-application-be-configured\">How should the application be configured?<\/h3>\n\n\n\n<p>We&#8217;re going to look at what Certbot downloaded in this step. To list the directory that contains the keys and certificates, we can use the ls command, as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ls \/etc\/letsencrypt\/live\/your_domain\nOutput:\ncert.pem  chain.pem  fullchain.pem  privkey.pem  README<\/code><\/pre>\n\n\n\n<p>Some software needs certificates in various formats, while others require certificates in their original format. In the latter case, we&#8217;ll need to write a script to move the fields around and change permissions as needed. In the latter case, we&#8217;ll need to write a script to move the fields around and change permissions as needed.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-manage-certbot-automatic-renewals\">How to manage Certbot automatic renewals?<\/h3>\n\n\n\n<p>Let&#8217;s Encrypt certificates have a 90-day expiration date. The process of renewing a certificate is easier to automate.&nbsp; This is handled by the certbot package, by adding a renew script to \/etc\/cron.d. The renew script runs two times a day, renewing certificates that are about to expire in 30 days.<\/p>\n\n\n\n<p>We can use the renew hook option to run other tasks after renewal. We&#8217;ll need to update Certbot&#8217;s renewal configuration file to add the renew_hook option.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/letsencrypt\/renewal\/the_domain.conf<\/code><\/pre>\n\n\n\n<p>Are you looking for an answer to another query?\u00a0<a href=\"https:\/\/www.skynats.com\/contact-us\/\" target=\"_blank\" rel=\"noreferrer noopener\">Contact<\/a>\u00a0our technical support team.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DigitalOcean Certbot Standalone mode Do you know that we can secure other kinds of services with Certbot&#8217;s standalone mode, such as a message broker, a mail server, and so on? Certbot provides a variety of options for validating the domain, configuring Apache and Nginx automatically, retrieving certificates, and so on. Our Technical Experts will walk [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[688],"class_list":["post-9334","post","type-post","status-publish","format-standard","hentry","category-blog","tag-certbot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>DigitalOcean Certbot Let\u2019s Encrypt | Skynats<\/title>\n<meta name=\"description\" content=\"In-depth guide: Certbot installation, Running Certbot, Setting up the application, and Taking care of Certbot&#039;s automatic renewals.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DigitalOcean Certbot Let\u2019s Encrypt\" \/>\n<meta property=\"og:description\" content=\"In-depth guide: Certbot installation, Running Certbot, Setting up the application, and Taking care of Certbot&#039;s automatic renewals.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/\" \/>\n<meta property=\"og:site_name\" content=\"Server Management Services | Cloud Management | Skynats\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/skynats\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-07T07:08:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-15T11:42:34+00:00\" \/>\n<meta name=\"author\" content=\"Kevin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@skynatstech\" \/>\n<meta name=\"twitter:site\" content=\"@skynatstech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kevin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/\"},\"author\":{\"name\":\"Kevin\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/person\\\/749ae0470320eb759ff1e07b8ea7fbe3\"},\"headline\":\"DigitalOcean Certbot Let\u2019s Encrypt\",\"datePublished\":\"2022-04-07T07:08:13+00:00\",\"dateModified\":\"2023-06-15T11:42:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/\"},\"wordCount\":541,\"publisher\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\"},\"keywords\":[\"certbot\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/\",\"name\":\"DigitalOcean Certbot Let\u2019s Encrypt | Skynats\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-04-07T07:08:13+00:00\",\"dateModified\":\"2023-06-15T11:42:34+00:00\",\"description\":\"In-depth guide: Certbot installation, Running Certbot, Setting up the application, and Taking care of Certbot's automatic renewals.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/digitalocean-certbot\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DigitalOcean Certbot Let\u2019s Encrypt\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\",\"name\":\"Server Management Services | Cloud Management | Skynats\",\"description\":\"Server Management and Cloud Management\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\",\"name\":\"Skynats Technologies\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Sknats-Logo-New-whole.png\",\"contentUrl\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Sknats-Logo-New-whole.png\",\"width\":989,\"height\":367,\"caption\":\"Skynats Technologies\"},\"image\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/skynats\",\"https:\\\/\\\/x.com\\\/skynatstech\",\"https:\\\/\\\/www.instagram.com\\\/skynatstech\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/skynats-technologies\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCvTAjrFJ4_E2MJKwlDHomlg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/person\\\/749ae0470320eb759ff1e07b8ea7fbe3\",\"name\":\"Kevin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g\",\"caption\":\"Kevin\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"DigitalOcean Certbot Let\u2019s Encrypt | Skynats","description":"In-depth guide: Certbot installation, Running Certbot, Setting up the application, and Taking care of Certbot's automatic renewals.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/","og_locale":"en_US","og_type":"article","og_title":"DigitalOcean Certbot Let\u2019s Encrypt","og_description":"In-depth guide: Certbot installation, Running Certbot, Setting up the application, and Taking care of Certbot's automatic renewals.","og_url":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/","og_site_name":"Server Management Services | Cloud Management | Skynats","article_publisher":"https:\/\/www.facebook.com\/skynats","article_published_time":"2022-04-07T07:08:13+00:00","article_modified_time":"2023-06-15T11:42:34+00:00","author":"Kevin","twitter_card":"summary_large_image","twitter_creator":"@skynatstech","twitter_site":"@skynatstech","twitter_misc":{"Written by":"Kevin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/#article","isPartOf":{"@id":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/"},"author":{"name":"Kevin","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/person\/749ae0470320eb759ff1e07b8ea7fbe3"},"headline":"DigitalOcean Certbot Let\u2019s Encrypt","datePublished":"2022-04-07T07:08:13+00:00","dateModified":"2023-06-15T11:42:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/"},"wordCount":541,"publisher":{"@id":"https:\/\/www.skynats.com\/blog\/#organization"},"keywords":["certbot"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/","url":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/","name":"DigitalOcean Certbot Let\u2019s Encrypt | Skynats","isPartOf":{"@id":"https:\/\/www.skynats.com\/blog\/#website"},"datePublished":"2022-04-07T07:08:13+00:00","dateModified":"2023-06-15T11:42:34+00:00","description":"In-depth guide: Certbot installation, Running Certbot, Setting up the application, and Taking care of Certbot's automatic renewals.","breadcrumb":{"@id":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.skynats.com\/blog\/digitalocean-certbot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.skynats.com\/blog\/"},{"@type":"ListItem","position":2,"name":"DigitalOcean Certbot Let\u2019s Encrypt"}]},{"@type":"WebSite","@id":"https:\/\/www.skynats.com\/blog\/#website","url":"https:\/\/www.skynats.com\/blog\/","name":"Server Management Services | Cloud Management | Skynats","description":"Server Management and Cloud Management","publisher":{"@id":"https:\/\/www.skynats.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.skynats.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.skynats.com\/blog\/#organization","name":"Skynats Technologies","url":"https:\/\/www.skynats.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/Sknats-Logo-New-whole.png","contentUrl":"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/Sknats-Logo-New-whole.png","width":989,"height":367,"caption":"Skynats Technologies"},"image":{"@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/skynats","https:\/\/x.com\/skynatstech","https:\/\/www.instagram.com\/skynatstech\/","https:\/\/www.linkedin.com\/company\/skynats-technologies","https:\/\/www.youtube.com\/channel\/UCvTAjrFJ4_E2MJKwlDHomlg"]},{"@type":"Person","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/person\/749ae0470320eb759ff1e07b8ea7fbe3","name":"Kevin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g","caption":"Kevin"}}]}},"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=9334"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9334\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=9334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=9334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=9334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}