Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket authentication: IP bound make ticket be stateful #1193

Open
quantranhong1999 opened this issue Sep 23, 2024 · 1 comment
Open

Ticket authentication: IP bound make ticket be stateful #1193

quantranhong1999 opened this issue Sep 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@quantranhong1999
Copy link
Member

Today ticket (for Websocket web authentication) is IP bound.

If I have 2 APISIX nodes (what we have with CNB): node 1 with IP 172.19.0.1 and node 2 with IP 172.19.0.2.

I get the ticket via node 1:
POST http://apisix.example.com:9080/jmap/ws/ticket

{
  "clientAddress": "172.19.0.1",
  "value": "b11279c9-ac0c-4515-93a2-7d25deefe414",
  "generatedOn": "2024-09-23T03:12:09Z",
  "validUntil": "2024-09-23T03:13:09Z",
  "username": "[email protected]"
}

Then I connect to APISIX node 2, and use the ticket to authenticate Websocket:
ws://apisix.example.com:9080/jmap/ws?ticket=b11279c9-ac0c-4515-93a2-7d25deefe414

=> 401 Unauthorized, with TMail log org.apache.james.jmap.exceptions.UnauthorizedException: User is forbidden to use this ticket.

Reason: we enforce IP checking for ticket! Therefore the ticket is stateful.

The same would happen with MU deployment.

This is a technical limitation IMO and we should revise it.

@quantranhong1999 quantranhong1999 added the bug Something isn't working label Sep 23, 2024
@chibenwa
Copy link
Member

chibenwa commented Sep 23, 2024

Ok the issue comes from the source IP not to be preserved through the load balancing process.

We likely need a X-Real-IP header (or something like this) to be positioned on requests by the load balancers. APISIX should likely keep those header unchanged ( as it is itself load balanced ) and James should base its decisions based on the real-ip if supplied, falling back to the ip address of the socket if none.

We of course shall check the the outward most load balancer can not be tricked by the clients by supplying X-Real-Ip.

(It is a very good occasion to work on real IP preservation for HTTP based protocols, the way we did with PROXY protocol.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants