How XAuth Works
- Phase 1 completes using either PSK or public key authentication (Main Mode or Aggressive Mode).
- The gateway initiates an XAuth exchange, sending a
CFG_REQUESTpayload asking for username and password. - The client responds with a
CFG_REPLYcontaining the credentials. - The gateway validates the credentials and sends a
CFG_SETacknowledging success or failure. - If successful, IKEv1 Phase 2 (CHILD_SA) negotiation proceeds.
Authentication Modes
| Mode | local auth | remote auth | Description |
|---|---|---|---|
| XAuth (PSK + XAuth) | psk | psk + XAuth round | PSK Phase 1, then XAuth credentials |
| Hybrid Mode | pubkey | xauth | Gateway uses certificate; client uses only XAuth |
| XAuth + pubkey | pubkey | pubkey + XAuth round | Both peers use certificates, then XAuth |
Basic Configuration
- Gateway (XAuth + PSK)
- Gateway (Hybrid Mode)
- Client
Key Configuration Options
local / remote auth Values
| Value | Role | Description |
|---|---|---|
xauth | local (server) | Server will request XAuth from client |
xauth | remote (client) | Client will respond to XAuth requests |
xauth-generic | local | Explicitly use the xauth-generic backend |
xauth-pam | local | Use PAM for credential validation |
xauth-eap | local | Use EAP/RADIUS backend for validation |
xauth_id
Thexauth_id option in the local section of a client connection sets the username sent during the XAuth exchange:
id) and the XAuth username to differ — useful when the IKE identity is an IP address or FQDN but the XAuth credential is a username.
XAuth Secrets
XAuth credentials are stored in thesecrets section under eap or xauth prefixes (they are aliases for one another):
The
xauth and eap secret prefixes are interchangeable. Secrets defined under either prefix are used for both XAuth and EAP authentication.XAuth Backends
strongSwan provides multiple backends for validating XAuth credentials:xauth-generic
Validates credentials against secrets defined in
swanctl.conf (or ipsec.secrets). Best for simple, self-contained deployments.xauth-pam
Delegates credential validation to Linux PAM. Enables integration with OS user accounts, LDAP, or any PAM-compatible backend.
xauth-eap (via eap-radius)
The
eap-radius plugin registers an XAuth backend named radius. Use auth = xauth-radius to forward XAuth credentials to a RADIUS server.Using xauth-generic
This is the default backend whenauth = xauth is configured. Credentials are checked against shared secrets in swanctl.conf:
XAUTH_USER_NAME and XAUTH_USER_PASSWORD attributes from the client. It then looks up the provided username in the credential manager and performs a constant-time comparison of the password.
Using xauth-pam
strongswan.conf:
/etc/pam.d/ipsec.
Using xauth-radius
Requires theeap-radius plugin to be loaded and configured:
strongswan.conf as described in the EAP-RADIUS documentation.
Comparison with EAP (IKEv2)
| Feature | XAuth (IKEv1) | EAP (IKEv2) |
|---|---|---|
| Protocol version | IKEv1 only | IKEv2 only |
| Standardization | Cisco proprietary extension | RFC 3748, RFC 5996 |
| Method negotiation | None (fixed username/password) | Flexible (MD5, MSCHAPv2, TLS, etc.) |
| Mutual authentication | No (server not authenticated via XAuth) | Yes (with EAP-TLS, EAP-MSCHAPv2) |
| MSK generation | No | Yes (with most methods) |
| Multiple rounds | Via IKEv1 Mode Config only | RFC 4739 Multiple Authentication |
| Recommended for new deployments | No | Yes |