Révision 21dfe488
[ssl_] Allow to specify ports other than HTTPS
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
| plugins/ssl/ssl_ | ||
|---|---|---|
| 28 | 28 |
|
| 29 | 29 |
. $MUNIN_LIBDIR/plugins/plugin.sh |
| 30 | 30 |
|
| 31 |
SITE=${0##*ssl_}
|
|
| 31 |
ARGS=${0##*ssl_}
|
|
| 32 |
SITE=${ARGS/:*/}
|
|
| 33 |
PORT=${ARGS##*:}
|
|
| 34 |
if [ "$PORT" = "$SITE" ]; then |
|
| 35 |
PORT=443 |
|
| 36 |
fi |
|
| 32 | 37 |
|
| 33 | 38 |
case $1 in |
| 34 | 39 |
config) |
| ... | ... | |
| 46 | 51 |
;; |
| 47 | 52 |
esac |
| 48 | 53 |
|
| 49 |
cert=$(echo "" | openssl s_client -CApath /etc/ssl/certs -servername "${SITE}" -connect "${SITE}:443" 2>/dev/null);
|
|
| 54 |
cert=$(echo "" | openssl s_client -CApath /etc/ssl/certs -servername "${SITE}" -connect "${SITE}:${PORT}" 2>/dev/null);
|
|
| 50 | 55 |
|
| 51 | 56 |
if [[ "${cert}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
|
| 52 | 57 |
echo "${cert}" | openssl x509 -noout -enddate | awk -F= 'BEGIN { split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", month, " "); for (i=1; i<=12; i++) mdigit[month[i]] = i; } /notAfter/ { split($0,a,"="); split(a[2],b," "); split(b[3],time,":"); datetime=b[4] " " mdigit[b[1]] " " b[2] " " time[1] " " time[2] " " time[3]; days=(mktime(datetime)-systime())/86400; print "expire.value " days; }'
|
Formats disponibles : Unified diff