Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radmiraal/a1d274905f55d87dce6f9e8cbd453c6a to your computer and use it in GitHub Desktop.
Save radmiraal/a1d274905f55d87dce6f9e8cbd453c6a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
DOMAIN="my.host.name"
SERVER_PATH="/opt/FileMaker/FileMaker Server/"
FMADMIN="admin"
FMPASS="my fancy password"
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}
systemctl restart fmshelper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment