CRL next update mit Telegraf überwachen

06.10.2021

Nachdem ich neulich bereits darüber berichtete, wie man die Gültigkeit von Serverzertifikaten mittels Telegraf und Grafana überwachen kann habe ich mich nun eines weiteren Aspekts in diesem Zusammenhang angenommen.

Für die Gültigkeit bzw. Lebensdauer von x509-Zertifikaten hat telegraf ein Plugin an Bord, das man nur noch aktivieren muss.

Aber es gibt noch ein weiteres Konzept, das man im Auge behalten sollte - und dafür existiert leider kein Telegraf-Plugin: Es handelt sich dabei um die Lebenszeit von Certificate Revocation Lists (CRLs). Möchte man die Gültigkeit von Zertifikaten umfänglich verifizieren, muss man auch prüfen, ob diese Zertifikate durch die ausstellende Certificate Authority (CA) außerplanmäßig für ungültig erklärt wurden. Das geschieht entweder durch Analyse der CRL der CA oder - falls von der CA angeboten - durch eine Abfrage über das Online Certificate Status Protocol (OCSP).

CRLs sind Listen für ungültig erklärter (oder zurückgezogener) Zertifikate. Diese Listen werden nicht oft neu erstellt - eigentlich ist es nur nötig, die Liste neu zu erstellen, wenn ein weiteres Zertifikat auf die Liste gesetzt wurde. Dennoch ist es eine gute Praxis, die CRL zyklisch zu erneuern. Daher haben CRLs auch ein Attribut next update, das Auskunft über den spätesten nächsten Aktualisierungszeitpunkt erteilt.

Ist dieser Zeitpunkt überschritten, wenn in der CRL nach einem Zertifikat gesucht wird, um dessen Gültigkeit zu prüfen, schlägt diese Gültigkeitsprüfung fehl - als PKI oder CA sollte man also darauf achten, die CRLs rechtzeitig zu erneuern. Dazu existieren natürlich selbstredend entsprechende administrative Mechanismen - es ist trotzdem gut, dies mittels geeigneter unabhängiger Monitoring-Lösungen zu überwachen.

Ich habe dazu ein Bash-Skript geschrieben, das man per Cron zyklisch ausführen kann: Es erwartet als Argument eine URL zum Herunterladen der CRL und schreibt die gewonnenen Erkenntnisse (CN, Issuer-DN und verbleibende Zeit bis zum nächsten Update in Sekunden) in eine Influx-Datenbank:

#!/bin/bash
CRLENDOFLIFE=$(openssl crl -in ~/work/expect-dialog-ca.git/Dama11_Root_CA/crl/Dama11_Root_CA-ca.crl -nextupdate -noout|cut -d '=' -f 2
DATEFUTURE=$(date --date="$CRLENDOFLIFE" "+%s")
DATENOW=$(date "+%s")
SECONDSDIFF=$(($DATEFUTURE - $DATENOW))
ISSUER=$(openssl crl -in ~/work/expect-dialog-ca.git/Dama11_Intermediary_CA/crl/Dama11_Intermediary_CA-ca.crl -issuer -noout|cut -d '=
CN=$(echo $ISSUER|sed 's/.*CN =\(.*\)\,*.*/\1/g'|xargs)
ISSUER=$(echo $ISSUER|xargs)
echo "$SECONDSDIFF"
echo "$ISSUER"
echo "$CN"
#Quoting for InfluxDB
CN=$(echo $CN|sed 's/ /\\ /g'|sed 's/,/\\,/g'|sed 's/=/\\=/g')
ISSUER=$(echo $ISSUER|xargs|sed 's/ /\\ /g'|sed 's/,/\\,/g'|sed 's/=/\\=/g')

curl -i -XPOST 'http://192.168.10.2:8086/write?db=monitoring' \ --data-binary "crllifetime,host=$HOSTNAME,cn=$CN,issuer=$ISSUER value=${SECONDSDIFF}"

Diese Informationen kann man dann zum Beispiel mittels Grafana sichtbar machen - etwa mit diesem heftig von hier inspirierten Dashboard:

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "A very simple and visual Dashboard to monitor the remaining lifetime of CRLs (x.509).",
  "editable": true,
  "gnetId": 13683,
  "graphTooltip": 0,
  "id": 44,
  "iteration": 1629008435516,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Stat. On the Title of the widget you can find the SSL Certificate name, and on the value the current TTL/Expiry date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "max": 0,
          "min": 0,
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "semi-dark-orange",
                "value": 14
              },
              {
                "color": "semi-dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.last.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "EXP"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.issuer_common_name.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CA"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.verification_code.*$/"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Chain OK",
                    "to": "",
                    "type": 1,
                    "value": "0"
                  },
                  {
                    "from": "1",
                    "id": 2,
                    "text": "Chain ERR",
                    "to": "999999",
                    "type": 2,
                    "value": "1"
                  }
                ]
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-green",
                      "value": null
                    },
                    {
                      "color": "dark-red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "links": [],
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.3",
      "repeat": "ssl_name",
      "repeatDirection": "h",
      "scopedVars": {
        "ssl_name": {
          "selected": false,
          "text": "Dama 11 Lab Software CA",
          "value": "Dama 11 Lab Software CA"
        }
      },
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") /60/60/24,cn FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ AND \"issuer\" !~ /^$/) AND $timeFilter GROUP BY time($__interval), \"cn\" fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "/60/60/24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "source",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            },
            {
              "condition": "AND",
              "key": "san",
              "operator": "!=",
              "value": "\"\""
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$ssl_name",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Stat. On the Title of the widget you can find the SSL Certificate name, and on the value the current TTL/Expiry date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "max": 0,
          "min": 0,
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "semi-dark-orange",
                "value": 14
              },
              {
                "color": "semi-dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.last.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "EXP"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.issuer_common_name.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CA"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.verification_code.*$/"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Chain OK",
                    "to": "",
                    "type": 1,
                    "value": "0"
                  },
                  {
                    "from": "1",
                    "id": 2,
                    "text": "Chain ERR",
                    "to": "999999",
                    "type": 2,
                    "value": "1"
                  }
                ]
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-green",
                      "value": null
                    },
                    {
                      "color": "dark-red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 0
      },
      "id": 44,
      "links": [],
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.3",
      "repeatDirection": "h",
      "repeatIteration": 1629008435516,
      "repeatPanelId": 2,
      "scopedVars": {
        "ssl_name": {
          "selected": false,
          "text": "Dama11 Lab Component CA",
          "value": "Dama11 Lab Component CA"
        }
      },
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") /60/60/24,cn FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ AND \"issuer\" !~ /^$/) AND $timeFilter GROUP BY time($__interval), \"cn\" fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "/60/60/24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "source",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            },
            {
              "condition": "AND",
              "key": "san",
              "operator": "!=",
              "value": "\"\""
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$ssl_name",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Stat. On the Title of the widget you can find the SSL Certificate name, and on the value the current TTL/Expiry date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "max": 0,
          "min": 0,
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "semi-dark-orange",
                "value": 14
              },
              {
                "color": "semi-dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.last.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "EXP"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.issuer_common_name.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CA"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.verification_code.*$/"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Chain OK",
                    "to": "",
                    "type": 1,
                    "value": "0"
                  },
                  {
                    "from": "1",
                    "id": 2,
                    "text": "Chain ERR",
                    "to": "999999",
                    "type": 2,
                    "value": "1"
                  }
                ]
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-green",
                      "value": null
                    },
                    {
                      "color": "dark-red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 0
      },
      "id": 45,
      "links": [],
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.3",
      "repeatDirection": "h",
      "repeatIteration": 1629008435516,
      "repeatPanelId": 2,
      "scopedVars": {
        "ssl_name": {
          "selected": false,
          "text": "Dama11 Lab Identity CA",
          "value": "Dama11 Lab Identity CA"
        }
      },
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") /60/60/24,cn FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ AND \"issuer\" !~ /^$/) AND $timeFilter GROUP BY time($__interval), \"cn\" fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "/60/60/24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "source",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            },
            {
              "condition": "AND",
              "key": "san",
              "operator": "!=",
              "value": "\"\""
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$ssl_name",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Stat. On the Title of the widget you can find the SSL Certificate name, and on the value the current TTL/Expiry date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "max": 0,
          "min": 0,
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "semi-dark-orange",
                "value": 14
              },
              {
                "color": "semi-dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.last.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "EXP"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.issuer_common_name.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CA"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.verification_code.*$/"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Chain OK",
                    "to": "",
                    "type": 1,
                    "value": "0"
                  },
                  {
                    "from": "1",
                    "id": 2,
                    "text": "Chain ERR",
                    "to": "999999",
                    "type": 2,
                    "value": "1"
                  }
                ]
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-green",
                      "value": null
                    },
                    {
                      "color": "dark-red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 0
      },
      "id": 46,
      "links": [],
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.3",
      "repeatDirection": "h",
      "repeatIteration": 1629008435516,
      "repeatPanelId": 2,
      "scopedVars": {
        "ssl_name": {
          "selected": false,
          "text": "Dama11 Lab Intermediary CA",
          "value": "Dama11 Lab Intermediary CA"
        }
      },
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") /60/60/24,cn FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ AND \"issuer\" !~ /^$/) AND $timeFilter GROUP BY time($__interval), \"cn\" fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "/60/60/24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "source",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            },
            {
              "condition": "AND",
              "key": "san",
              "operator": "!=",
              "value": "\"\""
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$ssl_name",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Stat. On the Title of the widget you can find the SSL Certificate name, and on the value the current TTL/Expiry date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "max": 0,
          "min": 0,
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "semi-dark-orange",
                "value": 14
              },
              {
                "color": "semi-dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.last.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "EXP"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.issuer_common_name.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CA"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.verification_code.*$/"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Chain OK",
                    "to": "",
                    "type": 1,
                    "value": "0"
                  },
                  {
                    "from": "1",
                    "id": 2,
                    "text": "Chain ERR",
                    "to": "999999",
                    "type": 2,
                    "value": "1"
                  }
                ]
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-green",
                      "value": null
                    },
                    {
                      "color": "dark-red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 0
      },
      "id": 47,
      "links": [],
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.3",
      "repeatDirection": "h",
      "repeatIteration": 1629008435516,
      "repeatPanelId": 2,
      "scopedVars": {
        "ssl_name": {
          "selected": false,
          "text": "Dama11 Lab Intermediary Test CA",
          "value": "Dama11 Lab Intermediary Test CA"
        }
      },
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") /60/60/24,cn FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ AND \"issuer\" !~ /^$/) AND $timeFilter GROUP BY time($__interval), \"cn\" fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "/60/60/24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "source",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            },
            {
              "condition": "AND",
              "key": "san",
              "operator": "!=",
              "value": "\"\""
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$ssl_name",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Stat. On the Title of the widget you can find the SSL Certificate name, and on the value the current TTL/Expiry date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "max": 0,
          "min": 0,
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "semi-dark-orange",
                "value": 14
              },
              {
                "color": "semi-dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.last.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "EXP"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.issuer_common_name.*$/"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CA"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/^x509_cert.verification_code.*$/"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Chain OK",
                    "to": "",
                    "type": 1,
                    "value": "0"
                  },
                  {
                    "from": "1",
                    "id": 2,
                    "text": "Chain ERR",
                    "to": "999999",
                    "type": 2,
                    "value": "1"
                  }
                ]
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-green",
                      "value": null
                    },
                    {
                      "color": "dark-red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "id": 48,
      "links": [],
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.3",
      "repeatDirection": "h",
      "repeatIteration": 1629008435516,
      "repeatPanelId": 2,
      "scopedVars": {
        "ssl_name": {
          "selected": false,
          "text": "Dama11 Lab Root CA",
          "value": "Dama11 Lab Root CA"
        }
      },
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") /60/60/24,cn FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ AND \"issuer\" !~ /^$/) AND $timeFilter GROUP BY time($__interval), \"cn\" fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "/60/60/24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "source",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            },
            {
              "condition": "AND",
              "key": "san",
              "operator": "!=",
              "value": "\"\""
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$ssl_name",
      "type": "stat"
    },
    {
      "columns": [
        {
          "text": "Current",
          "value": "current"
        }
      ],
      "datasource": "InfluxDB monitoring",
      "description": "SSL Certificate Monitoring Table. On the first column you can find the SSL x509 Certificate name, and on the second column the TTL/Expirty Date in days.\n\nThresholds are:\n* From 0 days to 14, Red\n* From 15 days to 30, Orange\n* From 31 days onward, Green",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "100%",
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 4
      },
      "id": 9,
      "pageSize": null,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "",
          "align": "auto",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "link": false,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "SSL Expiry in",
          "align": "left",
          "colorMode": "row",
          "colors": [
            "#E02F44",
            "#FF780A",
            "rgba(50, 172, 45, 0.97)"
          ],
          "decimals": 2,
          "pattern": "Current",
          "thresholds": [
            "14",
            "30"
          ],
          "type": "number",
          "unit": "d"
        },
        {
          "alias": "Canonical Name",
          "align": "auto",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "link": false,
          "mappingType": 1,
          "pattern": "Metric",
          "preserveFormat": true,
          "sanitize": true,
          "thresholds": [
            ""
          ],
          "type": "string",
          "unit": "short",
          "valueMaps": []
        }
      ],
      "targets": [
        {
          "alias": "$tag_cn",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "crllifetime",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT (value / 60 / 60 / 24) as \"value\" FROM \"crllifetime\" WHERE (\"cn\" =~ /^$ssl_name$/ and \"issuer\" !~ /^$/) AND $timeFilter GROUP BY  \"cn\"  ",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "cn",
              "operator": "=~",
              "value": "/^$ssl_name$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "transform": "timeseries_aggregations",
      "transparent": true,
      "type": "table-old"
    },
    {
      "alert": {
        "alertRuleTags": {},
        "conditions": [
          {
            "evaluator": {
              "params": [
                10
              ],
              "type": "lt"
            },
            "operator": {
              "type": "and"
            },
            "query": {
              "params": [
                "A",
                "1h",
                "now"
              ]
            },
            "reducer": {
              "params": [],
              "type": "last"
            },
            "type": "query"
          }
        ],
        "executionErrorState": "alerting",
        "for": "5m",
        "frequency": "1m",
        "handler": 1,
        "message": "SSL Certificate is about to expire in <10d",
        "name": "Cert Aging",
        "noDataState": "no_data",
        "notifications": [
          {
            "uid": "000000002"
          }
        ]
      },
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "InfluxDB monitoring",
      "description": "This Graph is primarily for implementing the Alerting.",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 14
      },
      "hiddenSeries": false,
      "id": 43,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.3",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "$tag_cn",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT (value / 60 / 60 / 24) as \"value\" FROM \"crllifetime\" WHERE $timeFilter GROUP BY cn",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "thresholds": [
        {
          "colorMode": "critical",
          "fill": true,
          "line": true,
          "op": "lt",
          "value": 10
        }
      ],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Certificate life left",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "d",
          "label": null,
          "logBase": 2,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "1d",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {
          "selected": true,
          "tags": [],
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "datasource": "InfluxDB monitoring",
        "definition": "",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "CN",
        "multi": true,
        "name": "ssl_name",
        "options": [],
        "query": "SHOW TAG VALUES FROM crllifetime WITH KEY=cn",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Better SSL Monitoring (CRLs)",
  "uid": "xMhQ94kRz",
  "version": 5
}

Alle Artikel rss Wochenübersicht Monatsübersicht Github Repositories Gitlab Repositories Mastodon Über mich home xmpp


Vor 5 Jahren hier im Blog

  • Virtuelles Netzwerklabor

    11.01.2017

    Nachdem ich hin und wieder vor der Herausforderung stehe, Anwendungen unter realen Netzwerkbedingungen zu testen, habe ich bereits vor längerer Zeit begonnen, ein virtuelles Netzwerklabor aufzubauen...

    Weiterlesen...

Neueste Artikel

  • Stratum-1-NTP-Server Links

    Ich habe meinen eigenen Stratum-1-NTP-Server mittels eines GPS-Empfängers, einer Adapterschaltung und einem Raspi gebaut. Hier fasse ich einige nützliche Links zu diesem Themengebiet zusammen

    Weiterlesen...
  • EBCMS threaded und mit mehr Markdown-Unterstützung

    Mein eigener Static Site Generator hat in den letzten Wochen einige größere Umbauten erfahren

    Weiterlesen...
  • Fork der BeanShell wegen Trojan Source

    Es gibt inzwischen einen von mir erstellten Fork des originalen Repository, in dem ich die Komponente zur Darstellung der Konsole gegen die ausgetauscht habe, die in der sQLshell in den Plugins MDIJavaEditor und MDISqlEditor zum Einsatz kommt - dadurch wird wenigstens durch das Syntax-Highlighting auf problematische Stellen im Code hingewiesen.

    Weiterlesen...

Manche nennen es Blog, manche Web-Seite - ich schreibe hier hin und wieder über meine Erlebnisse, Rückschläge und Erleuchtungen bei meinen Hobbies.

Wer daran teilhaben und eventuell sogar davon profitieren möchte, muß damit leben, daß ich hin und wieder kleine Ausflüge in Bereiche mache, die nichts mit IT, Administration oder Softwareentwicklung zu tun haben.

Ich wünsche allen Lesern viel Spaß und hin und wieder einen kleinen AHA!-Effekt...

PS: Meine öffentlichen GitHub-Repositories findet man hier.