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

KAFKA-4759 Add support for IPv4 and IPv6 ranges in AclAuthorizer #9937

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

rgo
Copy link

@rgo rgo commented Jan 20, 2021

Adds IPv4 and IPv6 subnet support to ACL authorizer.

Notation supported:

  - CIDR blocks(192.168.1.0/24)
  - Ranges (192.168.1.1-192.168.1.254)

For the test strategy, I defined ranges and set ACLs with IPs included in that range and other that it is not included inside the range.

BTW suggestions are welcome (I don't know Scala and I haven't been coding in a long time) :)

JIRA ticket: https://issues.apache.org/jira/browse/KAFKA-4759

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@rgo
Copy link
Author

rgo commented Jan 20, 2021

@jeqo I've closed the old PR #9387 because it was a mess with all the merge commits, rebased commits and conflicts with latest changes.
Saludos!

build.gradle Outdated
@@ -752,6 +752,7 @@ project(':core') {
dependencies {
compile project(':clients')
compile project(':raft')
compile group: 'net.ripe.ipresource', name: 'ipresource', version: '1.47'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be possible to validate if it's better to import just the bits of code we need for this validation to work instead of adding a whole dependency?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeqo Not sure, I'll check all the magic done by contains method this weekend.

BTW I used that library because it comes from RIPE-NCC, an authority in this field, and it's being maintained. (https://github.com/RIPE-NCC/ipresource)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeqo sorry for the delay.

I've been reviewing the code flow and I don't see it easily replaceable:

  • ACL IP ranges are parsed and validated as slash notation(e.g. "10.0.0.0/16"), comma prefix notation (e.g. "10.0.0.0/16,/24,/25,/31") and ranges with dash (e.g. "10.0.0.0-10.1.2.3").
  • Host IPs are parsed to be valid IPv4 and IPv6 adresses.
  • For IPv6 cases, it's able to handle compressed IP adresses.
  • Ranges and IPs validation check not only format but values (e.g. not out bounded values are allowed as 256.0.0.0)
  • Compare probably is the easier part, ensure that ACL and host IP are the same type and check if host IP is inside the range.

I'd like to add that ipresource has a good test suite, it's covering a lot of cases https://github.com/RIPE-NCC/ipresource/tree/master/src/test/java/net/ripe/ipresource

Notations supported:

  - CIDR blocks(192.168.1.0/24)
  - Ranges (192.168.1.1-192.168.1.254)
@rgo rgo force-pushed the KAFKA-4759-acl-authorizer-subnet-support branch from 7335792 to beea392 Compare April 4, 2021 17:22
@EshginGuluzade
Copy link

hi, I wonder is this feature implemented somewhere in another PR?

@rgo
Copy link
Author

rgo commented Jan 10, 2024

hi, I wonder is this feature implemented somewhere in another PR?

Past month I received a PR in my branch to fix current conflicts. I will merge it as soon as possible.

But as far I can said it got blocked because of the request of removing the external library.

To be frank, it was rather discouraging the response time, making impossible any discussion (i.e., if the library should be used or not). Maybe things have changed, let's see.

@flyingcougar
Copy link

I agree with @rgo - implementing ipv4 and ipv6 string parsing, range checking might be error prone (lots of code and tests) and its better to realy on existing implementation that comes from network authority

@flyingcougar
Copy link

Seems that failures are not connected to the PR - similar ones are no trunk as well.

@rgo
Copy link
Author

rgo commented Jan 18, 2024

@flyingcougar yes, I also had (unrelated) issues with the test suite at the beginning.

Copy link

github-actions bot commented Dec 1, 2024

This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact).

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions bot added the stale Stale PRs label Dec 1, 2024
@ComBin
Copy link

ComBin commented Dec 2, 2024

/reopen
I would like it to be implemented.

@github-actions github-actions bot removed the stale Stale PRs label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants