Last active
November 3, 2021 16:08
-
-
Save rajanski/67e04c871b815d18e8bf5e1797c72e1e to your computer and use it in GitHub Desktop.
Obtain and renew letsencrypt ssl certificate via certbot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired by an earlier version of Matthieu Petiteau's scripts at https://github.com/smallwat3r | |
echo "------------------------------------------------------" \ | |
"\nThis script is intended for Ubuntu/Debian Linuxes." \ | |
"\nIt needs to be run as root, on the server which DOMAIN points at." \ | |
"\nIt installs the letsencrypt client and gets/renews a certificate" \ | |
"\nfor the specified domain and email address." \ | |
"\n------------------------------------------------------" | |
export [email protected] | |
export DOMAIN=yourdomain.com | |
apt update && apt install -y snapd ufw | |
snap install core | |
snap refresh core | |
snap install --classic certbot | |
ln -s /snap/bin/certbot /usr/bin/certbot | |
ufw allow 80 | |
certbot certonly --renew-by-default --standalone --email $EMAIL -d $DOMAIN --agree-tos --eff-email | |
ufw deny 80 | |
echo "Job finished." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment