DNS and DoH

Summary

Smithproxy parses DNS traffic to populate name/address state, support FQDN policy objects and apply DNS ALG behavior. It also detects DNS-over-HTTPS inside inspected HTTP traffic. DNS inspection is policy-driven; it is not a replacement for a recursive resolver.

Resolver settings

settings.nameservers supplies upstream resolvers used by Smithproxy for tasks such as SOCKS hostname resolution and FQDN object updates:

settings = {
    nameservers = [ "192.0.2.53", "2001:db8::53" ];
};

Invalid entries produce configuration events. If the list is empty, current code falls back to 1.1.1.1; configure resolvers explicitly so behavior does not depend on that fallback.

DNS policy

A DNS policy typically matches UDP port 53 and selects an ALG profile:

policy = (
  {
    name = "inspect DNS";
    proto = "udp";
    src = [ "lab", "lab6" ];
    sport = [ "all" ];
    dst = [ "any", "any6" ];
    dport = [ "dns" ];
    action = "accept";
    nat = "auto";
    alg_dns_profile = "dns_strict";
  }
);
alg_dns_profiles = {
    dns_strict = {
        match_request_id = TRUE;
        randomize_id = TRUE;
        cached_responses = TRUE;
    };
};

Cache and domain tree

The DNS cache maps observed names and addresses. The domain tree tracks subdomains used by FQDN matching and optional TLS SNI bypass lookups.

diag dns cache stats
diag dns cache list
diag dns domain list

Clearing state changes future policy/SNI-bypass decisions:

diag dns cache clear
diag dns domain clear

Use clears only when stale state is confirmed. Cache churn can temporarily reduce the effectiveness of FQDN policies.

FQDN address objects

address_objects = {
    example_service = {
        type = "fqdn";
        value = "example.com";
    };
};

FQDN policies depend on observed/resolved address state. Shared hosting, CDNs and short TTLs mean an IP match is not proof that every connection to that IP belongs to the configured name. Prefer TLS SNI and application metadata when available.

DNS over HTTPS

DoH is visible only when Smithproxy can inspect the HTTP payload. The HTTP engine recognizes supported DoH content types and processes DNS responses for cache/name state. If TLS is bypassed, pinned or otherwise not decrypted, Smithproxy cannot parse the enclosed DNS message.

DoH visibility therefore depends on:

  • a matching TLS-intercept policy;
  • successful upstream and downstream TLS handshakes;
  • enabled HTTP engine/detection processing;
  • a supported HTTP/1 or HTTP/2 request/response representation.

Troubleshooting

diag proxy session list 7
diag dns cache stats
diag dns cache list
show event list

Test A and AAAA separately. For SOCKS, use socks5h when the hostname must be resolved by Smithproxy; plain socks5 may resolve locally in the client.