oidc_adaptor(4gx)
oidc_adaptor — OpenID Connect (OIDC) access token verifier
Description
Section titled “Description”The module is part of libgromox_auth. gromox-http, gromox-imap and gromox-zcore always load it, and it stays idle while none of oidc_issuer, oidc_jwks_uri and oidc_audiences is set. An invalid combination is logged and leaves the service unregistered, which only the daemons that enabled OIDC treat as a startup error. Whether a daemon uses it is controlled by http_auth_outlook (mixed or oidc), imap_auth_oidc and zcore_auth_oidc respectively. Its auth_login_oidc service validates JSON Web Token (JWT) access tokens, resolves their mailbox identity with mysql_adaptor and applies the requested mailbox access privileges. It does not replace the static key auth_login_token service used by PHP-MAPI web single sign-on (SSO).
The directives are read from gromox.cfg, searched via the daemon's config_file_path. All daemons share these settings. Invalid settings fail initialization. Configuration changes require a process restart. SIGHUP does not change issuer, audiences, keys or policy during active requests. See gromox-oidc(7gx) for Outlook compatibility requirements.
Configuration directives (gromox.cfg)
Section titled “Configuration directives (gromox.cfg)”oidc_issuer
Required exact HTTPS issuer identifier, for example https://mail.example.com/auth/realms/grommunio for Keycloak. The token's iss (issuer) claim must match exactly. The discovery document is fetched from <issuer>/.well-known/openid-configuration, and the issuer contained therein must also match. Do not substitute the bridge's /adfs URL for Keycloak's actual issuer.
oidc_audiences
Required whitespace-separated list of accepted access token audiences. At least one string in the aud (audience) claim must match exactly. Examples are gromox-mapi for Outlook, gromox-imap for IMAP and gromox-eas for ActiveSync. Every daemon accepts every listed audience. These fixed identifiers do not depend on the public mail hostname. Only accept resources in the same trust boundary. This is not a per-request Host or per-tenant authorization check.
oidc_jwks_uri
Optional explicit HTTPS URL of the JSON Web Key Set (JWKS). If unset, the URL from the issuer's discovery document is used. When a JWKS download from the discovered URL fails or returns an invalid document, the discovered URL is dropped and discovery is repeated on the next permitted attempt. Redirects and non-HTTPS requests are not followed. Only RSA signing keys with a matching kid (key ID) and compatible alg, use and key_ops members are accepted.
oidc_userid_claim
Claim containing the primary SMTP mailbox identifier. This must be an issuer-controlled identity which users cannot change to impersonate another mailbox. A self-editable email address is not suitable.
Default: preferred_username
oidc_userid_claim_fallback
Whitespace-separated alternative claims tried when the primary claim is absent or empty. Fallback is disabled by default and must be enabled explicitly, because the requesting client decides which claims a token carries. Configure only claims with the same protected identity semantics as the primary claim.
Default: (empty)
oidc_clock_skew
Tolerance for validating the exp (expiration time) and nbf (not before) claims, limited to five minutes. The exp claim is mandatory and must be a positive integer. The nbf claim is optional, but must also be an integer if present.
Default: 60s
oidc_jwks_refresh_min
Minimum interval between JWKS fetch attempts, including successful attempts. Unknown key IDs therefore cannot trigger unbounded requests. Invalid signatures for a known cached key do not trigger a refresh.
Default: 30s (minimum 5s, maximum 1h)
oidc_jwks_cache_lifetime
Maximum age of usable cached signing keys, after which a refresh is required. Stale keys are rejected if the refresh fails, so a removed key is not trusted indefinitely. Must be at least oidc_jwks_refresh_min and at most one hour.
Default: 5min (minimum 30s)
oidc_ca_path
Optional PEM CA bundle file for TLS certificate verification. An empty value uses the system trust store. This directive denotes a file, not a directory. Certificate verification cannot be disabled. The JWKS is the trust anchor for all tokens, and an attacker who can substitute it can log in as any user. Use this directive to trust a private CA instead.
Validation and limits
Section titled “Validation and limits”Supported signing algorithms are RS256, RS384 and RS512, using RSA keys of 2048 to 8192 bits. Tokens must contain exactly three canonical, unpadded base64url segments with JSON objects, a supported algorithm, a signing key ID, an exact issuer, an accepted audience and a valid expiry. Unsupported critical JSON Object Signing and Encryption (JOSE) extensions and malformed claim types are rejected. Known non-access token types are rejected. Tokens containing a cnf (confirmation) claim are rejected, because this verifier only supports bearer tokens and does not verify token binding, Demonstrating Proof of Possession (DPoP) or mutual TLS proofs. Successful signature validation is followed by the normal mailbox lookup, account status and access privilege checks.
JWT size is limited to 64 KiB and discovery/JWKS responses to 1 MiB. Discovery and key downloads use libcurl with verified TLS 1.2 or newer and a ten-second request deadline. Without a libcurl that supports asynchronous DNS, the daemon still starts, but every OIDC login is refused. A blocking resolver cannot be interrupted by that deadline in a multithreaded daemon and would stall the authenticating worker. HTTP redirects, compressed responses and ambiguous framing are rejected, and proxy environment variables are ignored. Token contents are not logged. The cache is shared across daemon workers and refreshes are serialized. A verification request that needs a key refresh while another refresh is in flight waits for that refresh, so the worst case wait is two request deadlines, twenty seconds, when discovery and the key download both time out.
See also
Section titled “See also”gromox-oidc(7gx), http(8gx), imap(8gx), zcore(8gx), authmgr(4gx), mysql_adaptor(4gx)