-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Restrict API key usage by source IP #8233
Comments
This should be feasible to implement in our custom TokenAuthentication class. We currently override only the We'll also need to do a bit of grunt work around mapping allowed IPs (e.g. networks and/or lists of individual IPs), but I certainly hope we can manage that. 🙂 |
Be aware that Python might not receive the "true" source IP because of being behind a proxy. It would be helpful if the documentation mentioned that where this feature is documented. Perhaps adding external links on how to configure passing remote IP in nginx, apache, etc. https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/ |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide. |
Can we keep this open ? Our compliance team is asking about when this could be implemented |
@PieterL75 would you like to volunteer to own it? |
I lack real coding ethics, but never afraid of a challenge... Must be in netbox/netbox/api/authentication.py ? adding a check under TokenPermissions/has_permission() ? |
Looks like I have a working solution... |
Given the substantial changes being introduced here (namely adding the @PieterL75 would you mind rebasing your PR on the |
I am assuming we would want to shoot for v3.3 now? |
What about 3.2.1 ? |
It's an API change, so it'll need to go in the next minor release (v3.3). |
Closes #8233: Restrict API key access by source IP
Closes #8233: Restrict API tokens by source IP
NetBox version
v3.1.4
Feature type
Change to existing functionality
Proposed functionality
Limit the access to the API with a certain API key by source IPs
Use case
We have API keys that belong to 'service accounts'. The source IP of these services consumers are known.
We should be able to limit the usage of these service account API keys to only the known sources.
This cannot be done by firewalls but needs to go to the application layer
If an API key gets compromised, it cannot be used outside of that scope of source IPs
Database changes
API Keys
External dependencies
No response
The text was updated successfully, but these errors were encountered: