Projet

Général

Profil

Révision 21dfe488

ID21dfe488c0a8c3bf906f8751bf6bf751a2c04d49
Parent d42751c9
Enfant 43e67ac7

Ajouté par Olivier Mehani il y a plus de 9 ans

[ssl_] Allow to specify ports other than HTTPS

Signed-off-by: Olivier Mehani <>

Voir les différences:

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