Skip to content

Instantly share code, notes, and snippets.

@technicalogical
Forked from printminion/certbot-renew.sh
Created March 9, 2017 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save technicalogical/d5442e7890f53942b66f5e72b1711c6a to your computer and use it in GitHub Desktop.
Save technicalogical/d5442e7890f53942b66f5e72b1711c6a to your computer and use it in GitHub Desktop.
renew ssl letsencrypt certificate on bitnami server
#!/bin/bash
#renew ssl letsencrypt certificate on bitnami server
#https://gist.github.com/printminion/6ec2fc0fefaba8e0a98a63a6d73b0802/edit
sudo /opt/bitnami/ctlscript.sh stop apache
cd /home/user/certbot
#./certbot-auto certonly --standalone -w /opt/bitnami/apache2/conf/ -d example
.com -d www.example.com
./certbot-auto renew
sudo cp /etc/letsencrypt/live/example.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
sudo cp /etc/letsencrypt/live/example.com/privkey.pem /opt/bitnami/apache2/conf/server.key
sudo /opt/bitnami/ctlscript.sh start apache
@technicalogical
Copy link
Author

technicalogical commented Mar 9, 2017

`# Renew Let's Encrypt SSL Certificates

https://docs.bitnami.com/google/components/apache/#how-to-install-the-lets-encrypt-client

#Forked from printminion/certbot-renew.sh
#and changes made by dhimmel
#https://gist.github.com/printminion/6ec2fc0fefaba8e0a98a63a6d73b0802

Schedule with crontab -e 0 4 1,16 * * sh /home/bitnami/ssl/renew.sh >> /home/bitnami/ssl/cron-renew.log

print a separator line

printf '%79s\n' | tr ' ' '#'

output date

date --iso-8601=seconds --universal

Stop webserver

sudo /opt/bitnami/ctlscript.sh stop apache

Renew certificates

cd /home/bitnami/ssl/certbot
sudo ./letsencrypt-auto renew
sudo cp /etc/letsencrypt/live/DOMAIN.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
sudo cp /etc/letsencrypt/live/DOMAIN.com/privkey.pem /opt/bitnami/apache2/conf/server.key

Start webserver

sudo /opt/bitnami/ctlscript.sh start apache`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment