Skip to content

Instantly share code, notes, and snippets.

@justintime
Last active November 13, 2018 04:32
Show Gist options
  • Save justintime/e1932b89ea9debad3eb6166b3fff40bb to your computer and use it in GitHub Desktop.
Save justintime/e1932b89ea9debad3eb6166b3fff40bb to your computer and use it in GitHub Desktop.
Certbot renewal for Powershell Empire
#!/bin/bash
service apache2 status
prevstatus=$?
if [ $prevstatus -ne 0 ]; then
echo "Apache stopped, starting now."
service apache2 start
fi
certbot renew
diff /opt/Empire/data/empire-chain.pem /etc/letsencrypt/live/thp3-c2.h3r3.tk/fullchain.pem
rv=$?
if [ $rv -ne 0 ]; then
echo
echo
echo "Key was updated, copying to Empire"
cp /etc/letsencrypt/live/thp3-c2.h3r3.tk/fullchain.pem /opt/Empire/data/empire-chain.pem
cp /etc/letsencrypt/live/thp3-c2.h3r3.tk/privkey.pem /opt/Empire/data/empire-priv.key
fi
if [ $prevstatus -ne 0 ]; then
echo "Returning apache to stopped state."
service apache2 stop
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment