{"id":530,"date":"2022-08-01T20:52:02","date_gmt":"2022-08-01T20:52:02","guid":{"rendered":"http:\/\/blog.miguelsarmiento.com\/?p=530"},"modified":"2022-08-02T13:35:14","modified_gmt":"2022-08-02T13:35:14","slug":"cerbot-haproxy-oh-my","status":"publish","type":"post","link":"https:\/\/blog.miguelsarmiento.com\/?p=530","title":{"rendered":"Cerbot, Oh My!"},"content":{"rendered":"<p>A few weeks ago, my Internet router died suddenly.<\/p>\n<p>Not that much of an issue unless you use a custom box as a modem and you have your website hosted on it.<\/p>\n<p>The server I was using for this was a Fedora Core 9 machine. I know an ancient OS.<\/p>\n<p>The machine itself was not that old, I found about 4 years a cheap Intel 386 with ISA support so I replaced the really old server I had. I was able to migrate to the new box, I was running a hardware raid setup using an ISA card. Talk about making things complicated.<\/p>\n<p>I initially tried using a virtual server to have things running quickly, I had a backup of the server running on a VMware workstation however, I could not make it a go for reasons that may merit another blog.<\/p>\n<p>However, I had laying around my old media server, 4 Gb of ram and 500 GB of disk space. Too much space but that was the only thing I had. It only had one NIC but I found a USB to Ethernet dongle.<\/p>\n<p>This time I decided to use HAproxy to present my website and blog and have proper SSL certs for each.<\/p>\n<p><!--more--><\/p>\n<p>There are plenty of recipes if you Google them that walk you through on how to install HAproxy and use Cerbot.<\/p>\n<p>However, I had some issues when implementing those solutions. Not with the methodology per se but with syntax and the usage of the Cerbot application.<\/p>\n<p>My new modem is a Ubuntu server running version 20.0.4, it is a standard install running NetFilter, using NAT and dual-stack (IPv4 and IPv6).<\/p>\n<p>The web and blog servers sit behind it thus running either Apache or HAproxy as a reverse proxy was a must.<\/p>\n<p>After I had HAproxy up and running and testing that I could access my websites from the Internet, my attention turned to getting certs using Cerbot.<\/p>\n<p>The first issue I encountered was that unless you are using one of the plugins Cerbot supports, there is no way to obtain a wilcard certificate.<\/p>\n<p>The documentation also is not clear, it may look like you could in principle get a wildcard cert manually however that is not the case.<\/p>\n<p>Not a big deal I would have to manually obtain certs for my sites, so I try to get a cert for my blog first it failed. The issue was the syntax I was using. The articles I read had the wrong syntax.<\/p>\n<p>After some trial and error, I hit the correct syntax.<\/p>\n<pre>sudo certbot certonly --standalone \\\r\n--preferred-challenges http -d www.example.com\u00a0 \\\r\n--non-interactive --agree-tos \\\r\n--email johnsmith@example.com\u00a0 --http-01-port=8888<\/pre>\n<p>The syntax above allowed me to obtain certs for both sites.<\/p>\n<p>The end result is that now I have both my website and blog using SSL certs.<\/p>\n<p>Of course, you need some way of renewing the certs and attaching the renewed certs, etc. but that will be the subject of another blog hopefully.<\/p>\n<p>Ciao.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago, my Internet router died suddenly. Not that much of an issue unless you use a custom box as a modem and you have your website hosted on it. The server I was using for this was a Fedora Core 9 machine. I know an ancient OS. The machine itself was not &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.miguelsarmiento.com\/?p=530\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Cerbot, Oh My!&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-530","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=\/wp\/v2\/posts\/530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=530"}],"version-history":[{"count":12,"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=\/wp\/v2\/posts\/530\/revisions"}],"predecessor-version":[{"id":542,"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=\/wp\/v2\/posts\/530\/revisions\/542"}],"wp:attachment":[{"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.miguelsarmiento.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}