Getting a Free SSL Certificate with Certbot

Submitted by D2D on Sun, 07/12/2020 - 11:30

Using Certbot to Get a Let's Encrypt SSL Certificate for a Shared Hosting Environment

 

Working with not-for-profit organizations with extremely small budgets can be a challenge.  It is usually preferable to spend volunteer time than actual dollars.

Until recently, getting a free Let’s Encrypt certificate has been relatively trivial.  All that was required was to go to www.sslforfree.org and follow their GUI procedure.  Even if the automatic update did not validate, the manual update normally did, and the fall back DNS validation could be invoked if needed.

Since SSLforfree is now part of ZeroSSL, and they insist that a redirect is another domain.  The cost of a Let’s Encrypt security certificate goes from $0 to $10/month.  And, for some reason the domains can’t be validated with my GoDaddy account.  The problem could be in one of my redirects or GoDaddy’s non-support of ACME Challenge.  After some research, the only alternative I could find was Certbot, an EFF product.

 

As an aside, I spoke to GoDaddy about their certificates for a domain that currently does not have any redirects other than the www and non-www versions.  The rep tried to sell me an upgraded certificate for nearly 3 times as much.  I went back to a free certificate for the domain.

Another question to GoDaddy regarding a domain where I have both *.org and *.com versions resulted in a rep telling me that I needed to get the *.net and *.info versions (he missed *.biz and *.us).  This is ridiculous.  Trying to capture your site with all possible extensions can get really expensive, defeats the purpose of the new extensions, and may not even be possible.

Needless to say, I am somewhat less enthralled with GoDaddy after these incidents.

 

Directly using Certbot requires root access, which is obviously not available on a shared hosting account.  Thus, Certbot must be run in “manual” mode and the certificates must be downloaded to a local computer.

I had difficulty finding instructions for using Certbot, but after installing it on a local machine, running Certbot help in an elevated command prompt will show all of the commands available with Certbot.  The best clue that I could find to running Certbot locally was at this link:

https://community.letsencrypt.org/t/how-do-i-generate-the-lets-encrypt-certificate-and-key-on-my-own-device-more-info-inside/27510

Using Certbot on a shared hosting server that does not support ACME Challege involves:

  1. Installing Certbot on your local machine.
  2. Obtaining challenge files
  3. Installing challenge files
  4. Validating challenge files.
  5. Installing the certificate in cPanel.

Each of these items requires that some steps be completed.

I am installing on a windows machine so the steps are:

  1. Download the Certbot installer from  https://dl.eff.org/certbot-beta-installer-win32.exe.
  2. Run the installer.

Detailed instructions can be found here:

https://certbot.eff.org/lets-encrypt/windows-other.html#:~:text=Install%20Certbot.,%2C%20that%20can%20be%20customize).

The installer will install a shortcut on The Windows Start menu, but the best way to launch is with a batch file, but don’t use it.  Instead:

  1.  Create a Batch file with the command:

Certbot>certbot certonly --manual -d <mydomain1> -d <mydomain2> -d www.<mydomain1> -d www.<mydomain2>.

Where mydomain1 is the primary domain and mydomain2 is a redirect.  You should be able to add as many redirects as you need, and you need the -d switch for each domain entered.

Don’t forget to add both the www and non-www versions to the list as separate domains.

  1. Since this command will have to be run every 90 days, it Save the batch file.
    1. Tip:  Save the batch file in a folder in the root of C: to make it easy to find and execute.
  2. Open an elevated command prompt.
  3. In the elevated command prompt:
    1. Enter your email address if prompted to do so.
    2. Agree to the terms and conditons
    3. Answer Y to allow your IP address to be logged.  Note that this is the IP address of the local machine and that Certbot won’t run if you answer N.
  4. As instructed create a text file with the content:

<Long random number 1>.<long random number 2>

  1. Save the file with the filename <long random number 1>
  2. Press Enter to continue.

Note that you will have to repeat this for each domain that you entered in step 1.  Do Not press enter after the last entry.

  1. Copy the files that you just created to the webroot on your website’s host in a folder named “.well-known/acme-challenge”.
    1. The folders can be created in cPanel or in an SSH session.
  2. Now back on the local computer press enter to run the validation check.
  3. Once the validation check successfully completes, your certificate will be saved to “C:\Certbot\Live\<mydomain1>\fullchain.pem”.
  4. Open the file with a text editor such as Notepad++.  Word will not work, and I have been advised that Notepad is not a good idea.
  5. Copy the contents of the file as far as the first “End of Certificate” (there are 2 of them) to your clip board.
    1. As far as I can tell you can generate the second item in cPanel.
  6. Log into your webhost and open cPanel.
  7. On the main screen in the Security Group Click SSL/TLS
  8. On the screen that opens, click Update certificate in the row associated with the domain in question.
    1.  You will be redirected to the box below and your domain will be selected.
  9. Paste the certificate into the box labeled Certificate (CRT).
  10. Click the “Autofill by Domain” button.
    1. This is where the second part of the “fillchain.pem” file is regenerated.
  11. Go back to your local computer and open the file “C:\Certbot\live\privkey.pem”.
  12. Copy the contents of the file.
  13. Paste the contents into the box in cPanel labeled “Private Key (Key)”.
  14. Test your main domain and redirects to be sure that the certificate has taken effect.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.