This script was written in BASH and was tested on Ubuntu Server 20.04. It automatically runs certbot and configures your Domain with a Lets Encrypt SSL Certificate.
- Before using this script you should already have a Domain setup through the Apache Web Server.
- Clone the Repository
git clone https://github.com/ryanc410/auto-ssl.git
- Make the script executable
cd auto-ssl
chmod +x auto-ssl.sh
- Run Script
sudo ./auto-ssl.sh
- DONE! Your Domain is now secured with Lets Encrypt and it was easy as one command.
- Checks to make sure the Apache Web Server is installed and Listening on Port 80.
- The user enters the Domain they wish to secure. (example.com)
- The entered Domain name is tested using the host command to make sure it is in fact a valid domain.
- Apache modules ssl, headers and http2 are enabled.
- Installs certbot.
- Generates Diffie Helman certificate.
- A directory is created to hold the validation file needed from Lets Encrypt.
- An alias is configured that points to the directory previously created.
- ssl-params.conf file is created to enable SSL Stapling, the Strict Transport Security header and to specify the ciphers that are allowed.
- Certbot command runs to request the certificate from Lets Encrypt.
- If the certbot command is successful, a new virtual host file is generated to configure the SSL options for the Domain.
- Virtual Host is enabled, Apache is reloaded and the script is finished. A full log can be found in the directory the script was executed at apache_auto_ssl.log
If you find and errors you can create an issue here.
Everything I have learned has been through trial and error, as well as countless hours of searching throught forums and e-books. I am always open to criticism, especially if it will help me, or someone else reading this to improve on their skills.
To make a suggestion, comment or to provide feedback or suggestions, you can do that HERE.
This script is based upon the tutorial that I used many many times and I thought was the best one out there. Here is the link to it Secure Apache with Lets Encrypt on Ubuntu 20.04. I couldnt find the author's name but it was posted on July 8, 2020.