-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from engineyard/letsencrypt
[FB-2830] Adds wildcard letsencrypt
- Loading branch information
Showing
6 changed files
with
152 additions
and
13 deletions.
There are no files selected for viewing
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
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
umask 022 | ||
|
||
# make tmp dir | ||
status_dir="/tmp/check_le_status" | ||
mkdir -p "${status_dir}" | ||
|
||
# alert | ||
alert () | ||
{ | ||
# params | ||
device="${1}"; severity="${2}" | ||
timestamp=$(date '+%s') | ||
|
||
# load previous status | ||
status_file="${status_dir}/le-status" | ||
previous_severity=$(cat "${status_file}") 2>/dev/null | ||
|
||
# send notification | ||
if [[ $severity != $previous_severity ]]; then | ||
case "${severity}" in | ||
OKAY) message="Certificate is valid" ;; | ||
FAILURE) message="Certificate will expire in 7 days or less. Something has gone wrong." ;; | ||
esac | ||
|
||
echo "PUTNOTIF Type=custom-certificate Time=${timestamp} Severity=${severity} Message=\"raw_message: ${message}\"" | ||
fi | ||
|
||
# write current status to status file | ||
echo "${severity}" > "${status_file}" | ||
} | ||
|
||
|
||
|
||
if [[ $(sudo openssl x509 -in /etc/letsencrypt/live/<%= @md %>/cert.pem -checkend 604800 -noout |grep "Certificate will expire" --ignore-case) ]]; then | ||
alert "Certificate is invalid" "FAILURE" | ||
else | ||
alert "Certificate is valid" "OKAY" | ||
fi |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Configured letsencrypt secrets for automated renewal | ||
<%= @data %> |