Wazuh Agent Client (wazuh-cert-oauth2-client)
A CLI tool run on the Wazuh agent host. It handles user authentication via OIDC, CSR generation, and submission to the backend.
Purpose
- Runs on an end host to obtain a signed certificate for the Wazuh agent via OAuth2.
- Supports OIDC: discovers endpoints, fetches JWKS, obtains and validates a token.
- Automates the end-to-end flow (optional): stop agent, generate key + CSR, submit CSR, save cert/key (and CA), set agent name, restart agent.
Typical flow
- Discover OIDC endpoints from
--issuer. - Fetch JWKS and obtain a token (service-account or user flow depending on
--is-service-accountand--client-secret). - Validate token and extract the name claim.
- Generate keypair and CSR (subject derived from token
sub). - Submit CSR to the server
--endpointwith Bearer auth. - Save certificate, private key, and CA certificate to paths.
- Optionally stop/restart the Wazuh agent and set the agent name.
Configuration
| Flag | Env Variable | Default | Purpose |
|---|---|---|---|
--issuer | ISSUER | https://login.wazuh.adorsys.team/realms/adorsys | OIDC issuer. |
--audience | AUDIENCE | account | Target audience(s). |
--client-id | CLIENT_ID | adorsys-machine-client | OAuth2 client id. |
--client-secret | CLIENT_SECRET | (none) | Optional client secret (enables client-credentials flow). |
--endpoint | ENDPOINT | https://cert.wazuh.adorsys.team/api/register-agent | Server endpoint for CSR submission. |
--is-service-account | IS_SERVICE_ACCOUNT | false | Whether the token subject is a service account. |
--cert-path | CERT_PATH | platform default | Destination cert path. |
--key-path | KEY_PATH | platform default | Destination key path. |
--agent-control | AGENT_CONTROL | true | Perform stop/set-name/restart. |
wazuh-cert-oauth2-client --help