Last active
February 17, 2024 05:58
-
-
Save NotYusta/4b3a0db8f3606c2c668539b8a469b032 to your computer and use it in GitHub Desktop.
Install certificate and replace all certificate subdomains with domain's one.
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/sh | |
DOMAIN_NAME="" | |
CERTIFICATE_PATH="/etc/letsencrypt/live" | |
# MAKE SURE USE \ TO PREVENT TRAILING SPACES. | |
PRIVATE_KEY="" | |
PUBLIC_CERT="" | |
rm -rfv "$CERTIFICATE_PATH/$DOMAIN_NAME" | |
mkdir -pv "$CERTIFICATE_PATH/$DOMAIN_NAME" | |
echo "$PUBLIC_CERT" | sudo tee -a "$CERTIFICATE_PATH/$DOMAIN_NAME/fullchain.pem" | |
echo "$PRIVATE_KEY" | sudo tee -a "$CERTIFICATE_PATH/$DOMAIN_NAME/privkey.pem" | |
# SBD = Subdomain | |
for SBDFOLDER in $CERTIFICATE_PATH/*$DOMAIN_NAME; do | |
if [ ! -d $dir ]; then | |
echo "skipped $SBDFOLDER" | |
continue | |
fi | |
echo "installing $SBDFOLDER" | |
cp -rv "$CERTIFICATE_PATH/$DOMAIN_NAME/." "$SBDFOLDER" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment