-
-
Save spacetourist/788ea722901e81d355850842e2b17cda to your computer and use it in GitHub Desktop.
This file contains 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 | |
KEY=`xxd -c 100000 -p /etc/letsencrypt/live/opensips/privkey.pem` | |
CRT=`xxd -c 100000 -p /etc/letsencrypt/live/opensips/fullchain.pem` | |
# Update both the default domains (client+server) with the renewed certificate | |
mysql -h 192.168.151.20 -u opensips_dev -pPASSWORD opensips_dev -e "UPDATE opensips_dev.tls_mgm SET certificate=0x${CRT}, private_key=0x${KEY} WHERE domain='default'" >/dev/null | |
if [ $? -ne 0 ]; then | |
# Something went wrong, report error back to lets encrypt | |
echo "MySQL certificate update failed" | |
exit 1 | |
fi | |
# Reload certs into running system | |
/usr/local/bin/opensips-cli -x mi tls_reload >/dev/null | |
if [ $? -ne 0 ]; then | |
# Something went wrong, report error back to lets encrypt | |
echo "Failed to reload certificates using opensips-cli" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment