tokentimer

by tokentimerch

Helm chartv0.20.1-beta.pr787.3App 0.20.1-beta.pr787.3Verified publisher

Token, certificate, and secret expiration management for teams

About this chart

TokenTimer Helm Chart

Token, certificate, and secret expiration management for teams.

What This Chart Deploys

ComponentKindPurpose
APIDeployment + ServiceREST API server (Node.js, port 4000)
DashboardDeployment + ServiceReact frontend (nginx, port 80)
Alert DiscoveryCronJobScans tokens and queues expiry alerts
Alert DeliveryCronJobProcesses alert queue, sends notifications
Weekly DigestCronJobSends weekly token-expiry summaries
Endpoint CheckCronJobSSL certificate and health monitoring
Auto SyncCronJobScheduled integration scans
CertOps MaintenanceCronJobLease reaper, stale-agent sweep, nonce/registration-replay sweeps, renewal scheduler
PostgreSQLCloudNativePG ClusterDatabase (optional, can use external)
CertOps ControllerDeploymentOptional cert-manager observation and safe Certificate provisioning

Optional resources (disabled by default): Ingress, HPA, PDB, ServiceMonitor, PrometheusRule, NetworkPolicy.

Prerequisites

  • Kubernetes >= 1.29
  • Helm >= 3.14
  • CloudNativePG operator if using the default in-cluster PostgreSQL (see below), or an existing PostgreSQL instance
  • Prometheus Operator if enabling ServiceMonitor or PrometheusRule
  • cert-manager CRDs (certificates.cert-manager.io and certificaterequests.cert-manager.io) before enabling the CertOps controller

Installing the CloudNativePG operator (optional)

By default, the chart creates a CloudNativePG Cluster to provision PostgreSQL. This requires the CNPG operator to be installed on the cluster beforehand:

helm repo add cnpg https://cloudnative-pg.github.io/charts
helm repo update
helm install cnpg-operator cnpg/cloudnative-pg \
  --namespace cnpg-system --create-namespace \
  --version 0.23.0 \
  --wait

Verify the CRDs are registered:

kubectl get crd clusters.postgresql.cnpg.io

When postgresql.cloudnative.enabled is true (the default), the chart connects to the in-cluster database with DB_SSL=verify and automatically mounts the CA CloudNativePG generates (<release>-pg-ca secret) into the API and worker/cronjob pods at /etc/pg-ssl/ca.crt. No manual TLS setup is required for the default in-cluster database.

If you already have a PostgreSQL instance, skip the operator entirely and point the chart at your database instead:

postgresql:
  cloudnative:
    enabled: false
  external:
    enabled: true
    host: "db.example.com"
    port: 5432
    database: tokentimer
    username: tokentimer
    password: "secret"       # or use existingSecret
    sslMode: require

Quick Start

helm install tokentimer oci://ghcr.io/tokentimerch/charts/tokentimer \
  --namespace tokentimer --create-namespace \
  --set [email protected]

# Port-forward to access locally
kubectl port-forward -n tokentimer svc/tokentimer-api 4000:4000 &
kubectl port-forward -n tokentimer svc/tokentimer-dashboard 8080:80 &

If the admin password was auto-generated, retrieve it with:

kubectl get secret -n tokentimer tokentimer-secrets \
  -o go-template='{{index .data "ADMIN_PASSWORD" | base64decode}}{{println}}'

Open http://localhost:8080 and log in with your admin credentials.

When installing from a local checkout, use ./deploy/helm instead of the OCI URL. The chart declares no subchart dependencies, so there is no helm dependency update step.

TLS Warning: CSRF is always on (CSRF_ENABLED is unused). With NODE_ENV=production (the default), the API also sets the Secure flag on session cookies. Browsers will not persist or send those cookies over plain HTTP, and mutating requests (including login) over http://localhost port-forwards fail with 403 (missing Secure cookie and/or X-CSRF-Token). For local testing, set config.nodeEnv=development (drops the Secure flag), or inject SESSION_COOKIE_SECURE_LOCALHOST_OVERRIDE=true on the API via api.envFrom. For anything beyond local port-forwarding, place HTTPS in front of the API and dashboard (via Ingress with TLS or a reverse proxy).

Configuration Precedence

Several settings can be configured at multiple levels. The app resolves them with a clear precedence (highest wins):

SettingDB (System Settings UI)DB (per-workspace)Env var (Helm values)Code default
SMTP config (including TLS)Fallback--Wins per supplied field; locks UIConfigured defaults
Twilio credentials + SIDsFallback--Wins per supplied field; locks UIDisabled
Alert thresholds--WinsGlobal fallback30,14,7,1,0
Delivery window--WinsGlobal fallback00:00-23:59 UTC
Admin bootstrap----Only sourceSkip if admin exists

Environment-supplied SMTP and Twilio fields override database values and appear locked in System Settings. Workspace alert preferences can override global defaults. See Configuration basics before the exhaustive reference.

Configuration

The chart exposes first-class values for the most common settings (database, SMTP, Twilio, monitoring, ingress). For the full list of environment variables the app supports (rate limits, delivery windows, webhook security, auth tuning, etc.), see the configuration reference.

Operational incident tuning uses positive integers (minimum 1):

worker:
  operationalNotifications:
    emailDailyCap: 10              # delivery and auto-sync workers
    degradedAttemptsThreshold: 5  # delivery worker
    autoSyncCriticalThreshold: 3  # auto-sync worker

These values render the matching worker environment variables. A matching worker.env key is ignored in the delivery or auto-sync CronJob in favor of the first-class value; worker.env remains available for other worker settings.

Any env var not exposed as a dedicated values key can be passed through:

  • api.env / api.envFrom for the API deployment (envFrom ref names support Helm tpl)
  • worker.env / worker.envFrom for all CronJob workers (same tpl behavior)
  • api.extraVolumes / api.extraVolumeMounts for the API
  • worker.extraVolumes / worker.extraVolumeMounts for all workers

The domain checker settings (DOMAIN_CHECKER_*, SUBFINDER_BIN; see docs/CONFIGURATION.md) have no dedicated values keys. Set them on the API only, for example:

api:
  env:
    DOMAIN_CHECKER_TOOL_TIMEOUT_MS: "600000"
    DOMAIN_CHECKER_OVERALL_TIMEOUT_MS: "600000"

Example -- setting delivery window and DB SSL cert for an external PostgreSQL instance on workers (not needed for the default in-cluster CloudNativePG database, whose CA is mounted automatically):

worker:
  env:
    DELIVERY_WINDOW_DEFAULT_START: "08:00"
    DELIVERY_WINDOW_DEFAULT_END: "18:00"
    DELIVERY_WINDOW_DEFAULT_TZ: "Europe/Zurich"
    PGSSLROOTCERT: /etc/pg-ssl/ca.crt
  extraVolumes:
    - name: pg-ca
      secret:
        secretName: my-pg-ca-cert
  extraVolumeMounts:
    - name: pg-ca
      mountPath: /etc/pg-ssl
      readOnly: true

Secrets Management

The chart generates a Kubernetes Secret with auto-generated values for SESSION_SECRET, DB_PASSWORD, ADMIN_PASSWORD (when adminEmail is set), and, when CertOps is enabled, CERTOPS_SIGNING_ENCRYPTION_KEY and CERTOPS_REGISTRATION_ENCRYPTION_KEY.

Generated values are not regenerated on upgrade: each is read back from the existing release Secret via lookup, so helm upgrade preserves them. Set them explicitly if you manage secrets externally, or if you render manifests with helm template (which runs without cluster access and therefore cannot read the existing Secret back, producing a fresh value on every render).

CertOps encryption keys

config.certopsEnabled defaults to true, and the API fails closed without these two keys: agent registration and signed job dispatch reject with CERTOPS_REGISTRATION_ENCRYPTION_KEY_MISSING / CERTOPS_SIGNING_ENCRYPTION_KEY_MISSING. Each must be 64 hex characters (32 bytes):

openssl rand -hex 32
config:
  certopsSigningEncryptionKey: "<64 hex chars>"
  certopsRegistrationEncryptionKey: "<64 hex chars>"
  • CERTOPS_SIGNING_ENCRYPTION_KEY wraps the stored job-signing private keys. Preserve the matching key; replacing it alone makes those records unreadable. Operational signing-key rotation does not rotate this wrapping key; replacing it requires a separate encrypted-record migration.
  • CERTOPS_REGISTRATION_ENCRYPTION_KEY wraps only short-lived registration-replay credentials for lost-response recovery. Changing it can invalidate outstanding replay recovery. Existing enrolled-agent credentials are stored as hashes, so this does not inherently require the fleet to re-register.

Back up both matching values and set them explicitly in GitOps or helm template workflows.

For production, use pre-existing secrets instead of setting plaintext values:

config:
  existingSecret: "my-tokentimer-secrets"  # must contain SESSION_SECRET; also
                                           # CERTOPS_SIGNING_ENCRYPTION_KEY and
                                           # CERTOPS_REGISTRATION_ENCRYPTION_KEY
                                           # when CertOps is enabled; optionally
                                           # WEEKLY_DIGEST_RECIPIENT_KEY

postgresql:
  external:
    existingSecret: "my-db-secret"         # all DB_* keys

smtp:
  existingSecret: "my-smtp-secret"         # all SMTP_* + FROM_* keys

twilio:
  existingSecret: "my-twilio-secret"       # credential/SID TWILIO_* keys
                                           # (limiter knobs are ConfigMap
                                           # first-class keys, not required
                                           # in this secret)

When existingSecret is set for a group, the chart renders no credential keys for that group in the ConfigMap or generated Secret, so the existing secret becomes the single source of truth with no empty-value conflicts. Twilio inbound limiter knobs (twilio.webhookRateLimitWindowMs / twilio.webhookRateLimitMax) still render into the ConfigMap when set, even if twilio.existingSecret is set.

Corporate Proxy

Self-hosted deployments behind a corporate proxy can make the API's fetch/undici calls (e.g. the webhook Test button, OAuth/SAML callbacks) and the worker's axios calls honor HTTP_PROXY/HTTPS_PROXY/NO_PROXY. config.useEnvProxy sets NODE_USE_ENV_PROXY=1 on the API and worker, and also sets NODE_OPTIONS=--disable-warning=UNDICI-EHPA, silencing Node's own experimental-feature warning for EnvHttpProxyAgent.

Proxy URLs commonly embed credentials (http://user:pass@proxy:3128), so this chart intentionally has no plaintext proxy URL value. Point config.useEnvProxy at an existing Secret instead:

config:
  useEnvProxy: true
  proxyExistingSecret: "my-proxy-credentials"  # must contain HTTP_PROXY, HTTPS_PROXY
  noProxy: "internal.example.com"              # extra NO_PROXY entries (optional)

config.proxyExistingSecret is required when config.useEnvProxy=true (the chart fails the render otherwise, naming proxyExistingSecret) since the flag alone does nothing without proxy URLs. config.noProxy is always combined with localhost, 127.0.0.1, ::1, the in-cluster API service hostname, and .svc/.cluster.local, so intra-cluster API calls never accidentally route through the proxy.

Changing which Secret is referenced by proxyExistingSecret (or first enabling useEnvProxy) triggers a rolling restart via checksum/secret, like any other Helm value change, since that's a change to the rendered manifest. Updating the data inside an existing, externally-managed Secret (e.g. rotating the proxy password) does not: checksum/secret only hashes the Secret's name, not its contents. Pick up rotated credentials for the API Deployment with:

kubectl rollout restart deployment/<release>-tokentimer-api -n <namespace>

The worker CronJobs need no equivalent restart: each scheduled run starts a fresh Pod that reads the Secret's current data, so a rotated value takes effect on the next trigger automatically. Also sufficient: a helm upgrade (bumps .Release.Revision, which restarts the API via checksum/helm-release-revision regardless of whether any value changed), or an external Secret-reloader controller (e.g. Stakater Reloader) watching the Secret named in proxyExistingSecret.

Proxy env vars are injected into the API Deployment and all worker CronJobs. The optional CertOps controller and the dashboard are deliberately excluded: the dashboard serves static assets with no outbound calls, and the controller talks only to the Kubernetes API and the TokenTimer API (certops.controller.api.url), which are normally in-cluster. If you point certops.controller.api.url at an external TokenTimer API that is only reachable through the proxy, route that traffic at the network layer instead; the controller does not read HTTP_PROXY/HTTPS_PROXY.

When networkPolicy.enabled is also true, egress to the proxy is closed by default like every other destination. Open it with:

networkPolicy:
  egress:
    proxyCidrs:
      - 10.0.0.0/8      # the proxy's destination CIDR(s)
    proxyPorts:
      - 3128

This rule only renders when config.useEnvProxy=true. When it is, networkPolicy.egress.proxyCidrs and networkPolicy.egress.proxyPorts are both required and validated (proxyPorts entries must be integers 1-65535) as soon as networkPolicy.enabled=true -- the chart fails the render naming whichever is missing, rather than silently rendering a NetworkPolicy that blocks the proxy it was just told to use. The default proxyPorts (3128, 8080) opens both

Deploy tokentimer with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tokentimer on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttokentimer is pinned at v0.20.1-beta.pr787.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply