> ## Content Index
> Fetch the complete content index at: https://corelab.tech/llms.txt
> Use this file to discover other available public pages before exploring further.

# Hardening SWAG: How I Killed Default Server Fingerprinting and Subdomain Leaks
- URL: https://corelab.tech/hardening-swag-reverse-proxy-fingerprinting/
- Published: 2026-11-17T14:58:03.000Z
- Updated: 2026-11-17T15:03:27.000Z
- Description: How I audited my live LinuxServer SWAG reverse proxy, eliminated default server reconnaissance with HTTP 444, locked down wildcard subdomain leakage, and blocked scraping bursts at the edge.
- Author: Core Lab Joe
- Tags: SWAG, Reverse Proxy, Networking, Cybersecurity, #table-of-content

Setting up **SWAG** (Secure Web Access Gateway by LinuxServer.io) is one of the cleanest, most efficient ways to deploy NGINX, automated Certbot TLS certificates, and CrowdSec intrusion prevention inside Docker. 

> With a single Docker Compose stack, you gain an enterprise-grade reverse proxy capable of routing dozens of containerised services across multiple domains.

However, out of the box, default configurations are designed for convenience and quick onboarding, not zero-trust edge defence. If you leave SWAG's default templates untouched, your reverse proxy broadcasts *subtle architectural fingerprints* to every automated port scanner, Shodan crawler, and opportunistic bot that probes your public IP address.

In this guide, I document the exact audit and hardening pipeline I implemented on my production homelab gateway. We will eliminate default server reconnaissance using NGINX's non-standard `HTTP 444` instruction, isolate private homelab services from public blog traffic, terminate referer spam at the wire before it touches backend applications, and modernize our cryptographic cipher suite with hybrid post-quantum key exchange.

Learning Path • Reverse Proxy & Ingress 

### Mastering Reverse Proxies with SWAG 

Deploy SWAG in Docker, configure Let's Encrypt certificates, harden NGINX against scanner leaks, integrate centralized Authelia MFA, and enforce Layer 7 CrowdSec AppSec (WAF) defence. 

Lesson 3 of 6 50% Complete 

Difficulty Curve Intermediate 

Beginner Advanced 

[ ✓ Lesson 01 · Foundations Completed What is a Reverse Proxy? Why Every Homelab Needs One → ](https://corelab.tech/what-is-a-reverse-proxy/) [ ✓ Lesson 02 · Core Deployment Completed Self-Hosting SWAG: Deploying Your Reverse Proxy in Docker → ](https://corelab.tech/swag-reverse-proxy-guide/) 

03 

Lesson 03 · Zero-Trust Ingress Current Lesson 

Hardening SWAG: How I Killed Default Server Fingerprinting and Subdomain Leaks 

[ 04 Lesson 04 · Identity & MFA Authelia: Centralized MFA for Self-Hosted Services → ](https://corelab.tech/authelia-mfa-swag-setup/) [ 05 Lesson 05 · Threat Defence CrowdSec & Fail2Ban: Real-Time Threat Defence for SWAG → ](https://corelab.tech/crowdsec-fail2ban-swag-hardening/) [ 06 Lesson 06 · Application Security How to Deploy CrowdSec AppSec (WAF) with SWAG in Docker → ](https://corelab.tech/crowsec-waf-swag-docker/) 

Tested in production on Linux & Docker CE 

Core Lab Learning Track · Zero Tracking & Direct Implementation 

---

---

## 1\. The Reconnaissance Goldmine: The Default Landing Page

When you first deploy SWAG, its main server block in `site-confs/default.conf` binds to `server_name _;`. This catch-all server block directs any unmatched hostname, unmapped subdomain, or direct IP hit on port 443 to serve files out of `/config/www`.

In that webroot sits a pre-installed HTML document: `index.html`. If an automated scanner hits your public IP or tries guessing subdomains (e.g. `https://vpn.yourdomain.com`, `https://test.yourdomain.com`, or `https://pve.yourdomain.com`), SWAG politely replies with an HTTP 200 OK and renders:

> **"Welcome to your SWAG instance"**  
> *"A webserver and reverse proxy solution brought to you by linuxserver.io with php support and a built-in Certbot client..."* 

Reconnaissance Risk What an Attacker Learns from the Default Page 

1. **Software Stack Identification:** It confirms the exact container base image (LinuxServer SWAG), broadcasting that NGINX, Certbot, and PHP-FPM are present on the host.
2. **Active Proxy Confirmation:** It verifies that an active reverse proxy is listening and forwarding, separating your IP from unconfigured or dormant cloud VPS hosts.
3. **Attack Surface Vectoring:** It invites dictionary attacks against standard reverse-proxy paths, default admin endpoints, and upstream application templates.

#### Default Server Fingerprinting: Default SWAG vs. Hardened Edge

| Evaluation Vector         | Default SWAG Behaviour                      | Hardened Core Lab Edge                   |
| ------------------------- | ------------------------------------------- | ---------------------------------------- |
| HTTP Response Status      | HTTP/2 200 OK                               | HTTP 444 (Drop / TCP Reset)              |
| Wire Data Transferred     | 1,345 bytes HTML + Headers                  | **0 bytes (Instant TCP RST / FIN)**      |
| Server Banner Disclosure  | Explicit "Welcome to SWAG / linuxserver.io" | **Zero Banners, Zero Response Headers**  |
| Direct IP Access Handling | Renders default landing page                | **Terminated immediately (0ms compute)** |
| Backend Workload          | Allocates NGINX buffers, reads webroot disk | **Zero disk I/O, zero socket queue**     |

## 2\. Weaponizing HTTP 444 to Vanish from Scanners

Standard HTTP response codes like `403 Forbidden` or `404 Not Found` still require NGINX to allocate response buffers, format HTTP response headers, send a `Server: nginx` header, and close the TCP connection gracefully. To a scanner, a 403 or 404 confirms that a web server is alive and actively listening.

NGINX features a proprietary, non-standard status code: **HTTP 444**. When NGINX encounters `return 444;`, it instructs the kernel to close the underlying TCP socket immediately without writing a single header or byte to the wire. In HTTP/1.1, the client receives a TCP reset packet (`RST`) or immediate FIN. In HTTP/2, NGINX sends an immediate stream teardown (`PROTOCOL_ERROR`).

By restructuring `/docker/containers/edge/swag/nginx/site-confs/default.conf`, we can strip the default webroot entirely and transform the catch-all server block into a silent black hole for unauthorized probes:

NGINX / SWAG site-confs/default.conf 

Zero-Trust Edge Copy Code 

```
# ==============================================================================
# HTTP (Port 80): Global Canonical Upgrade to HTTPS
# ==============================================================================
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    location / {
        return 301 https://$host$request_uri;
    }
}

# ==============================================================================
# HTTPS (Port 443): Catch-All Black Hole (Drops All Unmapped Hosts & Direct IPs)
# ==============================================================================
server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    server_name _;

    # Include hardened TLS ciphers, HSTS, and post-quantum curves
    include /config/nginx/ssl.conf;

    # Drop all unmapped subdomains, scanning probes, and direct IP requests
    return 444;
}

# Include all valid, explicitly mapped proxy configurations
include /config/nginx/proxy-confs/*.subdomain.conf;
```

Because legitimate services (such as `corelab.tech` or `jf.yourdomain.com`) are declared with explicit `server_name` directives in their dedicated configuration files, NGINX routes valid requests to the proper backend. Any request targeting an unregistered subdomain or directly probing port 443 via IP hits `server_name _;` and is instantly severed.

Here is the real-world terminal telemetry when probing a non-existent subdomain on the hardened gateway:

$ curl -I -k --resolve unmapped-probe.yourdomain.com:443:10.0.0.4 https://unmapped-probe.yourdomain.com  
curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL\_ERROR (err 1)  
\# Direct TCP connection closed immediately. Zero bytes received. Exit code 92. 

## 3\. The Wildcard Subdomain Trap and Multi-Domain Isolation

Many upstream SWAG sample templates use a convenient shorthand in their server definitions:

```nginx
server_name jellyfin.*;
```

While convenient for a single-domain homelab, this wildcard matching introduces a severe architectural vulnerability when your SWAG instance manages multiple domains (for instance, a public brand like `corelab.tech` and a private management zone like `private-homelab.com`).

If your Let's Encrypt certificate covers both domains, `server_name jellyfin.*;` instructs NGINX to answer on *both* `jellyfin.private-homelab.com` and `jellyfin.corelab.tech`. Your private homelab services inadvertently leak onto your public domain space.

### Multi-Domain Perimeter Hardening

Strict separation between public content, private homelab micro-services, and scanner drops

Perimeter 1: Public Core Lab Surface PUBLIC INGRESS 

- Allowed Endpoints: Strictly limited to `corelab.tech`, `analytics.corelab.tech`, and `status.corelab.tech`.
- Catch-All Guardrail: Any unmapped `*.corelab.tech` subdomain is dropped immediately with HTTP 444.

↓

Perimeter 2: Private Homelab Infrastructure AUTHELIA PROTECTED 

- Explicit FQDNs: Every private service is explicitly anchored to `*.private-homelab.com` (e.g. `jf.private-homelab.com`, `obs.private-homelab.com`).
- Identity Governance: Authelia intercepts requests via forward auth subrequests; zero unauthenticated traffic reaches internal containers.

↓

Perimeter 3: The Scanner Void (Catch-All) HTTP 444 BLACK HOLE 

- Unmapped Hosts & IPs: Any request missing an exact FQDN match is instantly dropped at the socket layer.
- Zero Reconnaissance: Shodan and Censys crawlers record a dead host with 0 bytes transferred.

### The Authelia HTTP 500 Authentication Cascade

Beyond information leakage, wildcard subdomain matching creates an insidious operational bug if you use modern identity providers like **Authelia v4.38+**.

Authelia enforces strict session cookie isolation based on its configured root domain (e.g. `domain: 'private-homelab.com'`). When NGINX executes an auth subrequest via `authelia-server.conf`, Authelia verifies that the requested host matches its authorized domain tree.

If an internal service is configured with `server_name app.*;`, a hit on `app.corelab.tech` routes to NGINX's auth block. NGINX submits the auth subrequest to Authelia, but Authelia immediately rejects it with `400 Bad Request: unauthorized domain`. NGINX intercepts this 400 error during its internal auth subrequest and translates it into a catastrophic **HTTP 500 Internal Server Error** back to the client.

By enforcing fully qualified domain names across all proxy configurations (e.g., `server_name app.private-homelab.com;` instead of `app.*;`), cross-domain leakage and Authelia 500 auth cascades are completely eradicated.

flowchart TD
    subgraph INGRESS ["Internet Ingress Traffic"]
        A["Client / Scanner Request"]
    end

    subgraph SWAG ["SWAG NGINX Edge (10.0.0.4)"]
        B{"SNI / Host Header Match?"}
        C["Public VHost: corelab.tech"]
        D["Public VHost: analytics.corelab.tech"]
        E["Private VHost: *.private-homelab.com"]
        F["Default Server: server_name _"]
    end

    subgraph BACKEND ["Homelab Internal Stacks"]
        G["Ghost CMS (10.0.0.34:2368)"]
        H["Umami v2 (10.0.0.72:3000)"]
        I["Authelia Auth Gateway (10.0.0.9:9091)"]
        J["Internal Services (Jellyfin, Immich, etc.)"]
        K["HTTP 444 Black Hole: Connection Severed"]
    end

    A --> B
    B -->|"corelab.tech"| C
    B -->|"analytics.corelab.tech"| D
    B -->|"*.private-homelab.com"| E
    B -->|"Unmapped Host or Direct IP"| F

    C --> G
    D --> H
    E --> I
    I -->|"Session Valid (200 OK)"| J
    F --> K

    style A fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#f8fafc
    style B fill:#1e293b,stroke:#06b6d4,stroke-width:2px,color:#f8fafc
    style C fill:#0f172a,stroke:#38bdf8,stroke-width:1px,color:#f8fafc
    style D fill:#0f172a,stroke:#38bdf8,stroke-width:1px,color:#f8fafc
    style E fill:#0f172a,stroke:#10b981,stroke-width:1px,color:#f8fafc
    style F fill:#334155,stroke:#f87171,stroke-width:2px,color:#f8fafc
    style G fill:#020617,stroke:#38bdf8,stroke-width:1px,color:#f8fafc
    style H fill:#020617,stroke:#38bdf8,stroke-width:1px,color:#f8fafc
    style I fill:#020617,stroke:#10b981,stroke-width:1px,color:#f8fafc
    style J fill:#020617,stroke:#10b981,stroke-width:1px,color:#f8fafc
    style K fill:#450a0a,stroke:#f87171,stroke-width:2px,color:#fca5a5

## 4\. Scraping Defence at Ingress: Killing Referer Spam at the Wire

Every homelab and independent publication eventually encounters scraping bursts and referer spam bots. These automated scrapers bombard your site with forged `Referer` headers (such as `aocr.org` or low-reputation SEO farms) hoping their links appear in your public analytics dashboards or access logs.

If you route traffic through Cloudflare, the obvious response is to write a Custom WAF Rule. However, on Cloudflare's Free tier, you are strictly capped at **5 Custom Rules** across your entire zone. When those five rule slots are already committed to critical security logic, you cannot spend rules on individual spam referers.

The solution is to filter referer spam directly inside SWAG at the NGINX ingress layer. By defining a global referer evaluation map in `/docker/containers/edge/swag/nginx/nginx.conf`, we evaluate the `$http_referer` header during the initial HTTP request parsing:

```nginx
# Inside nginx.conf (http block)
map $http_referer $bad_referer {
    default 0;
    "~*aocr\.org" 1;
    "~*semalt\.com" 1;
}
```

Then, inside `/docker/containers/edge/swag/nginx/ssl.conf`, which is included globally across every active server block, we terminate the request before it reaches upstream proxies:

```nginx
# Inside ssl.conf
if ($bad_referer) {
    return 444;
}
```

#### Why Reverse Proxy Ingress Filtering Wins Over App-Level Middleware

- **Zero CPU/RAM Allocation on Backends:** The request never reaches Node.js (Ghost CMS), PHP, Python, or PostgreSQL. Application runtimes never wake up.
- **Clean Analytics Data:** Because the TCP connection is severed with 444 before HTML or client-side JavaScript is sent, tracking scripts (like Umami) never fire.
- **Unlimited Rule Capacity:** Unlike cloud edge quotas, NGINX hash maps handle tens of thousands of regex entries with sub-millisecond lookup times and zero performance penalty.

## 5\. Cryptographic Hardening: Post-Quantum ML-KEM and Cipher Pruning

In mid-2026, the LinuxServer.io SWAG upstream base image transitioned from the legacy Mozilla Intermediate Guideline v5.7 to the **TLSRef Guideline v6.0** (OpenSSL 3.5.7). This update introduced two vital cryptographic upgrades:

### 1\. Hybrid Post-Quantum Key Exchange (ML-KEM)

Modern adversaries employ a strategy known as *"Harvest Now, Decrypt Later"*: capturing encrypted TLS traffic traversing the internet today, storing it in data centres, and holding it until quantum computers are powerful enough to break classical elliptic-curve Diffie-Hellman (ECDH) key exchange.

The upgraded `ssl.conf` specification incorporates the **X25519MLKEM768** hybrid curve. This pairs standard classical Curve25519 with the NIST-standardized Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM / Kyber-768). Supported by modern Chromium and Firefox browsers, the handshake is protected by both classical and quantum-resistant mathematics simultaneously.

### 2\. Pruning Obsolete DHE Ciphers and Eliminating DHParams

Older reverse proxy configurations commonly included legacy Diffie-Hellman ephemeral ciphers (`DHE-RSA-*`). These required maintaining a pre-computed 2048-bit parameter file (`dhparams.pem`), which consumed significant CPU cycles during container startup and added handshake overhead.

Because modern TLS 1.2 and TLS 1.3 clients uniformly support Elliptic Curve Diffie-Hellman (ECDHE), all legacy DHE ciphers and the `ssl_dhparam` directive have been completely pruned. Handshake latency is reduced, and legacy fallback attacks are eliminated.

CRYPTOGRAPHY nginx/ssl.conf (TLSRef v6.0 Standard) 

```
## TLSRef Guideline v6.0 (OpenSSL 3.5.7, NGINX 1.30+)
ssl_protocols TLSv1.2 TLSv1.3;

# Post-quantum hybrid curve enabled alongside classical P-256 and P-384
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;

# Pure ECDHE cipher suite (Legacy DHE ciphers pruned)
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers off;

# Session Cache tuning (10m holds ~40,000 sessions)
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;

# Strict Security Headers & HTTP/3 Advertisement
add_header Strict-Transport-Security "max-age=63072000" always;
add_header Content-Security-Policy "upgrade-insecure-requests; frame-ancestors 'self'" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Alt-Svc 'h3=":443"' always;
```

## 6\. Live Verification Suite: Real-World CLI Testing

Never assume an NGINX reload applied your security policies as expected. Always execute comprehensive end-to-end verification across both positive (allowed) and negative (blocked) vectors:

### Test 1: Verify the HTTP 444 Drop on Unmapped Subdomains

$ curl -I -k --resolve pve.yourdomain.com:443:10.0.0.4 https://pve.yourdomain.com  
curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL\_ERROR (err 1)  
\# Verified: No HTTP response headers, no HTML body, 0 bytes transferred. 

### Test 2: Verify Direct IP Probes are Severed

$ curl -k -s -o /dev/null -w "%{http\_code}" https://10.0.0.4  
000  
\# Verified: curl received 000 (socket severed before handshake completion). 

### Test 3: Verify Malicious Referer Filtering

$ curl -I -k --resolve corelab.tech:443:10.0.0.4 -H "Referer: https://www.aocr.org/spam" https://corelab.tech  
curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL\_ERROR (err 1)  
\# Verified: Malicious referer killed at NGINX boundary before reaching Ghost CMS. 

### Test 4: Verify Valid Production Traffic

$ curl -I https://corelab.tech  
HTTP/2 200  
strict-transport-security: max-age=63072000  
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self'  
alt-svc: h3=":443"  
\# Verified: Legitimate public traffic answers cleanly with full security headers and HTTP/3. 

## 7\. Architectural Takeaways and Rules of Engagement

Your reverse proxy is the front door of your homelab infrastructure. In an era of automated, continuous internet-wide scanning, it should act as an invisible, silent filter rather than a friendly informational kiosk.

#### Core Edge Defence Blueprint

1. **Never Leave Default Server Webroots Intact:** Replace `server_name _;` landing pages with an unconditional `return 444;`. Never disclose your underlying container image, proxy technology, or operating system.
2. **Eliminate Wildcard Subdomain Shorthand:** If you manage multiple domains on a shared reverse proxy, explicitly define `server_name app.domain.com;`. Never rely on `app.*;` unless you explicitly intend for the service to be reachable across every domain in your certificate.
3. **Drop Unwanted Ingress at Layer 7 Ingress:** Use NGINX hash maps (`map $http_referer`) to drop scrapers and referer bots at the wire with HTTP 444 before backend application servers (Node.js, Python, PHP) allocate memory.
4. **Embrace Post-Quantum Hybrid Standards:** Transition your cipher suites to TLSRef v6.0 and activate `X25519MLKEM768` to safeguard long-lived encrypted communications against future quantum decryption.

Next in Edge Security Continue Building Your Zero-Trust Perimeter 

Hardening SWAG with HTTP 444 and strict SNI routing is only the first layer of edge defence. To see how I paired this gateway setup with progressive multi-tiered intrusion remediation to neutralize high-frequency scanners and botnets, check out my companion deep-dive on [How an Aggressive 120MB Bot Attack Exposed My CrowdSec Ban Flaws](https://corelab.tech/crowdsec-repeat-offenders-ban-escalation-guide/). 

For the broader network architecture anchoring this gateway on symmetrical gigabit fiber, explore [Why I Host My Website at Home](https://corelab.tech/why-i-host-my-website-at-home/), or browse the [Core Lab Hardware Store](https://corelab.tech/shop/) for tested enterprise NICs, switches, and mini-PC firewall appliances.