Check a TLS certificate's expiry
Connect to a host over TLS and fail the step if its certificate expires within the number of days you set. Passes the days left to later steps.
Install v1.0.0
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yaml
Facts
- Category
- HTTP
- Tags
- http openssl
- Entrypoint
check- Template SHA-256
903a7849393b2ce4bda33b4aeb26243caf3d6aa53dc4356e5b76e3a399454200- Source
- tls-cert-expiry-check at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
alpine/openssl | 3.5.9 | sha256:96e53bf9b9041fdc8a33ea61356688506bbddc368c70d6e8a9acdd28475e8537 |
Parameters
| Name | Description | Default |
|---|---|---|
host required |
Host to connect to. Example www.example.com |
none |
min-days |
Fail if the certificate has fewer than this many days left. | 14 |
port |
Port to connect to. | 443 |
server-name |
Name to ask for with SNI. Leave blank to use the host. | empty |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: tls-cert-expiry-check
labels:
dagweave.io/catalog-item: tls-cert-expiry-check
annotations:
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "HTTP"
spec:
entrypoint: check
templates:
- name: check
inputs:
parameters:
- name: host
- name: port
default: "443"
- name: server-name
default: ""
- name: min-days
default: "14"
outputs:
parameters:
# Whole days until the certificate expires.
- name: days-left
valueFrom:
path: /tmp/days-left
retryStrategy:
limit: "2"
retryPolicy: OnFailure
backoff:
duration: 10s
factor: "2"
maxDuration: 2m
container:
# alpine/openssl:3.5.9
image: alpine/openssl@sha256:96e53bf9b9041fdc8a33ea61356688506bbddc368c70d6e8a9acdd28475e8537
command: [sh, -c]
args:
- |
set -eu
name="${SERVER_NAME:-${HOST}}"
cert=$(echo | timeout 20 openssl s_client -connect "${HOST}:${PORT}" -servername "${name}" 2>/dev/null | openssl x509) || {
echo "could not read a certificate from ${HOST}:${PORT}" >&2; exit 1; }
not_after=$(printf '%s\n' "${cert}" | openssl x509 -noout -enddate | cut -d= -f2)
end=$(date -u -D '%b %e %H:%M:%S %Y GMT' -d "${not_after}" +%s)
days=$(( (end - $(date -u +%s)) / 86400 ))
echo "${days}" > /tmp/days-left
echo "${HOST}:${PORT} certificate expires ${not_after}, ${days} days from now"
if ! printf '%s\n' "${cert}" | openssl x509 -noout -checkend $(( MIN_DAYS * 86400 )) > /dev/null; then
echo "less than ${MIN_DAYS} days left" >&2; exit 1
fi
env:
- name: HOST
value: "{{inputs.parameters.host}}"
- name: PORT
value: "{{inputs.parameters.port}}"
- name: SERVER_NAME
value: "{{inputs.parameters.server-name}}"
- name: MIN_DAYS
value: "{{inputs.parameters.min-days}}"
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
memory: 256Mi
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.0 latest 2026-10-18
Initial release.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/tls-cert-expiry-check/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/tls-cert-expiry-check \
-p host=www.example.com
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: tls-cert-expiry-check-
spec:
workflowTemplateRef:
name: tls-cert-expiry-check
arguments:
parameters:
- name: host
value: "www.example.com"
As a step of a larger workflow
steps:
- - name: tls-cert-expiry-check
templateRef:
name: tls-cert-expiry-check
template: check