# SSL & Security Headers Audit: TLS cert, HSTS, CSP, grade (`sea_sorghum/ssl-security-headers-audit`) Actor

Bulk-audit TLS certificate (issuer, expiry, protocol, chain) and HTTP security headers (HSTS, CSP, X-Frame-Options). Get a 0-100 score, A-F grade and fixes.

- **URL**: https://apify.com/sea_sorghum/ssl-security-headers-audit.md
- **Developed by:** [Bader Aloqily](https://apify.com/sea_sorghum) (community)
- **Categories:** Developer tools, SEO tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SSL & Security Headers Audit – TLS Certificate, HSTS, CSP Grader

Audit the **TLS/SSL certificate** and **HTTP security headers** of any list of websites in one run. Every site gets a **0–100 score, an A–F grade, a list of problems and plain-English fixes**. Use it as a bulk **SSL certificate checker**, **certificate expiry monitor**, **security headers scanner** and **HSTS / CSP checker** for agencies, MSPs, security teams and DevOps.

No login, no browser, no proxy, no API key. It makes one TLS handshake and one HTTPS request per site, so runs are fast and cheap.

### What you get for every site

- **Certificate:** issuer, subject, SAN list, valid-from and valid-to, **days until expiry**, key type and size, serial number, SHA-256 fingerprint, hostname match.
- **TLS:** negotiated protocol (TLS 1.3 / 1.2 / older), cipher, **certificate chain trust** and the chain itself.
- **Security headers:** `Strict-Transport-Security` (max-age, includeSubDomains, preload), `Content-Security-Policy` (unsafe-inline, unsafe-eval, wildcards), `X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`, `Permissions-Policy`, COOP / CORP / COEP, and version leaks in `Server` / `X-Powered-By`.
- **HTTP to HTTPS redirect** check (port 80).
- **Score, grade, issues (high/medium/low) and recommended fixes.**

### Use cases

- **Certificate expiry monitoring** across a client portfolio (schedule the Actor daily).
- Agency or MSP **security reports** and prospect audits.
- Find sites with **missing HSTS or CSP**, expired or mismatched certificates.
- Compliance checks before launches and penetration tests.

### Input

| Field | Description | Default |
| --- | --- | --- |
| `urls` | Domains or URLs (private and internal addresses are rejected) | required |
| `checkHttpRedirect` | Check http:// redirects to https:// | true |
| `maxUrls` | Cap per run (also caps cost) | 500 |
| `concurrency` | Parallel sites | 8 |

```json
{ "urls": ["github.com", "https://www.example.org/login", "yourclient.com"] }
```

### Output (one item per site)

```json
{
  "host": "github.com", "score": 94, "grade": "A",
  "tls": { "protocol": "TLSv1.3", "chainTrusted": true,
           "certificate": { "issuer": "Sectigo Limited", "daysUntilExpiry": 42, "sanCount": 2 } },
  "headers": { "hsts": { "maxAge": 31536000, "includeSubDomains": true }, "xContentTypeOptions": "nosniff" },
  "issues": [], "recommendations": []
}
```

Download as JSON, CSV or Excel, or call it through the Apify API.

### Notes

- Sites that cannot complete a TLS handshake (no HTTPS, DNS failure, timeout) are listed in the `ERRORS` record and are **not charged**.
- Only publicly reachable hosts are scanned. The Actor performs passive checks (one handshake, one GET), not vulnerability scanning.
- Redirect check can show `null` if port 80 is unreachable.

### Pricing

Pay per event: you are charged per **site audited** (one result each), plus a tiny start fee.

# Actor input Schema

## `urls` (type: `array`):

Domains or URLs to audit (for example example.com or https://example.com/login). Private and internal addresses are rejected.

## `checkHttpRedirect` (type: `boolean`):

Request http://host/ on port 80 and check it redirects to HTTPS.

## `maxUrls` (type: `integer`):

Upper bound on sites audited per run. This also caps your cost.

## `concurrency` (type: `integer`):

Sites audited in parallel.

## Actor input object example

```json
{
  "urls": [
    "github.com",
    "example.com",
    "expired.badssl.com"
  ],
  "checkHttpRedirect": true,
  "maxUrls": 500,
  "concurrency": 8
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "github.com",
        "example.com",
        "expired.badssl.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sea_sorghum/ssl-security-headers-audit").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "github.com",
        "example.com",
        "expired.badssl.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("sea_sorghum/ssl-security-headers-audit").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "github.com",
    "example.com",
    "expired.badssl.com"
  ]
}' |
apify call sea_sorghum/ssl-security-headers-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sea_sorghum/ssl-security-headers-audit"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/KYgjwqgBswjZ09j6s/builds/u13TydmxWN4vN2Zj3/openapi.json
