{
  "name": "tls-cert-expiry-check",
  "title": "Check a TLS certificate's expiry",
  "category": "HTTP",
  "tags": [
    "http",
    "openssl"
  ],
  "version": "1.0.0",
  "date": "2026-10-18",
  "notes": "Initial release.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yaml",
  "entrypoint": "check",
  "parameters": [
    {
      "name": "host",
      "title": "Host",
      "description": "Host to connect to.",
      "type": "string",
      "required": true,
      "example": "www.example.com"
    },
    {
      "name": "min-days",
      "title": "Min days",
      "description": "Fail if the certificate has fewer than this many days left.",
      "type": "string",
      "required": false,
      "default": "14"
    },
    {
      "name": "port",
      "title": "Port",
      "description": "Port to connect to.",
      "type": "string",
      "required": false,
      "default": "443"
    },
    {
      "name": "server-name",
      "title": "Server name",
      "description": "Name to ask for with SNI. Leave blank to use the host.",
      "type": "string",
      "required": false,
      "default": ""
    }
  ],
  "images": [
    {
      "ref": "alpine/openssl@sha256:96e53bf9b9041fdc8a33ea61356688506bbddc368c70d6e8a9acdd28475e8537",
      "repository": "alpine/openssl",
      "tag": "3.5.9",
      "digest": "sha256:96e53bf9b9041fdc8a33ea61356688506bbddc368c70d6e8a9acdd28475e8537"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: tls-cert-expiry-check\n  labels:\n    dagweave.io/catalog-item: tls-cert-expiry-check\n  annotations:\n    dagweave.io/catalog-version: \"1.0.0\"\n    dagweave.io/catalog-category: \"HTTP\"\nspec:\n  entrypoint: check\n  templates:\n    - name: check\n      inputs:\n        parameters:\n          - name: host\n          - name: port\n            default: \"443\"\n          - name: server-name\n            default: \"\"\n          - name: min-days\n            default: \"14\"\n      outputs:\n        parameters:\n          # Whole days until the certificate expires.\n          - name: days-left\n            valueFrom:\n              path: /tmp/days-left\n      retryStrategy:\n        limit: \"2\"\n        retryPolicy: OnFailure\n        backoff:\n          duration: 10s\n          factor: \"2\"\n          maxDuration: 2m\n      container:\n        # alpine/openssl:3.5.9\n        image: alpine/openssl@sha256:96e53bf9b9041fdc8a33ea61356688506bbddc368c70d6e8a9acdd28475e8537\n        command: [sh, -c]\n        args:\n          - |\n            set -eu\n            name=\"${SERVER_NAME:-${HOST}}\"\n            cert=$(echo | timeout 20 openssl s_client -connect \"${HOST}:${PORT}\" -servername \"${name}\" 2\u003e/dev/null | openssl x509) || {\n              echo \"could not read a certificate from ${HOST}:${PORT}\" \u003e\u00262; exit 1; }\n            not_after=$(printf '%s\\n' \"${cert}\" | openssl x509 -noout -enddate | cut -d= -f2)\n            end=$(date -u -D '%b %e %H:%M:%S %Y GMT' -d \"${not_after}\" +%s)\n            days=$(( (end - $(date -u +%s)) / 86400 ))\n            echo \"${days}\" \u003e /tmp/days-left\n            echo \"${HOST}:${PORT} certificate expires ${not_after}, ${days} days from now\"\n            if ! printf '%s\\n' \"${cert}\" | openssl x509 -noout -checkend $(( MIN_DAYS * 86400 )) \u003e /dev/null; then\n              echo \"less than ${MIN_DAYS} days left\" \u003e\u00262; exit 1\n            fi\n        env:\n          - name: HOST\n            value: \"{{inputs.parameters.host}}\"\n          - name: PORT\n            value: \"{{inputs.parameters.port}}\"\n          - name: SERVER_NAME\n            value: \"{{inputs.parameters.server-name}}\"\n          - name: MIN_DAYS\n            value: \"{{inputs.parameters.min-days}}\"\n        resources:\n          requests:\n            cpu: 50m\n            memory: 64Mi\n          limits:\n            memory: 256Mi\n",
  "templateSha256": "903a7849393b2ce4bda33b4aeb26243caf3d6aa53dc4356e5b76e3a399454200",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/tls-cert-expiry-check",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
