-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove-certs.sh
More file actions
18 lines (14 loc) · 747 Bytes
/
move-certs.sh
File metadata and controls
18 lines (14 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
# this script will move the new certs to the corrrect location, set the permissions and restart the webserver
# If there has been an update then restart the web server
echo "One or more certs were updated. Copying certs and restarting web server...."
# read domain name from file
DOMAIN_NAME=$(<"/etc/letsencrypt-scripts/domain")
# Copy to directory for nginx to use
sudo cp /usr/bin/.lego/certificates/"$DOMAIN_NAME".crt /etc/pki/managerssl.crt
sudo chmod 644 /etc/pki/managerssl.crt
sudo cp /usr/bin/.lego/certificates/"$DOMAIN_NAME".key /etc/pki/managerssl.key
sudo chmod 640 /etc/pki/managerssl.key
# restart the web server
salt-call state.apply nginx
echo "Finished moving certs to correct location and restarted web server!"