Ubuntu Server 20.04 LTS and Certbot

April 26, 2020

On April 23 Canonical announced the general availability of Ubuntu Server 20.04 LTS. I was waiting this release to update my droplet. Instead of an upgrade of the current droplet I opted to create a new one.

The .page domains must be served over HTTPS otherwise browsers refuse to connect. I used Certbot (using Let's Encrypt) to obtain and install on my old droplet the required SSL certificates. Certbot is a great tool that in less than 3 minutes allows to require, install and configure on the web server (NGINX, Apache, etc.) the certificates.

The first step I did to migrate my personal website was to revoke certificates for contini.page domain on the old droplet. This allowed me to request fresh Let's Encrypt certificates on the new droplet.

After installing NGINX, I migrated website files and created the server block. Then I installed Certbot

# apt-get install certbot python3-certbot-nginx

note python3-certbot-nginx instead of python-certbot-nginx (the Certbot website is still not updated).

The Certbot version installed is a very old 0.40.0 (at the time of writing this post the latest stable version is 1.3.0) and unfortunately this created some problems. Instead of 3 minutes I needed to spend hours.

The problem happened when I tried to request new certificates. The procedure stopped with this error message

An unexpected error occurred: AttributeError: module ‘acme.challenges’ has no attribute ‘TLSSNI01’

I duckDucked hours and tried a lot of fix (none worked) before find this workaround suggested by a user on Let's Encrypt forum.

I opened /usr/lib/python3/dist-packages/certbot_nginx/configurator.py at line 1110 and edited the return of get_chall_pref function. I replaced

return [challenges.HTTP01, challenges.TLSSNI01]

with

return [challenges.HTTP01]

After this fix certbot --nginx worked as expected.


Did you find this post useful? What about Buy Me A Coffee

A photo of Elia Contini
Written by
Elia Contini
Sardinian UX engineer and a Front-end web architect based in Switzerland. Marathoner, traveller, wannabe nature photographer.