verification

The verification block defines custom certificate verification rules for TLS connections. Use this block to replace the standard certificate chain verification with custom logic, such as checking specific certificate fields, subject alternative names, or policy OIDs.

The verification block contains a pipeline that executes during the TLS handshake. The pipeline must end with either accept (allow connection) or reject (terminate connection). If the pipeline completes without an explicit accept or reject, the connection is rejected by default.

Important: When a verification block is present, it completely overrides the default certificate validation. The cert.valid variable indicates whether the standard certificate chain validation succeeded, but you must explicitly check it in your verification block. A verification block that only contains accept; would accept any certificate, including invalid, expired, or untrusted certificates.

Always check cert.valid first unless you have a specific reason to bypass standard validation.

Available Variables

The following cert namespace variables are available within the verification block:

VariableTypeDescription
cert.validbooleanDid standard certificate chain validation succeed?
cert.errorstringVerification error message (if validation failed)
cert.serverstringServer hostname (for client-side TLS verification)
cert.issuerstringCertificate issuer distinguished name
cert.subjectstringCertificate subject distinguished name
cert.serialnumberCertificate serial number
cert.issuedtimestampCertificate issue date
cert.expirestimestampCertificate expiry date
cert.policystring arrayCertificate policy OIDs
cert.sha256bytesSHA256 fingerprint of the certificate
cert.issuer.*string arrayIndividual issuer name components (cn, o, ou, c, st, l, dc, emailaddress)
cert.subject.*string arrayIndividual subject name components (cn, o, ou, c, st, l, dc, emailaddress)
cert.subject_alt.*string arraySubject alternative names (email, dns, dn, uri, ip, oid, upn, other)
cert.ca.**First CA certificate in the chain (same fields as cert.*)
cert.ca[N].**Nth CA certificate in the chain

Example: Certificate Policy Verification

Require certificates issued under a specific certificate policy OID (common in enterprise PKI deployments where different certificate templates have different policy OIDs):

tls {
    certificate "SERVER_CERT";
    certificate_key "SERVER_KEY";
    server_ca_certificate "CA_CERT";
    require_client_certificate true;
    client_ca_certificate "CLIENT_CA";

    verification {
        if any {
            # Always check certificate chain validity first
            cert.valid != true;
            # Require network device certificate policy
            cert.policy != "1.3.6.1.4.1.99999.1.2.3";
        } then {
            reject;
        } else {
            accept;
        }
    }
}

Example: Hostname Verification Override

When connecting to a server by IP address but the certificate contains a hostname. Note that cert.valid is checked first to ensure the certificate chain is valid:

connect {
    protocol tls;
    host "127.0.0.1";
    port 2083;

    tls {
        certificate "CLIENT_CERT";
        certificate_key "CLIENT_KEY";
        server_ca_certificate "SERVER_CA";

        verification {
            if any {
                # Always check certificate chain validity first
                cert.valid != true;
                # Then verify the expected hostname
                cert.subject_alt.dns != "radius.example.com";
            } then {
                reject;
            } else {
                accept;
            }
        }
    }
}

Example: Subject Alternative Name Validation

Verify the certificate contains an expected DNS name or email:

verification {
    if any {
        # Always check certificate chain validity first
        cert.valid != true;
        # Require certificate for wifi devices subdomain
        cert.subject_alt.dns !ends ".wifi.devices.example.com";
    } then {
        reject;
    } else {
        accept;
    }
}

Example: Certificate Field Validation

Reject certificates from specific issuers or with specific subject fields:

verification {
    if any {
        # Always check certificate chain validity first
        cert.valid != true;
        # Reject test certificates
        cert.subject_alt.email starts "test";
        # Require specific organization
        cert.subject.o != "Example Corp";
    } then {
        reject;
    } else {
        accept;
    }
}

Example: EAP-TLS Client Certificate Verification

Custom verification for EAP-TLS client certificates:

eap-tls {
    certificate "EAP_SERVER_CERT";
    certificate_key "EAP_SERVER_KEY";
    client_ca_certificate "EAP_CLIENT_CA";

    verification {
        if any {
        # Always check certificate chain validity first
            cert.valid != true;
            # Reject certificates with test email addresses
            cert.subject_alt.email starts "test";
        } then {
            reject;
        } else {
            accept;
        }
    }
}

Context-Specific Usage

The verification block can be used in multiple TLS contexts:

ContextDescription
servers.*.listen.tls.verificationServer-side client certificate verification
backends.radius.server.connect.tls.verificationRadSec proxy server certificate verification
aaa.policy.handler.*.eap-tls.verificationEAP-TLS client certificate verification
aaa.policy.handler.*.eap-ttls.verificationEAP-TTLS client certificate verification
aaa.policy.handler.*.eap-peap.verificationEAP-PEAP client certificate verification

See Also

Navigation
Parents