-
Notifications
You must be signed in to change notification settings - Fork 11
/
get-ssl.sh
53 lines (34 loc) · 1.68 KB
/
get-ssl.sh
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
# ORIGINAL MAC VERSION FROM https://github.com/BlueFeatherGroup/FileMaker-LetsEncrypt-Mac
# MODIFIED VERSION FROM https://the.fmsoup.org/t/use-of-free-letsencrypt-ssl-certificates-with-fms/1019/7
# --- changed serverKey path
# Change the domain variable to the domain/subdomain for which you would like
# an SSL Certificate
DOMAIN="fms.domain.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="[email protected]"
# Enter the path to your FileMaker Server directory, ending in a slash
SERVER_PATH="/opt/FileMaker/FileMaker Server/"
FMADMIN="fmConsoleLogin"
FMPASS="fmConsolePassword"
#
# --- 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
# changed to server.pem as that seems to be used by fm now instead
mv "${SERVER_PATH}CStore/server.pem" "${SERVER_PATH}CStore/serverKey-old.pem"
# Remove the old certificate
fmsadmin certificate delete --yes -u ${FMADMIN} -p ${FMPASS}
# Install the certificate
fmsadmin certificate import "${SERVER_PATH}CStore/fullchain.pem" --keyfile "${SERVER_PATH}CStore/privkey.pem" -y -u ${FMADMIN} -p ${FMPASS}
# Stop FM service
sudo service fmshelper stop
# Start FM service
sudo service fmshelper start