πŸ”’ Monitor PKI certificates & CRLs for expiration with Telegram & SMS alerts

⚑ 70 views Β· πŸ”’ SecOps & Security Automation

Description

PKI Certificate & CRL Monitor - Auto Expiration Alert System

Overview

This n8n workflow provides automated monitoring of Public Key Infrastructure (PKI) components including CA certificates, Certificate Revocation Lists (CRLs), and associated web services. It extracts certificate information from the TSL (Trusted Service List) β€” the Hungarian is the example list as default in the workflow β€” , monitors expiration dates, and sends alerts via Telegram and SMS when critical thresholds are reached.

Features

Setup Instructions

Prerequisites

  1. n8n Instance: Running n8n installation with Linux environment
  2. Telegram Bot: Created via @BotFather
  3. Textbelt API Key: For SMS notifications (optional)
  4. Network Access: To reach TSL source and certificate URLs
  5. Linux Tools: OpenSSL, curl, libxml2-utils, jq (auto-installed)

Configuration Steps

1. Telegram Setup

Create Telegram Bot:

Create Alert Channel:

2. SMS Setup (Optional)

Textbelt Configuration:

3. Configure Alert Nodes

Update these nodes with your credentials:

CRL Alert Node:

CA Alert Node:

Website Down Alert Node:

4. TSL Source Configuration

The workflow defaults to Hungarian TSL:

5. Threshold Configuration

Default warning threshold: 17 hours before expiration

Activation

  1. Save all configuration changes
  2. Test with Execute With Manual Start trigger
  3. Verify alerts are received
  4. Toggle workflow to Active status for scheduled operation

How to Use

Automatic Operation

Once activated, the workflow runs automatically:

Manual Execution

For immediate checks:

  1. Open the workflow
  2. Click Execute With Manual Start node
  3. Click β€œExecute Node”
  4. Monitor execution progress

Understanding Alerts

CRL Expiration Alert

Message Format:

ALERT! with [Issuer CN] !!!CRL EXPIRATION!!! Will be under 17 hour ([Next Update Time])! Last updated: [Last Update Time]

Trigger Conditions:

CA Certificate Alert

Message Format:

ALERT!/EXPIRED! with [Subject CN] !!!CA EXPIRATION PROBLEM!!! The expiration time: ([Not After Date]) Last updated: ([Not Before Date])

Trigger Conditions:

Website Down Alert

Message Format:

ALERT! The [URL] !!!NOT AVAILABLE!!! Service outage probable! Intervention required!

Trigger Conditions:

Monitoring Dashboard

Execution History

Alert History

Check Telegram channel for:

Troubleshooting

No Alerts Received

  1. Check Telegram Bot:

    • Verify bot is admin in channel
    • Test with manual message via API
    • Confirm channel ID is correct
  2. Check Workflow Execution:

    • Review execution logs in n8n
    • Look for error nodes (red indicators)
    • Verify TSL URL is accessible

False Positives

Missing Certificates

Performance Issues

Slow Execution:

Memory Issues:

Advanced Configuration

Modify Check Frequency

Edit Execute With Scheduled Start node:

Add Custom TSL Sources

In Collect Checking URL list node:

URL="https://your-tsl-source.com/tsl.xml"

Customize Alert Messages

Edit alert nodes to modify message templates:

Filter Certificate Types

Modify URL detection patterns:

Adjust Retry Logic

Wait B4 Retry node:

Maintenance

Regular Tasks

Log Management

Updates

Security Considerations

Compliance Notes

Integration Options

Best Practices

  1. Test alerts monthly to ensure delivery
  2. Maintain multiple notification channels
  3. Document response procedures for each alert type
  4. Set up redundant monitoring if critical
  5. Review and tune thresholds based on operational needs
  6. Keep contact lists updated
  7. Consider time zones for global operations

πŸ”— Nodes Used

HTTP Request, Write Binary File, Schedule Trigger

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup