forked from gearbox-solutions/FileMaker-LetsEncrypt-Mac
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetSSL.sh
More file actions
53 lines (36 loc) · 1.61 KB
/
GetSSL.sh
File metadata and controls
53 lines (36 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# Created by: David Nahodyl, Blue Feather
# Contact: contact@bluefeathergroup.com
# Date: 5/7/2019
# Version: 0.4
# Need help? We can set this up to run on your server for you! Send an email to
# contact@bluefeathergroup.com or give a call at (770) 765-6258
# Change the domain variable to the domain/subdomain for which you would like
# an SSL Certificate
DOMAIN="fms.mycompany.com"
# Change the contact email address to your real email address so that Let's Encrypt
# can contact you if there are any problems #>
EMAIL="myemail@mycompoany.com"
# Enter the path to your FileMaker Server directory, ending in a slash
SERVER_PATH="/Library/FileMaker Server/"
#
# --- you shouldn't need to edit anything below this line
#
WEB_ROOT="${SERVER_PATH}HTTPServer/htdocs"
# Get the certificate
certbot certonly --webroot -w "$WEB_ROOT" -d $DOMAIN --agree-tos -m "$EMAIL" --preferred-challenges "http" -n
cp "/etc/letsencrypt/live/${DOMAIN}/fullchain.pem" "${SERVER_PATH}CStore/fullchain.pem"
cp "/etc/letsencrypt/live/${DOMAIN}/privkey.pem" "${SERVER_PATH}CStore/privkey.pem"
chmod 640 "${SERVER_PATH}CStore/privkey.pem"
# Move an old certificate, if there is one, to prevent an error
mv "${SERVER_PATH}CStore/serverKey.pem" "${SERVER_PATH}CStore/serverKey-old.pem"
# Remove the old certificate
fmsadmin certificate delete
# Install the certificate
fmsadmin certificate import "${SERVER_PATH}CStore/fullchain.pem" --keyfile "${SERVER_PATH}CStore/privkey.pem" -y
# Stop FileMaker Server
launchctl stop com.filemaker.fms
# Wait 15 seconds for it to stop
sleep 15s
# Start FileMaker Server again
launchctl start com.filemaker.fms