Certbot
Certbot is a ACEM client to get SSL certificates for web server, to make a website accessible through HTTPS. Certbot, by default, get certificates from Let's Encrypt, the most popular free CA.
Install Certbot
sudo zypper install python3-certbot
If you are using Apache web server, install this plugin:
sudo zypper install python3-certbot-apache
If you are using NGINX web server, install this plugin:
sudo zypper install python3-certbot-nginx
Certbot a client of an online service and the API might change at anytime. We recommend using the latest openSUSE Leap release or Tumbleweed, to get newer Python and Certbot. Latest Leap is usually shipped with a little older Certbot, which should work without problem. However, if you encounter issues, try latest version from openSUSE Build Service:
opi python3-certbot
Get certificates for Apache/NGINX
Let's say you have a website http://example.com/ powered by Apache/NGINX, and you want to enable HTTPS for it. Before running Certbot, make sure you have a valid Apache/NGINX virtual host config at /etc/apache2/vhosts.d/example.com.conf or /etc/nginx/vhosts.d/example.com.conf.
NGINX is not only used to serve static files and run cgi, but also used as a proxy to forward requests to Node.js or Go app. NGINX handles SSL, IPv4/IPv6, much better than Node.js or Go. It also enables you to run multiple web apps sharing the same 80/443 ports.
Run this command and follow the instruction, Certbot will install certificates and update Apache/NGINX config automatically:
sudo certbot run
You do NOT need to restart Apache or Nginx server. Certbot does it for you!
If you are using other web server with no plugin support, you generate certificates only and manually configure your web server:
sudo certbot certonly
Setup auto-renew
Certificates issued by Let's Encrypt will expire in 3 month. If you forget to renew certificates, your website will be inaccessible. If you don't want to waste time on this, you can setup a systemd timer or cron job to automatically run renew command.
Systemd way:
sudo zypper install certbot-systemd-timer sudo systemctl enable --now certbot-renew.timer
Cron way:
sudo crontab -e
21 07 22 * * root /usr/bin/certbot renew
This will run renew every day at 22:07:21. You should use a different random time to avoid that everyone renew at the same time and crash Let's Encrypt server.
Test in browser
Open your web browser, visit your website start with "https://" and see if the website works fine.
You can also test your website on SSL Labs.
Troubleshooting
Domain authentication failed
Certbot relies on 80 port for domain authentication. However, default firewall configuration blocked 80 port for HTTP (and 443 port for HTTPS). You may get errors like the following:
Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems: Domain: www.example.com Type: connection Detail: 143.42.35.123: Fetching http://www.example.com/.well-known/acme-challenge/FMcCVclqPfQpFRfe9ZNCeSw9EBGDaycVjbLxWAPjhC0: Error getting validation data
To allow 80 (http) and 443 (https) ports, run the following commands:
sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --add-service=https --permanent sudo firewall-cmd --reload
Internal links
- uacme, another ACME written in C
- Setup openSUSE VPS, other steps to setup a web server