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

Handle conflicting traffic restrictions for users who have access to Resources with overlapping addresses #4939

Open
jamilbk opened this issue May 9, 2024 · 6 comments
Assignees
Labels
area/connlib Firezone's core connectivity library area/portal Portal, panel, web, control plane, you name it! business_value/high Required by > 50% of our customer base complexity/hard Multi-day effort or more. kind/refactor Code refactoring
Milestone

Comments

@jamilbk
Copy link
Member

jamilbk commented May 9, 2024

Problem:

  • DevOps needs access to SSH and HTTPS on gitlab.company.com
  • Everyone needs access only to HTTPS on gitlab.company.com

Defining two Resources with a TCP/22 traffic restriction and TCP/443 restriction respectively would cause an issue because the Client/portal might pick the HTTPS resource instead for DevOps users.

There isn't an easy way to solve this. We need to send the Resource's address to the Portal from the client instead of the ResourceId, and let the portal find all matching Policies to send to the Gateway for access, so that the Gateway can coalesce the traffic restrictions properly.

@jamilbk
Copy link
Member Author

jamilbk commented May 9, 2024

cc @conectado @bmanifold @AndrewDryga

This is going to need a fix before we roll out #4743 I think... wondering if this is the easiest way to solve the issue.

Trying to avoid making the user create a Resource for all combinations of ports/protocols they want to limit for each Group, which is the current way you can solve the issue now.

@jamilbk
Copy link
Member Author

jamilbk commented May 9, 2024

Maybe the simpler approach is to move the traffic_filters to policies instead, since that is where the admin is linking a Group to a Resource, and they can define which traffic is allowed for the particular Group at the time of policy creation.

@jamilbk jamilbk changed the title Fix traffic restrictions for overlapping addresses Move traffic_filters to Policies May 9, 2024
@jamilbk jamilbk added complexity/medium Something that should not take more than a day or two. kind/refactor Code refactoring complexity/hard Multi-day effort or more. area/portal Portal, panel, web, control plane, you name it! business_value/high Required by > 50% of our customer base and removed complexity/medium Something that should not take more than a day or two. labels May 9, 2024
@jamilbk jamilbk added this to the 06/24 milestone May 9, 2024
@AndrewDryga
Copy link
Collaborator

AndrewDryga commented May 9, 2024

I think the use case here is weird, what you should do is define two resources:

  • gitlab.company.com:80,443 with access to everyone
  • gitlab.company.com:22 with access to devops

Then the client/gateway must differentiate between those two, if they do not - it's a bug. Plus there are many other reasons why two separate ports on the same hosts can have different resources. Moving this to policy is trying to hide the problem without solving it.

@jamilbk
Copy link
Member Author

jamilbk commented May 9, 2024

@AndrewDryga That won't work. DNS resolution doesn't take ports into account, so when a user who has access to both resolves the name, the client won't know which one is the one to use until traffic flows, at which point it's too late.

The other option is to send all traffic restrictions from the portal down to a gateway for a all Resources with the same address that the user has access to. I.e. to authorize based on address and not ResourceId.

We would need major changes to the way DNS is resolved and mappings handled to pick the right set of traffic filters to use.

I'm not seeing a better approach that won't require onerous refactoring?

@jamilbk
Copy link
Member Author

jamilbk commented May 9, 2024

Hm yeah, actually -- adding this to Policies won't solve the issue because the wrong policy could still be used to resolve access to the Resource.

For example, the Everyone policy granting access to the tcp/443 Resource could still be picked for the DevOps user who's trying to access tcp/22.

Need to think through this more. This means that Everyone policies can cause issues when tied to Resources with overlapping addresses, since there isn't a way to remove a Group from a policy definition.

@jamilbk jamilbk changed the title Move traffic_filters to Policies Handle conflicting traffic restrictions for users who have access to Resources with overlapping addresses May 9, 2024
@jamilbk
Copy link
Member Author

jamilbk commented May 9, 2024

Based on the above it seems that the fix here to have the client select all Resources that match a particular address seen, and use all of them in the allow access request.

The portal would then need to resolve all policies for the matched Resources and send them all down to Gateway, coalescing the traffic restrictions for that particular Peer.

@jamilbk jamilbk added the area/connlib Firezone's core connectivity library label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connlib Firezone's core connectivity library area/portal Portal, panel, web, control plane, you name it! business_value/high Required by > 50% of our customer base complexity/hard Multi-day effort or more. kind/refactor Code refactoring
Projects
None yet
Development

No branches or pull requests

4 participants