goauthentik / goauthentik/authentik

RADIUS Outpost randomly matches wrong provider on overlapping CIDRs

Open
#22,853 0 comments 0 reactions 1 assignee Claimed by @BeryJu View on GitHub
bug bug/confirmed
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 1h
Merged PRs (30d)
644

Description

### Describe the bug

When multiple RADIUS providers are bound to a single Outpost, the Outpost does not evaluate incoming RADIUS requests using the longest prefix match (most specific CIDR) for the Client Networks field. Instead, if a client IP falls into overlapping subnets across multiple providers (e.g., 192.168.128.0/24 on Provider A, and 192.168.128.254/32 on Provider B), the Outpost evaluates the match non-deterministically.

In other words, if I have an Outpost with 2 RADIUS providers with one having a CIDR inside of the other, I will randomly get RADIUS authentication failure logs that would normally point to an issue with the shared secret. The actual issue is that the Providers on the Outpost are not being matched deterministically per longest match on the configured prefixes.

### How to reproduce

1. Create RADIUS Provider A:
- Client Networks: 192.168.128.0/24
- Shared Secret: Secret-A
2. Create RADIUS Provider B:
- Client Networks: 192.168.128.254/32 (this is within and a more specific prefix than the RADIUS Provider A's)
- Shared Secret: Secret-B
3. Bind both providers to a single RADIUS Outpost.
4. Send a RADIUS authentication request from a client device at 192.168.128.254 using Secret-B.
5. Observe alternating Access-Accept and invalid message authenticator rejections.
6. Remove the overlapping /24 subnet from Provider A and observe immediate resolution.

### Expected behavior

The Outpost should evaluate overlapping Client Networks using standard longest-prefix match logic. A request from 192.168.128.254 should consistently match the /32 provider and ignore the broader /24 provider, ensuring the correct shared secret and property mappings are reliably applied.

### Screenshots

_No response_

### Additional context

_No response_

### Deployment Method

Docker

### Version

2026.5.2

### Relevant log output

```shell
Overlapping Configuration State (Failing consistently on loop):
{"code":"Access-Request","error":"invalid message authenticator","event":"Invalid message authenticator","id":7,"ip":"192.168.128.254","level":"warning","logger":"authentik.outpost.radius","request":"a6bd11fa-2f28-468b-99cc-6ddec3f828e7","timestamp":"2026-06-04T02:29:09Z"}
{"code":"Access-Request","event":"Radius Request","id":7,"ip":"192.168.128.254","level":"info","logger":"authentik.outpost.radius","request":"1b19e716-e3e6-4d24-b78e-1e36b0c822bf","timestamp":"2026-06-04T02:29:14Z"}
{"code":"Access-Request","error":"invalid message authenticator","event":"Invalid message authenticator","id":7,"ip":"192.168.128.254","level":"warning","logger":"authentik.outpost.radius","request":"1b19e716-e3e6-4d24-b78e-1e36b0c822bf","timestamp":"2026-06-04T02:29:14Z"}

Deconflicting State Action (Immediate Success):
{"event":"Update providers","level":"info","logger":"authentik.outpost.radius","timestamp":"2026-06-04T02:30:07Z"}
{"code":"Access-Request","event":"Radius Request","id":192,"ip":"192.168.128.254","level":"info","logger":"authentik.outpost.radius","request":"dbc99956-f265-4d6d-be27-9a14120c4537","timestamp":"2026-06-04T02:30:15Z"}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.