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

Blocklist Filter #158

Closed
markmandel opened this issue Dec 9, 2020 · 6 comments · Fixed by #432
Closed

Blocklist Filter #158

markmandel opened this issue Dec 9, 2020 · 6 comments · Fixed by #432
Assignees
Labels
area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/design Proposal discussing new features / fixes and how they should be implemented kind/feature New feature or request priority/medium Issues that we want to resolve, but don't require immediate resolution.

Comments

@markmandel
Copy link
Member

Thinking about Server side DDOS mitigation, or just general abuse mitigation - being able to block specific addresses from sending traffic through to any gameserver should be useful.

Something like:

version: v1alpha1
static:
  filters:
    - name: quilkin.extensions.filters.block.v1alpha1.Block
      config:
        addresses:
          - "194.56.36.79"
          - "3FFE:0000:0000:0001:0200:F8FF:FE75:50DF"
  endpoints:
    - name: server-1
      address: 127.0.0.1:7001

Question: Not sure if we need to block IP and port, or just IP?

@markmandel markmandel added kind/feature New feature or request area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/design Proposal discussing new features / fixes and how they should be implemented labels Dec 9, 2020
@XAMPPRocky
Copy link
Collaborator

XAMPPRocky commented Jul 5, 2021

Since blocklists are such an essential part of proxies, I think it would be worth thinking of the blocklist not as a filter, but as a feature as part of a filter chain, so you'd set the list on that level, and then with #63 filters would be able to add and remove from the blocklist as part of their response.

Question: Not sure if we need to block IP and port, or just IP?

We'll need to be able to block both, as you can use the port for UDP reflection amplification attacks.

@XAMPPRocky XAMPPRocky added the priority/medium Issues that we want to resolve, but don't require immediate resolution. label Jul 5, 2021
@XAMPPRocky XAMPPRocky added this to Medium Priority in Priority Board Jul 5, 2021
@markmandel
Copy link
Member Author

Since blocklists are such an essential part of proxies, I think it would be worth thinking of the blocklist not as a filter, but as a feature as part of a filter chain, so you'd set the list on that level, and then with #63 filters would be able to add and remove from the blocklist as part of their response.

With #63 - I would suggest, let's take a user journey (this one seems like a good example), and flesh it out to see what we think we would like it to look like. I have some thoughts that think we can keep this quite simple, at least for first pass, but I won't dilute this ticket with those ideas for now.

I don't think we need to have a new special construct for blocklist management, it can work as a Filter, it just depends where it should be in the Filterchain ordering, but also keeps the cognitive overhead for users down -- but doing a user journey discussion on #63 will likely also find where the edge cases are.

@markmandel
Copy link
Member Author

I was thinking about this the other day, and wanted to get people's feedback:

  1. I think Quilkin should have it's own Allow/Deny features based on addresses. Yes, the end user may also block at a higher level than Quilkin, but if you are doing address based access control, it seems useful to be able to do redundant levels in case one fails.
  2. I'm not 100% convinced it's Quilkin's job to be managing anything outside of itself. But long term, it can push data out to other systems that may do so through rules and actions (when we work out what that looks like).
  3. I think it makes sense to combine block and allowlist functionality into a single Filter.

I've called this Firewall since I figure that's basically what it is.

version: v1alpha1
static:
  filters:
    - name: quilkin.extensions.filters.debug.v1alpha1.Firewall
      config:
        - direction: Read # ("Read": respond to on_read or "Write" for on_write filter events)
          action: Allow # (action on address/port match. "Allow" would allow traffic through, "Deny" would drop the packets)
          source: "192.168.51.0/24" # (ip4 or ipv6 Cidr)
          ports: # (which ports to match on)
             - 10 # (could be a single port, or a range with a `-` in the middle)
             - 1000-7000
  endpoints:
    - address: 127.0.0.1:7001

WDYT?

Some thoughts / questions I'm still thinking about, and would love feedback if you like the general idea:

  1. Should it be filters > rules > (array of rules), in case we want more top level config options? (I'm thinking if you want a "match first" approach on the filter vs "match all" option?)
  2. Not quite sure what standard defaults should be for source or ports - so for now we could leave them as required for configuration.

Thoughts?

@iffyio
Copy link
Collaborator

iffyio commented Sep 27, 2021

This makes sense merging both allow and deny into a Firewall filter!

Not quite sure what standard defaults should be for source or ports - so for now we could leave them as required for configuration.

Leaving them as required sounds reasonable. Also since the user specifies a list of rules, mistakenly having multiple rules in the list with default values might be a footgun otherwise.

Should it be filters > rules > (array of rules), in case we want more top level config options? (I'm thinking if you want a "match first" approach on the filter vs "match all" option?)

We can split the read/write rules into their own sections (like we do for e.g compress) since those rules won't relate to each other (e.g they can't conflict), so that we avoid specifying a direction per rule and its easier to view/process rules by direction.
Then I think this would also enable top level config options issue in the future too?

config:
  on_read:
  - action: Allow
    source: 0.0.0.0
    ports: [1,2,3]
  on_write:
  - action: Allow
    source: 0.0.0.1
    ports: [1,2,3]

@markmandel
Copy link
Member Author

markmandel commented Sep 27, 2021

We can split the read/write rules into their own sections (like we do for e.g compress) since those rules won't relate to each other (e.g they can't conflict), so that we avoid specifying a direction per rule and its easier to view/process rules by direction.

Yeees! Thanks for that. We should definitely stick to the already established nomenclature of on_read and on_write! That works nicely. So the full config would look like:

version: v1alpha1
static:
  filters:
    - name: quilkin.extensions.filters.debug.v1alpha1.Firewall
      config:
        on_read:
          - action: ALLOW # (action on address/port match. "Allow" would allow traffic through, "Deny" would drop the packets)
            source: "192.168.51.0/24" # (ip4 or ipv6 Cidr)
            ports: # (which ports to match on)
               - 10 # (could be a single port, or a range with a `-` in the middle)
               - 1000-7000
        on_write: 
          - action: DENY
            source: "192.168.51.0/24" # (ip4 or ipv6 Cidr)
            ports: # (which ports to match on)
               - 7000
  endpoints:
    - address: 127.0.0.1:7001

(Those values aren't that realistic 😄 but this is a 👍🏻 for me!)

@markmandel
Copy link
Member Author

Gonna start working on this. Let me know if anyone has any objections to the design above (can always tweak it as needed anyway).

@markmandel markmandel self-assigned this Sep 27, 2021
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 7, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 7, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 7, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 7, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 7, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
@XAMPPRocky XAMPPRocky moved this from To do to In progress in Running Quilkin As A Load Balancer Oct 11, 2021
@XAMPPRocky XAMPPRocky moved this from In progress to In Review in Running Quilkin As A Load Balancer Oct 11, 2021
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 19, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 22, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Oct 26, 2021
Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on googleforgames#158
Work on googleforgames#343
XAMPPRocky pushed a commit that referenced this issue Oct 28, 2021
* Code: Firewall filter

Code implementation of a Firewall filter that will allow/deny packets
based on their from address on both read and write.

Documentation to come next to finish off the below two tickets.

Work on #158
Work on #343

* Review updates, including refactoring with PortRange::new()
markmandel added a commit to markmandel/quilkin that referenced this issue Nov 3, 2021
While writing the docs, I found a typo in the name of the Filter, so
included that as well.

Closes googleforgames#158
Closes googleforgames#343
markmandel added a commit to markmandel/quilkin that referenced this issue Nov 4, 2021
While writing the docs, I found a typo in the name of the Filter, so
included that as well.

Closes googleforgames#158
Closes googleforgames#343
Running Quilkin As A Load Balancer automation moved this from In Review to Done Nov 5, 2021
Priority Board automation moved this from Medium Priority to Closed Nov 5, 2021
XAMPPRocky pushed a commit that referenced this issue Nov 5, 2021
* Documentation for Firewall filter

While writing the docs, I found a typo in the name of the Filter, so
included that as well.

Closes #158
Closes #343

* Review updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/design Proposal discussing new features / fixes and how they should be implemented kind/feature New feature or request priority/medium Issues that we want to resolve, but don't require immediate resolution.
Projects
Development

Successfully merging a pull request may close this issue.

3 participants