AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

strict_sni_check not persisted by POST /control/tls/configure API

Open saugatadatta opened this issue 7 months ago • 4 comments

Prerequisites

Platform (OS and CPU architecture)

Linux, ARMv7

Installation

Docker

Setup

On one machine

AdGuard Home version

v0.107.73

Action

Prerequisites

  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I want to report a bug and not ask a question

Environment

  • AdGuard Home version: v0.107.73
  • Operating system: Ubuntu 22.04 (Docker container)
  • CPU architecture: ARM64 (Hetzner CAX21) / x86_64 (Azure)
  • Installation method: Docker

Problem Description

strict_sni_check is documented in the OpenAPI schema as a field of TlsConfig, accepted by POST /control/tls/configure and returned by GET /control/tls/status. However, when sent via the API, the field is neither persisted to AdGuardHome.yaml nor reflected in the subsequent GET /control/tls/status response.

Steps to Reproduce

1. Check current value via status API:

curl -s -u "user:pass" \
  https://your-agh-host/control/tls/status | jq '.strict_sni_check'
# Returns: null

2. Send tls/configure with strict_sni_check: true:

curl -s -u "user:pass" \
  -X POST https://your-agh-host/control/tls/configure \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "server_name": "doh.example.com",
    "force_https": true,
    "port_https": 443,
    "port_dns_over_tls": 853,
    "certificate_chain": "<base64>",
    "private_key": "<base64>",
    "strict_sni_check": true
  }' | jq '.strict_sni_check'
# Returns: null

3. Verify it was not persisted:

curl -s -u "user:pass" \
  https://your-agh-host/control/tls/status | jq '.strict_sni_check'
# Returns: null

grep strict_sni_check /path/to/AdGuardHome.yaml
# Returns: strict_sni_check: false

Expected result

strict_sni_check: true sent via POST /control/tls/configure should:

  1. Be persisted to AdGuardHome.yaml
  2. Take effect immediately (connections with non-matching SNI rejected)
  3. Be returned as true by GET /control/tls/status

Actual result

  • GET /control/tls/status returns null for strict_sni_check
  • POST /control/tls/configure accepts the field without error (HTTP 200) but silently ignores it
  • AdGuardHome.yaml always shows strict_sni_check: false after any API call to tls/configure
  • The field can only be set by manually editing AdGuardHome.yaml and restarting the service

Additional information and/or screenshots

Impact

Users automating certificate renewal via the API (a common pattern for Let's Encrypt renewals) cannot maintain strict_sni_check: true persistently. Every API call to tls/configure silently resets it to false, removing SNI-based connection filtering without any warning.

This is confirmed by the existing issue #1484 (filed in 2020) which reported the same reset behaviour via the GUI. The root cause appears unchanged — strict_sni_check is not included in the API handler's config mapping even though it exists in the OpenAPI schema.

References

  • Issue #1484 — strict_sni_check reset via GUI save (2020, same root cause)
  • OpenAPI schema TlsConfig — field documented but not handled
  • Wiki: https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration

Suggested Fix

Include strict_sni_check in the POST /control/tls/configure request handler so it is read from the payload and written to the configuration, matching the behaviour of all other TlsConfig fields.

saugatadatta avatar Apr 05 '26 15:04 saugatadatta

@iAmSaugata, hello and thanks for the report. Actually, the strict_sni_check field doesn't exist within the TlsConfig schema object or any other object in the OpenAPI specification. However, you are right that its value should persist regardless of API calls. It seems like the bug from #1484 has arisen again. We're working on the fix.

EugeneOne1 avatar Apr 06 '26 10:04 EugeneOne1

@iAmSaugata, hello again. The fix is available in the latest edge release (v0.108.0-a.1274+bb189854), could you please check that the strict_sni_check setting is not being overwritten anymore?

EugeneOne1 avatar Apr 08 '26 12:04 EugeneOne1

@iAmSaugata, hello again. We'll close the issue for now. Please feel free to reopen it if the problem reappears.

EugeneOne1 avatar Apr 14 '26 12:04 EugeneOne1

I will verify.

saugatadatta avatar Apr 14 '26 13:04 saugatadatta